History log of /u-boot/common/board_f.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 7bceb161 31-Mar-2024 Eugene Uriev <eugeneuriev@gmail.com>

mcheck: introduce mcheck_on_ramrelocation(.)

The using of pre-reloc/malloc_simple heap is
too hard to follow after the relocation.

So lets drop it from the pedantic registry
and switch to dlmalloc, when moved.

The offset is ignored, but kept in the API
for the probable case, when that early
heap is relocated too.

Signed-off-by: Eugene Uriev <eugeneuriev@gmail.com>

# d819250c 25-Jan-2024 Stefan Bosch <stefan_b@posteo.net>

common: board_f: change calculation of gd->mon_len to fix s5p4418 reloc

ARCH_NEXELL: Change calculation of monitor length (gd->mon_len) to fix
relocation at boards with s5p4418-SoC (ARCH_NEXELL). At s5p4418, _start
is after the header (NSIH). Therefore the monitor length has to be
calculated using __image_copy_start instead of _start in order the
whole monitor code is relocated.

Signed-off-by: Stefan Bosch <stefan_b@posteo.net>

# 1ef43f3b 03-Feb-2024 Raymond Mao <raymond.mao@linaro.org>

bloblist: refactor of bloblist_reloc()

The current bloblist pointer and size can be retrieved from global
data, so we don't need to pass them from the function arguments.
This change also help to remove all external access of gd->bloblist
outside of bloblist module.

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# eefe23c1 05-Dec-2023 Devarsh Thakkar <devarsht@ti.com>

video: Skip framebuffer reservation if already reserved

Skip framebufer reservation if it was already reserved from previous
stage and whose information was passed using a bloblist.

Return error in case framebuffer information received from bloblist is
invalid i.e NULL or empty.

While at it, improve the debug message to make it more clear that
address in discussion is of framebuffer and not bloblist and also match
it with printing scheme followed in video_reserve function.

Signed-off-by: Devarsh Thakkar <devarsht@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4ef9c772 05-Dec-2023 Devarsh Thakkar <devarsht@ti.com>

common/board_f: Catch bloblist before starting reservations

Start reservations needed for init sequence only after catching
bloblists from previous stage.

This is to avoid catching bloblists in the middle causing gaps while
u-boot is reserving.

Adjust the relocaddr as per video hand-off information received from
previous stage so that further reservations start only after regions
reserved for previous stages

Skip reservation for video memory if it was already filled by a
bloblist.

Signed-off-by: Devarsh Thakkar <devarsht@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3d653180 26-Sep-2023 Simon Glass <sjg@chromium.org>

bloblist: Support initing from multiple places

Typically the bloblist is set up after the devicetree is present. This
makes sense because bloblist may use malloc() to allocate the space it
needs.

However sometimes the devicetree itself may be present in the bloblist.
In that case it is at a known location in memory so we can init the
bloblist very early, before devicetree.

Add a flag to indicate whether the bloblist has been inited. Add a
function to init it only if needed. Use that in the init sequence.

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

# 3d6d5075 26-Sep-2023 Simon Glass <sjg@chromium.org>

spl: Use SYS_MALLOC_F instead of SYS_MALLOC_F_LEN

Use the new SPL/TPL/VPL_SYS_MALLOC_F symbols to determine whether the
malloc pool exists.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Sean Anderson <sean.anderson@seco.com>

# 6a32bfae 21-Aug-2023 Simon Glass <sjg@chromium.org>

freescale: Drop call to init_func_vid() in the init sequence

Use the misc_init_f event instead, which is designed for this purpose.

All boards with CONFIG_VID already enable CONFIG_EVENT.

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

# 13a7db9a 21-Aug-2023 Simon Glass <sjg@chromium.org>

x86: Convert arch_fsp_init() to use events

Convert this to use events instead of calling a function directly in the
init sequence.

Rename it to arch_fsp_init_f() to distinguish it from the one that happens
after relocation.

For FSPv2 nothing needs to be done here, so drop the empty function.

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

# c9eff0a6 21-Aug-2023 Simon Glass <sjg@chromium.org>

initcall: Support emitting events

At present the initcall list consists of a list of function pointers. Over
time the initcall lists will likely change to mostly emitting events,
since most of the calls are board- or arch-specific.

As a first step, allow an initcall to be an event type instead of a
function pointer. Add the required macro and update initcall_run_list() to
emit an event in that case, or ignore it if events are not enabled.

The bottom 8 bits of the function pointer are used to hold the event type,
with the rest being all ones. This should avoid any collision, since
initcalls should not be above 0xffffff00 in memory.

Convert misc_init_f over to use this mechanism.

Add comments to the initcall header file while we are here. Also fix up
the trace test to handle the change.

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

# 7e6e40c5 21-Aug-2023 Tom Rini <trini@konsulko.com>

Merge tag 'v2023.10-rc3' into next

Prepare v2023.10-rc3

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


# d768dd88 12-Aug-2023 Heinrich Schuchardt <xypron.glpk@gmx.de>

common: return type board_get_usable_ram_top

board_get_usable_ram_top() returns a physical address that is stored in
gd->ram_top. The return type of the function should be phys_addr_t like the
current type of gd->ram_top.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# b7080bfc 30-Jul-2023 Simon Glass <sjg@chromium.org>

video: Add a Kconfig option for SPL video handoff

At present this feature is enabled in SPL if a bloblist is available.
Some platforms may not want to use this, so add an option to allow the
feature to be disabled.

Note that the feature unfortunately only fills in part of the
video-handoff information, so causes failures on x86 platforms. For now,
disable it there.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> # qemu-x86_64

# ccea96f4 02-Aug-2023 Shiji Yang <yangshiji66@outlook.com>

treewide: unify the linker symbol reference format

Now all linker symbols are declared as type char[]. Though we can
reference the address via both the array name 'var' and its address
'&var'. It's better to unify them to avoid confusing developers.
This patch converts all '&var' linker symbol refrences to the most
commonly used format 'var'.

Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d8cb1dc9 21-Jul-2023 Bin Meng <bmeng.cn@gmail.com>

board_f: Cosmetic style fix

Some coding convention fixes for print_resetinfo().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5bc610a7 18-Jul-2023 Nikhil M Jain <n-jain1@ti.com>

common: board_f: Pass frame buffer info from SPL to u-boot

U-boot proper can use frame buffer address passed from SPL to reserve
the memory area used by framebuffer set in SPL so that splash image
set in SPL continues to get displayed while u-boot proper is running.

Put the framebuffer address and size in a bloblist to make them
available at u-boot proper, if in u-boot proper CONFIG_VIDEO is defined.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Devarsh Thakkar <devarsht@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8f015d37 15-Jul-2023 Simon Glass <sjg@chromium.org>

x86: Improve the trampoline in 64-bit mode

At present this leaves the stack at the pre-relocation value. This is not
ideal since we want to have U-Boot running entirely from the top of
memory.

In addition, the new global_data pointer is not actually used, since
the global_data pointer itself is relocated, then the pre-relocation value
is changed, so the effective value (after relocation) does not update.

Adjust the implementation to follow the 32-bit code more closely, with a
trampoline function which is passed the new stack and global_data pointer.
This ensures that the correct values come through even when relocating.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 874bf6e0 20-Jun-2023 Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

board_f: Relocate fdt even if GD_FLG_SKIP_RELOC is set

In case of OF_SEPARATE (!OF_EMBED), the devicetree blob is placed
after _end, and fdt_find_separate() always returns _end. There is
a .bss section after _end and the section is cleared before relocation.

When GD_FLG_SKIP_RELOC is set, relocation is skipped, so the blob is
still in .bss section, but will be cleared. As a result, the devicetree
become invalid.

To avoid this issue, should relocate it regardless of GD_FLG_SKIP_RELOC
in reloc_fdt().

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 56c3aa9a 22-Mar-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>

arch: m68k: Introduce trivial PIT based timer

The QEMU emulation of m68k does not support DMA timer, the only
timer that is supported is the PIT timer. Implement trivial PIT
timer support for m68k.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

# 2c88d5e1 15-Jan-2023 Simon Glass <sjg@chromium.org>

sandbox: Bring back setting mon_len in global_data

This change was made for the benefit of RISC-V but broke other
architectures also. In particular, tracing cannot work without this value.
Add it back for architectures which support it.

Fixes: 3c9fc23c443 ("sandbox: don't refer to symbol _init")
Signed-off-by: Simon Glass <sjg@chromium.org>

# 7c5c137c 04-Dec-2022 Tom Rini <trini@konsulko.com>

global: Migrate CONFIG_PRAM to CFG

Perform a simple rename of CONFIG_PRAM to CFG_PRAM

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

# 65cc0e2a 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_* to CFG_SYS_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS namespace do
not easily transition to Kconfig. In many cases they likely should come
from the device tree instead. Move these out of CONFIG namespace and in
to CFG namespace.

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

# aa6e94de 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_SDRAM_* to CFG_SYS_SDRAM_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS_SDRAM
namespace do not easily transition to Kconfig. In many cases they likely
should come from the device tree instead. Move these out of CONFIG
namespace and in to CFG namespace.

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

# 02f5a014 28-Oct-2022 Tom Rini <trini@konsulko.com>

SYS_NONCACHED_MEMORY: Correct comment in common/board_f.c

The comment block in reserve_noncached has a typo in one filename and
an incorrect filename in another function reference. Correct both of
these.

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

# 50128aeb 28-Oct-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

cyclic: get rid of cyclic_init()

Currently, we must call cyclic_init() at some point before
cyclic_register() becomes possible. That turns out to be somewhat
awkward, especially with SPL, and has resulted in a watchdog callback
not being registered, thus causing the board to prematurely reset.

We already rely on gd->cyclic reliably being set to NULL by the asm
code that clears all of gd. Now that the cyclic list is a hlist, and
thus an empty list is represented by a NULL head pointer, and struct
cyclic_drv has no other members, we can just as well drop a level of
indirection and put the hlist_head directly in struct
global_data. This doesn't increase the size of struct global_data,
gets rid of an early malloc(), and generates slightly smaller code.

But primarily, this avoids having to call cyclic_init() early; the cyclic
infrastructure is simply ready to register callbacks as soon as we
enter C code.

We can still end up with schedule() being called from asm very early,
so we still need to check that gd itself has been properly initialized
[*], but once it has, gd->cyclic_list is perfectly fine to access, and
will just be an empty list.

As for cyclic_uninit(), it was never really the opposite of
cyclic_init() since it didn't free the struct cyclic_drv nor set
gd->cyclic to NULL. Rename it to cyclic_unregister_all() and use that
in test/, and also insert a call at the end of the board_init_f
sequence so that gd->cyclic_list is a fresh empty list before we enter
board_init_r().

A small piece of ugliness is that I had to add a cast in
cyclic_get_list() to silence a "discards 'volatile' qualifier"
warning, but that is completely equivalent to the existing handling of
the uclass_root_s list_head member.

[*] I'm not really sure where we guarantee that the register used for
gd contains 0 until it gets explicitly initialized, but that must be
the case, otherwise testing gd for being NULL would not make much sense.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Tested-by: Tim Harvey <tharvey@gateworks.com> # imx8mm-venice-*

# 98463903 20-Oct-2022 Simon Glass <sjg@chromium.org>

Rename CONFIG_SYS_TEXT_BASE to CONFIG_TEXT_BASE

The current name is inconsistent with SPL which uses CONFIG_SPL_TEXT_BASE
and this makes it imposible to use CONFIG_VAL().

Rename it to resolve this problem.

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

# b86986c7 18-Oct-2022 Simon Glass <sjg@chromium.org>

video: Rename CONFIG_DM_VIDEO to CONFIG_VIDEO

Now that all the old code is gone, rename this option. Driver model
migration is now complete.

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

# f9b7bd7e 16-Oct-2022 Simon Glass <sjg@chromium.org>

video: cmd: Drop old LCD code

This relies on the old LCD implementation which is to be removed. Drop it.

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

# 9259bd17 10-Oct-2022 Michal Suchanek <msuchanek@suse.de>

common: board_f: Print information for all sysresets

Boards can have multiple sysresets, iterate all when printing sysreset
info.

Fixes: 23471aed5c ("board_f: Add reset status printing")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3c29c0fc 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: drop ifdefs around header includes

Drop the remaining ifdef around spl.h include.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# d63fc994 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: introduce arch_setup_dest_addr()

In order to move ppc-specific code out of setup_dest_addr(), provide an
arch-specific variant arch_setup_dest_addr(), that can be used by
architecture code to fix up the initial reloc address.

It is called at the end of setup_dest_addr() initcall and the default
implementation is a nop stub.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 85e68ae0 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: move CONFIG_MACH_TYPE logic to arch/arm/lib/bdinfo.c

asm/mach_type.h header and CONFIG_MACH_TYPE macro are arm-specific, so move
related bdinfo logic to arch_setup_bdinfo() in arch/arm/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 181cbd40 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: remove XTRN_DECLARE_GLOBAL_DATA_PTR dead code

The XTRN_DECLARE_GLOBAL_DATA_PTR declarations in ppc code are permanently
commented out, so there are no users for this macro:
#if 1
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r2")
#else /* We could use plain global data, but the resulting code is bigger */
#define XTRN_DECLARE_GLOBAL_DATA_PTR extern
#define DECLARE_GLOBAL_DATA_PTR XTRN_DECLARE_GLOBAL_DATA_PTR \
gd_t *gd
#endif

Remove all references to this macro, but add a documentation note regarding
the possibility of using plain global data for the GD pointer.

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

# 236f7396 18-Sep-2022 This contributor prefers not to receive mails <noreply@example.com>

board_f: show_dram_config: Print also real DRAM size

32-bit U-Boot builds cannot use more than around 2 GB of DDR memory. But on
some platforms/boards it is possible to connect also 4 GB SODIMM DDR memory.
U-Boot currently prints only effective size of RAM which can use, which may
be misleading as somebody would expect that this line prints total size of
connected DDR modules. So change show_dram_config code to prints both real
and effective DRAM size if they are different. If they are same then print
just one number like before. It is possible that effective size is just few
bytes smaller than the real size, so print both numbers only in case
function print_size() prints formats them differently.

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

# d92aee57 09-Sep-2022 This contributor prefers not to receive mails <noreply@example.com>

board_f: Fix printing gd->ram_size and gd->ram_top

Members gd->ram_size and gd->ram_top are of type phys_addr_t which does not
have to fit into ulong type. So cast them into unsigned long long.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 049704f8 09-Sep-2022 This contributor prefers not to receive mails <noreply@example.com>

board_f: Fix types for board_get_usable_ram_top()

Commit 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
changed type of ram_top member from ulong to phys_addr_t but did not
changed types in board_get_usable_ram_top() function which returns value
for ram_top.

So change ulong to phys_addr_t type also in board_get_usable_ram_top()
signature and implementations.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 29caf930 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]

# 70545642 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Integrate cyclic functionality at bootup in board_r/f

This patch adds a call to cyclic_init() to board_f/r.c, enabling the
common cyclic infrastructure. After this it's possible to add cyclic
functions via cyclic_register().

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

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

# 5d7f6014 20-Jun-2022 Tom Rini <trini@konsulko.com>

lcd: Remove legacy CONFIG_FB_ADDR code

No platforms set both CONFIG_LCD and CONFIG_FB_ADDR at this time, drop
this legacy code.

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

# d58c0074 24-Jun-2022 Michal Simek <michal.simek@amd.com>

microblaze: Add support for run time relocation

Microblaze is using NEEDS_MANUAL_RELOC from the beginnging. This is causing
issues with function pointer arrays which need to be updated manually after
relocation. Building code with -fPIC and linking with -pic will remove this
limitation and there is no longer need to run manual update.

By default still old option is enabled but by disabling NEEDS_MANUAL_RELOC
code will be compiled for full relocation.

The patch does couple of things which are connected to each other.
- Define STATIC_RELA dependency to call relocate-rela to fill sections.
- REMAKE_ELF was already enabled but u-boot file can't be used because
sections are empty. relocate-rela will fill them and output file is
u-boot.elf which should be used.
- Add support for full relocation (u-boot.elf)
- Add support for early relocation when u-boot.bin is loaded to different
address then CONFIG_SYS_TEXT_BASE
- Add rela.dyn and dynsym sections

Disabling NEEDS_MANUAL_RELOC U-Boot size increased by 10% of it's original
size (550kB to 608kB).

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/a845670b34925859b2e321875f7588a29f6655f9.1655299267.git.michal.simek@amd.com

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 24c904f3 06-Apr-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_MEM_TOP_HIDE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_MEM_TOP_HIDE

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

# 7fe32b34 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert arch_cpu_init_dm() to use events

Instead of a special function, send an event after driver model is inited
and adjust the boards which use this function.

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

# 42fdcebf 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert misc_init_f() to use events

This hook can be implmented using events, for the three boards that
actually use it.

Add the event type and event handlers. Drop CONFIG_MISC_INIT_F since we
can just use CONFIG_EVENT to control this. Since sandbox always enables
CONFIG_EVENT, we can drop the defconfig lines there too.

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

# 5a421904 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Set up the event system on start-up

Call event_init() before relocation to get the event system running.

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

# 7f3b79af 12-Jan-2022 Simon Glass <sjg@chromium.org>

bloblist: Rename the SPL tag

Add a U_BOOT prefix to this tag since it is specific to the U-Boot
project.

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

# d5b6e91b 03-Nov-2021 Simon Glass <sjg@chromium.org>

bloblist: Support allocating the bloblist

Typically the bloblist is positioned at a fixed address in memory until
relocation. This is convenient when it is set up in SPL or before
relocation.

But for EFI we want to set it up only when U-Boot proper is running. Add
a way to allocate it using malloc() and update the documentation to cover
this aspect of bloblist.

Note there are no tests of this feature at present, nor any direct testing
of bloblist_init().

This can be added, e.g. by making this option controllable at runtime.

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

# 47d7d036 13-Nov-2021 Marek Vasut <marex@denx.de>

board_f: Copy GD to new GD even if relocation disabled

Even if U-Boot has relocation disabled via GD_FLG_SKIP_RELOC , the
relocated stage of U-Boot still picks GD from new_gd location. The
U-Boot itself is not relocated, but GD might be, so copy the GD to
new GD location even if relocation is disabled.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Peng Fan <peng.fan@oss.nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# 55dabcc8 18-Aug-2021 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY

First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig. Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL. Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support. Convert all of the existing users to
one or more symbols.

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

# 69d9eda4 10-Jul-2021 Simon Glass <sjg@chromium.org>

i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

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

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

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

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

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

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <masahiroy@kernel.org>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@amd.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

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

common: Drop log.h from common header

Move this header out of the common header.

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

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

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

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

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

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

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

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

common: Drop net.h from common header

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

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

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

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

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

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

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

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

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

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

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

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

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

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

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

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

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

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

common: Move serial functions out of common.h

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

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

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

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

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

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

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

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

env: Move env_init() to env.h

Move env_init() over to the new header file.

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

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

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

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

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

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

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

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

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

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

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

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

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

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

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


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

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

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

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

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

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

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

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

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

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

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

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

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

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

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

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

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

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

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

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

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

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

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

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

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

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

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

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

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

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

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

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

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

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

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

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

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

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

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

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

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

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

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

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

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

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

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

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <masahiroy@kernel.org>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

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

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

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

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

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

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

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

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

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

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

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

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

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

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

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

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

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

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

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

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

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

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

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

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

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


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

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

# c956662c 10-Feb-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@amd.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <masahiroy@kernel.org>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

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

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

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

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@konsulko.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

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

# 746667f1 23-Nov-2014 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

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


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

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

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

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

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <masahiroy@kernel.org>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

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

# 5a1095a8 29-Aug-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

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

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

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

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <masahiroy@kernel.org>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

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

# 58dac327 05-Mar-2014 Masahiro Yamada <masahiroy@kernel.org>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

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


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <masahiroy@kernel.org>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

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

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <masahiroy@kernel.org>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

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

# 7f673c99 10-Jan-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

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


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

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

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

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

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

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


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

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

# a0ba279a 26-May-2013 Masahiro Yamada <masahiroy@kernel.org>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <masahiroy@kernel.org>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

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

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

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

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

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

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

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

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

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

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

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

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

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

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

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

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

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

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

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

# d819250c 25-Jan-2024 Stefan Bosch <stefan_b@posteo.net>

common: board_f: change calculation of gd->mon_len to fix s5p4418 reloc

ARCH_NEXELL: Change calculation of monitor length (gd->mon_len) to fix
relocation at boards with s5p4418-SoC (ARCH_NEXELL). At s5p4418, _start
is after the header (NSIH). Therefore the monitor length has to be
calculated using __image_copy_start instead of _start in order the
whole monitor code is relocated.

Signed-off-by: Stefan Bosch <stefan_b@posteo.net>

# 1ef43f3b 03-Feb-2024 Raymond Mao <raymond.mao@linaro.org>

bloblist: refactor of bloblist_reloc()

The current bloblist pointer and size can be retrieved from global
data, so we don't need to pass them from the function arguments.
This change also help to remove all external access of gd->bloblist
outside of bloblist module.

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# eefe23c1 05-Dec-2023 Devarsh Thakkar <devarsht@ti.com>

video: Skip framebuffer reservation if already reserved

Skip framebufer reservation if it was already reserved from previous
stage and whose information was passed using a bloblist.

Return error in case framebuffer information received from bloblist is
invalid i.e NULL or empty.

While at it, improve the debug message to make it more clear that
address in discussion is of framebuffer and not bloblist and also match
it with printing scheme followed in video_reserve function.

Signed-off-by: Devarsh Thakkar <devarsht@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4ef9c772 05-Dec-2023 Devarsh Thakkar <devarsht@ti.com>

common/board_f: Catch bloblist before starting reservations

Start reservations needed for init sequence only after catching
bloblists from previous stage.

This is to avoid catching bloblists in the middle causing gaps while
u-boot is reserving.

Adjust the relocaddr as per video hand-off information received from
previous stage so that further reservations start only after regions
reserved for previous stages

Skip reservation for video memory if it was already filled by a
bloblist.

Signed-off-by: Devarsh Thakkar <devarsht@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3d653180 26-Sep-2023 Simon Glass <sjg@chromium.org>

bloblist: Support initing from multiple places

Typically the bloblist is set up after the devicetree is present. This
makes sense because bloblist may use malloc() to allocate the space it
needs.

However sometimes the devicetree itself may be present in the bloblist.
In that case it is at a known location in memory so we can init the
bloblist very early, before devicetree.

Add a flag to indicate whether the bloblist has been inited. Add a
function to init it only if needed. Use that in the init sequence.

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

# 3d6d5075 26-Sep-2023 Simon Glass <sjg@chromium.org>

spl: Use SYS_MALLOC_F instead of SYS_MALLOC_F_LEN

Use the new SPL/TPL/VPL_SYS_MALLOC_F symbols to determine whether the
malloc pool exists.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Sean Anderson <sean.anderson@seco.com>

# 6a32bfae 21-Aug-2023 Simon Glass <sjg@chromium.org>

freescale: Drop call to init_func_vid() in the init sequence

Use the misc_init_f event instead, which is designed for this purpose.

All boards with CONFIG_VID already enable CONFIG_EVENT.

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

# 13a7db9a 21-Aug-2023 Simon Glass <sjg@chromium.org>

x86: Convert arch_fsp_init() to use events

Convert this to use events instead of calling a function directly in the
init sequence.

Rename it to arch_fsp_init_f() to distinguish it from the one that happens
after relocation.

For FSPv2 nothing needs to be done here, so drop the empty function.

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

# c9eff0a6 21-Aug-2023 Simon Glass <sjg@chromium.org>

initcall: Support emitting events

At present the initcall list consists of a list of function pointers. Over
time the initcall lists will likely change to mostly emitting events,
since most of the calls are board- or arch-specific.

As a first step, allow an initcall to be an event type instead of a
function pointer. Add the required macro and update initcall_run_list() to
emit an event in that case, or ignore it if events are not enabled.

The bottom 8 bits of the function pointer are used to hold the event type,
with the rest being all ones. This should avoid any collision, since
initcalls should not be above 0xffffff00 in memory.

Convert misc_init_f over to use this mechanism.

Add comments to the initcall header file while we are here. Also fix up
the trace test to handle the change.

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

# 7e6e40c5 21-Aug-2023 Tom Rini <trini@konsulko.com>

Merge tag 'v2023.10-rc3' into next

Prepare v2023.10-rc3

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


# d768dd88 12-Aug-2023 Heinrich Schuchardt <xypron.glpk@gmx.de>

common: return type board_get_usable_ram_top

board_get_usable_ram_top() returns a physical address that is stored in
gd->ram_top. The return type of the function should be phys_addr_t like the
current type of gd->ram_top.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# b7080bfc 30-Jul-2023 Simon Glass <sjg@chromium.org>

video: Add a Kconfig option for SPL video handoff

At present this feature is enabled in SPL if a bloblist is available.
Some platforms may not want to use this, so add an option to allow the
feature to be disabled.

Note that the feature unfortunately only fills in part of the
video-handoff information, so causes failures on x86 platforms. For now,
disable it there.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> # qemu-x86_64

# ccea96f4 02-Aug-2023 Shiji Yang <yangshiji66@outlook.com>

treewide: unify the linker symbol reference format

Now all linker symbols are declared as type char[]. Though we can
reference the address via both the array name 'var' and its address
'&var'. It's better to unify them to avoid confusing developers.
This patch converts all '&var' linker symbol refrences to the most
commonly used format 'var'.

Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d8cb1dc9 21-Jul-2023 Bin Meng <bmeng.cn@gmail.com>

board_f: Cosmetic style fix

Some coding convention fixes for print_resetinfo().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5bc610a7 18-Jul-2023 Nikhil M Jain <n-jain1@ti.com>

common: board_f: Pass frame buffer info from SPL to u-boot

U-boot proper can use frame buffer address passed from SPL to reserve
the memory area used by framebuffer set in SPL so that splash image
set in SPL continues to get displayed while u-boot proper is running.

Put the framebuffer address and size in a bloblist to make them
available at u-boot proper, if in u-boot proper CONFIG_VIDEO is defined.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Devarsh Thakkar <devarsht@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8f015d37 15-Jul-2023 Simon Glass <sjg@chromium.org>

x86: Improve the trampoline in 64-bit mode

At present this leaves the stack at the pre-relocation value. This is not
ideal since we want to have U-Boot running entirely from the top of
memory.

In addition, the new global_data pointer is not actually used, since
the global_data pointer itself is relocated, then the pre-relocation value
is changed, so the effective value (after relocation) does not update.

Adjust the implementation to follow the 32-bit code more closely, with a
trampoline function which is passed the new stack and global_data pointer.
This ensures that the correct values come through even when relocating.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 874bf6e0 20-Jun-2023 Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

board_f: Relocate fdt even if GD_FLG_SKIP_RELOC is set

In case of OF_SEPARATE (!OF_EMBED), the devicetree blob is placed
after _end, and fdt_find_separate() always returns _end. There is
a .bss section after _end and the section is cleared before relocation.

When GD_FLG_SKIP_RELOC is set, relocation is skipped, so the blob is
still in .bss section, but will be cleared. As a result, the devicetree
become invalid.

To avoid this issue, should relocate it regardless of GD_FLG_SKIP_RELOC
in reloc_fdt().

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 56c3aa9a 22-Mar-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>

arch: m68k: Introduce trivial PIT based timer

The QEMU emulation of m68k does not support DMA timer, the only
timer that is supported is the PIT timer. Implement trivial PIT
timer support for m68k.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

# 2c88d5e1 15-Jan-2023 Simon Glass <sjg@chromium.org>

sandbox: Bring back setting mon_len in global_data

This change was made for the benefit of RISC-V but broke other
architectures also. In particular, tracing cannot work without this value.
Add it back for architectures which support it.

Fixes: 3c9fc23c443 ("sandbox: don't refer to symbol _init")
Signed-off-by: Simon Glass <sjg@chromium.org>

# 7c5c137c 04-Dec-2022 Tom Rini <trini@konsulko.com>

global: Migrate CONFIG_PRAM to CFG

Perform a simple rename of CONFIG_PRAM to CFG_PRAM

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

# 65cc0e2a 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_* to CFG_SYS_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS namespace do
not easily transition to Kconfig. In many cases they likely should come
from the device tree instead. Move these out of CONFIG namespace and in
to CFG namespace.

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

# aa6e94de 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_SDRAM_* to CFG_SYS_SDRAM_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS_SDRAM
namespace do not easily transition to Kconfig. In many cases they likely
should come from the device tree instead. Move these out of CONFIG
namespace and in to CFG namespace.

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

# 02f5a014 28-Oct-2022 Tom Rini <trini@konsulko.com>

SYS_NONCACHED_MEMORY: Correct comment in common/board_f.c

The comment block in reserve_noncached has a typo in one filename and
an incorrect filename in another function reference. Correct both of
these.

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

# 50128aeb 28-Oct-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

cyclic: get rid of cyclic_init()

Currently, we must call cyclic_init() at some point before
cyclic_register() becomes possible. That turns out to be somewhat
awkward, especially with SPL, and has resulted in a watchdog callback
not being registered, thus causing the board to prematurely reset.

We already rely on gd->cyclic reliably being set to NULL by the asm
code that clears all of gd. Now that the cyclic list is a hlist, and
thus an empty list is represented by a NULL head pointer, and struct
cyclic_drv has no other members, we can just as well drop a level of
indirection and put the hlist_head directly in struct
global_data. This doesn't increase the size of struct global_data,
gets rid of an early malloc(), and generates slightly smaller code.

But primarily, this avoids having to call cyclic_init() early; the cyclic
infrastructure is simply ready to register callbacks as soon as we
enter C code.

We can still end up with schedule() being called from asm very early,
so we still need to check that gd itself has been properly initialized
[*], but once it has, gd->cyclic_list is perfectly fine to access, and
will just be an empty list.

As for cyclic_uninit(), it was never really the opposite of
cyclic_init() since it didn't free the struct cyclic_drv nor set
gd->cyclic to NULL. Rename it to cyclic_unregister_all() and use that
in test/, and also insert a call at the end of the board_init_f
sequence so that gd->cyclic_list is a fresh empty list before we enter
board_init_r().

A small piece of ugliness is that I had to add a cast in
cyclic_get_list() to silence a "discards 'volatile' qualifier"
warning, but that is completely equivalent to the existing handling of
the uclass_root_s list_head member.

[*] I'm not really sure where we guarantee that the register used for
gd contains 0 until it gets explicitly initialized, but that must be
the case, otherwise testing gd for being NULL would not make much sense.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Tested-by: Tim Harvey <tharvey@gateworks.com> # imx8mm-venice-*

# 98463903 20-Oct-2022 Simon Glass <sjg@chromium.org>

Rename CONFIG_SYS_TEXT_BASE to CONFIG_TEXT_BASE

The current name is inconsistent with SPL which uses CONFIG_SPL_TEXT_BASE
and this makes it imposible to use CONFIG_VAL().

Rename it to resolve this problem.

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

# b86986c7 18-Oct-2022 Simon Glass <sjg@chromium.org>

video: Rename CONFIG_DM_VIDEO to CONFIG_VIDEO

Now that all the old code is gone, rename this option. Driver model
migration is now complete.

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

# f9b7bd7e 16-Oct-2022 Simon Glass <sjg@chromium.org>

video: cmd: Drop old LCD code

This relies on the old LCD implementation which is to be removed. Drop it.

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

# 9259bd17 10-Oct-2022 Michal Suchanek <msuchanek@suse.de>

common: board_f: Print information for all sysresets

Boards can have multiple sysresets, iterate all when printing sysreset
info.

Fixes: 23471aed5c ("board_f: Add reset status printing")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3c29c0fc 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: drop ifdefs around header includes

Drop the remaining ifdef around spl.h include.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# d63fc994 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: introduce arch_setup_dest_addr()

In order to move ppc-specific code out of setup_dest_addr(), provide an
arch-specific variant arch_setup_dest_addr(), that can be used by
architecture code to fix up the initial reloc address.

It is called at the end of setup_dest_addr() initcall and the default
implementation is a nop stub.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 85e68ae0 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: move CONFIG_MACH_TYPE logic to arch/arm/lib/bdinfo.c

asm/mach_type.h header and CONFIG_MACH_TYPE macro are arm-specific, so move
related bdinfo logic to arch_setup_bdinfo() in arch/arm/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 181cbd40 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: remove XTRN_DECLARE_GLOBAL_DATA_PTR dead code

The XTRN_DECLARE_GLOBAL_DATA_PTR declarations in ppc code are permanently
commented out, so there are no users for this macro:
#if 1
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r2")
#else /* We could use plain global data, but the resulting code is bigger */
#define XTRN_DECLARE_GLOBAL_DATA_PTR extern
#define DECLARE_GLOBAL_DATA_PTR XTRN_DECLARE_GLOBAL_DATA_PTR \
gd_t *gd
#endif

Remove all references to this macro, but add a documentation note regarding
the possibility of using plain global data for the GD pointer.

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

# 236f7396 18-Sep-2022 This contributor prefers not to receive mails <noreply@example.com>

board_f: show_dram_config: Print also real DRAM size

32-bit U-Boot builds cannot use more than around 2 GB of DDR memory. But on
some platforms/boards it is possible to connect also 4 GB SODIMM DDR memory.
U-Boot currently prints only effective size of RAM which can use, which may
be misleading as somebody would expect that this line prints total size of
connected DDR modules. So change show_dram_config code to prints both real
and effective DRAM size if they are different. If they are same then print
just one number like before. It is possible that effective size is just few
bytes smaller than the real size, so print both numbers only in case
function print_size() prints formats them differently.

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

# d92aee57 09-Sep-2022 This contributor prefers not to receive mails <noreply@example.com>

board_f: Fix printing gd->ram_size and gd->ram_top

Members gd->ram_size and gd->ram_top are of type phys_addr_t which does not
have to fit into ulong type. So cast them into unsigned long long.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 049704f8 09-Sep-2022 This contributor prefers not to receive mails <noreply@example.com>

board_f: Fix types for board_get_usable_ram_top()

Commit 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
changed type of ram_top member from ulong to phys_addr_t but did not
changed types in board_get_usable_ram_top() function which returns value
for ram_top.

So change ulong to phys_addr_t type also in board_get_usable_ram_top()
signature and implementations.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 29caf930 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]

# 70545642 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Integrate cyclic functionality at bootup in board_r/f

This patch adds a call to cyclic_init() to board_f/r.c, enabling the
common cyclic infrastructure. After this it's possible to add cyclic
functions via cyclic_register().

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

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

# 5d7f6014 20-Jun-2022 Tom Rini <trini@konsulko.com>

lcd: Remove legacy CONFIG_FB_ADDR code

No platforms set both CONFIG_LCD and CONFIG_FB_ADDR at this time, drop
this legacy code.

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

# d58c0074 24-Jun-2022 Michal Simek <michal.simek@amd.com>

microblaze: Add support for run time relocation

Microblaze is using NEEDS_MANUAL_RELOC from the beginnging. This is causing
issues with function pointer arrays which need to be updated manually after
relocation. Building code with -fPIC and linking with -pic will remove this
limitation and there is no longer need to run manual update.

By default still old option is enabled but by disabling NEEDS_MANUAL_RELOC
code will be compiled for full relocation.

The patch does couple of things which are connected to each other.
- Define STATIC_RELA dependency to call relocate-rela to fill sections.
- REMAKE_ELF was already enabled but u-boot file can't be used because
sections are empty. relocate-rela will fill them and output file is
u-boot.elf which should be used.
- Add support for full relocation (u-boot.elf)
- Add support for early relocation when u-boot.bin is loaded to different
address then CONFIG_SYS_TEXT_BASE
- Add rela.dyn and dynsym sections

Disabling NEEDS_MANUAL_RELOC U-Boot size increased by 10% of it's original
size (550kB to 608kB).

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/a845670b34925859b2e321875f7588a29f6655f9.1655299267.git.michal.simek@amd.com

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 24c904f3 06-Apr-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_MEM_TOP_HIDE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_MEM_TOP_HIDE

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

# 7fe32b34 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert arch_cpu_init_dm() to use events

Instead of a special function, send an event after driver model is inited
and adjust the boards which use this function.

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

# 42fdcebf 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert misc_init_f() to use events

This hook can be implmented using events, for the three boards that
actually use it.

Add the event type and event handlers. Drop CONFIG_MISC_INIT_F since we
can just use CONFIG_EVENT to control this. Since sandbox always enables
CONFIG_EVENT, we can drop the defconfig lines there too.

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

# 5a421904 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Set up the event system on start-up

Call event_init() before relocation to get the event system running.

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

# 7f3b79af 12-Jan-2022 Simon Glass <sjg@chromium.org>

bloblist: Rename the SPL tag

Add a U_BOOT prefix to this tag since it is specific to the U-Boot
project.

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

# d5b6e91b 03-Nov-2021 Simon Glass <sjg@chromium.org>

bloblist: Support allocating the bloblist

Typically the bloblist is positioned at a fixed address in memory until
relocation. This is convenient when it is set up in SPL or before
relocation.

But for EFI we want to set it up only when U-Boot proper is running. Add
a way to allocate it using malloc() and update the documentation to cover
this aspect of bloblist.

Note there are no tests of this feature at present, nor any direct testing
of bloblist_init().

This can be added, e.g. by making this option controllable at runtime.

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

# 47d7d036 13-Nov-2021 Marek Vasut <marex@denx.de>

board_f: Copy GD to new GD even if relocation disabled

Even if U-Boot has relocation disabled via GD_FLG_SKIP_RELOC , the
relocated stage of U-Boot still picks GD from new_gd location. The
U-Boot itself is not relocated, but GD might be, so copy the GD to
new GD location even if relocation is disabled.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Peng Fan <peng.fan@oss.nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# 55dabcc8 18-Aug-2021 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY

First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig. Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL. Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support. Convert all of the existing users to
one or more symbols.

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

# 69d9eda4 10-Jul-2021 Simon Glass <sjg@chromium.org>

i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

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

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

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

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

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

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <masahiroy@kernel.org>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@amd.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

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

common: Drop log.h from common header

Move this header out of the common header.

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

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

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

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

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

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

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

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

common: Drop net.h from common header

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

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

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

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

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

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

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

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

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

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

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

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

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

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

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

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

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

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

common: Move serial functions out of common.h

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

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

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

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

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

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

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

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

env: Move env_init() to env.h

Move env_init() over to the new header file.

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

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

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

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

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

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

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

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

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

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

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

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

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

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

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


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

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

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

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

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

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

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

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

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

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

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

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

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

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

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

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

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

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

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

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

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

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

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

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

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

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

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

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

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

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

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

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

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

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

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

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

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

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

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

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

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

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

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

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

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

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

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

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <masahiroy@kernel.org>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

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

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

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

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

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

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

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

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

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

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

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

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

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

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

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

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

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

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

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

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

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

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

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

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

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


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

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

# c956662c 10-Feb-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@amd.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <masahiroy@kernel.org>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

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

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

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

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@konsulko.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

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

# 746667f1 23-Nov-2014 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

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


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

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

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

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

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <masahiroy@kernel.org>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

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

# 5a1095a8 29-Aug-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

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

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

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

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <masahiroy@kernel.org>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

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

# 58dac327 05-Mar-2014 Masahiro Yamada <masahiroy@kernel.org>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

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


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <masahiroy@kernel.org>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

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

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <masahiroy@kernel.org>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

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

# 7f673c99 10-Jan-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

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


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

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

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

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

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

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


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

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

# a0ba279a 26-May-2013 Masahiro Yamada <masahiroy@kernel.org>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <masahiroy@kernel.org>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

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

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

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

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

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

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

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

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

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

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

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

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

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

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

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

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

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

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

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

# eefe23c1 05-Dec-2023 Devarsh Thakkar <devarsht@ti.com>

video: Skip framebuffer reservation if already reserved

Skip framebufer reservation if it was already reserved from previous
stage and whose information was passed using a bloblist.

Return error in case framebuffer information received from bloblist is
invalid i.e NULL or empty.

While at it, improve the debug message to make it more clear that
address in discussion is of framebuffer and not bloblist and also match
it with printing scheme followed in video_reserve function.

Signed-off-by: Devarsh Thakkar <devarsht@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4ef9c772 05-Dec-2023 Devarsh Thakkar <devarsht@ti.com>

common/board_f: Catch bloblist before starting reservations

Start reservations needed for init sequence only after catching
bloblists from previous stage.

This is to avoid catching bloblists in the middle causing gaps while
u-boot is reserving.

Adjust the relocaddr as per video hand-off information received from
previous stage so that further reservations start only after regions
reserved for previous stages

Skip reservation for video memory if it was already filled by a
bloblist.

Signed-off-by: Devarsh Thakkar <devarsht@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3d653180 26-Sep-2023 Simon Glass <sjg@chromium.org>

bloblist: Support initing from multiple places

Typically the bloblist is set up after the devicetree is present. This
makes sense because bloblist may use malloc() to allocate the space it
needs.

However sometimes the devicetree itself may be present in the bloblist.
In that case it is at a known location in memory so we can init the
bloblist very early, before devicetree.

Add a flag to indicate whether the bloblist has been inited. Add a
function to init it only if needed. Use that in the init sequence.

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

# 3d6d5075 26-Sep-2023 Simon Glass <sjg@chromium.org>

spl: Use SYS_MALLOC_F instead of SYS_MALLOC_F_LEN

Use the new SPL/TPL/VPL_SYS_MALLOC_F symbols to determine whether the
malloc pool exists.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Sean Anderson <sean.anderson@seco.com>

# 6a32bfae 21-Aug-2023 Simon Glass <sjg@chromium.org>

freescale: Drop call to init_func_vid() in the init sequence

Use the misc_init_f event instead, which is designed for this purpose.

All boards with CONFIG_VID already enable CONFIG_EVENT.

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

# 13a7db9a 21-Aug-2023 Simon Glass <sjg@chromium.org>

x86: Convert arch_fsp_init() to use events

Convert this to use events instead of calling a function directly in the
init sequence.

Rename it to arch_fsp_init_f() to distinguish it from the one that happens
after relocation.

For FSPv2 nothing needs to be done here, so drop the empty function.

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

# c9eff0a6 21-Aug-2023 Simon Glass <sjg@chromium.org>

initcall: Support emitting events

At present the initcall list consists of a list of function pointers. Over
time the initcall lists will likely change to mostly emitting events,
since most of the calls are board- or arch-specific.

As a first step, allow an initcall to be an event type instead of a
function pointer. Add the required macro and update initcall_run_list() to
emit an event in that case, or ignore it if events are not enabled.

The bottom 8 bits of the function pointer are used to hold the event type,
with the rest being all ones. This should avoid any collision, since
initcalls should not be above 0xffffff00 in memory.

Convert misc_init_f over to use this mechanism.

Add comments to the initcall header file while we are here. Also fix up
the trace test to handle the change.

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

# 7e6e40c5 21-Aug-2023 Tom Rini <trini@konsulko.com>

Merge tag 'v2023.10-rc3' into next

Prepare v2023.10-rc3

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


# d768dd88 12-Aug-2023 Heinrich Schuchardt <xypron.glpk@gmx.de>

common: return type board_get_usable_ram_top

board_get_usable_ram_top() returns a physical address that is stored in
gd->ram_top. The return type of the function should be phys_addr_t like the
current type of gd->ram_top.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# b7080bfc 30-Jul-2023 Simon Glass <sjg@chromium.org>

video: Add a Kconfig option for SPL video handoff

At present this feature is enabled in SPL if a bloblist is available.
Some platforms may not want to use this, so add an option to allow the
feature to be disabled.

Note that the feature unfortunately only fills in part of the
video-handoff information, so causes failures on x86 platforms. For now,
disable it there.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> # qemu-x86_64

# ccea96f4 02-Aug-2023 Shiji Yang <yangshiji66@outlook.com>

treewide: unify the linker symbol reference format

Now all linker symbols are declared as type char[]. Though we can
reference the address via both the array name 'var' and its address
'&var'. It's better to unify them to avoid confusing developers.
This patch converts all '&var' linker symbol refrences to the most
commonly used format 'var'.

Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d8cb1dc9 21-Jul-2023 Bin Meng <bmeng.cn@gmail.com>

board_f: Cosmetic style fix

Some coding convention fixes for print_resetinfo().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5bc610a7 18-Jul-2023 Nikhil M Jain <n-jain1@ti.com>

common: board_f: Pass frame buffer info from SPL to u-boot

U-boot proper can use frame buffer address passed from SPL to reserve
the memory area used by framebuffer set in SPL so that splash image
set in SPL continues to get displayed while u-boot proper is running.

Put the framebuffer address and size in a bloblist to make them
available at u-boot proper, if in u-boot proper CONFIG_VIDEO is defined.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Devarsh Thakkar <devarsht@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8f015d37 15-Jul-2023 Simon Glass <sjg@chromium.org>

x86: Improve the trampoline in 64-bit mode

At present this leaves the stack at the pre-relocation value. This is not
ideal since we want to have U-Boot running entirely from the top of
memory.

In addition, the new global_data pointer is not actually used, since
the global_data pointer itself is relocated, then the pre-relocation value
is changed, so the effective value (after relocation) does not update.

Adjust the implementation to follow the 32-bit code more closely, with a
trampoline function which is passed the new stack and global_data pointer.
This ensures that the correct values come through even when relocating.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 874bf6e0 20-Jun-2023 Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

board_f: Relocate fdt even if GD_FLG_SKIP_RELOC is set

In case of OF_SEPARATE (!OF_EMBED), the devicetree blob is placed
after _end, and fdt_find_separate() always returns _end. There is
a .bss section after _end and the section is cleared before relocation.

When GD_FLG_SKIP_RELOC is set, relocation is skipped, so the blob is
still in .bss section, but will be cleared. As a result, the devicetree
become invalid.

To avoid this issue, should relocate it regardless of GD_FLG_SKIP_RELOC
in reloc_fdt().

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 56c3aa9a 22-Mar-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>

arch: m68k: Introduce trivial PIT based timer

The QEMU emulation of m68k does not support DMA timer, the only
timer that is supported is the PIT timer. Implement trivial PIT
timer support for m68k.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

# 2c88d5e1 15-Jan-2023 Simon Glass <sjg@chromium.org>

sandbox: Bring back setting mon_len in global_data

This change was made for the benefit of RISC-V but broke other
architectures also. In particular, tracing cannot work without this value.
Add it back for architectures which support it.

Fixes: 3c9fc23c443 ("sandbox: don't refer to symbol _init")
Signed-off-by: Simon Glass <sjg@chromium.org>

# 7c5c137c 04-Dec-2022 Tom Rini <trini@konsulko.com>

global: Migrate CONFIG_PRAM to CFG

Perform a simple rename of CONFIG_PRAM to CFG_PRAM

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

# 65cc0e2a 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_* to CFG_SYS_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS namespace do
not easily transition to Kconfig. In many cases they likely should come
from the device tree instead. Move these out of CONFIG namespace and in
to CFG namespace.

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

# aa6e94de 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_SDRAM_* to CFG_SYS_SDRAM_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS_SDRAM
namespace do not easily transition to Kconfig. In many cases they likely
should come from the device tree instead. Move these out of CONFIG
namespace and in to CFG namespace.

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

# 02f5a014 28-Oct-2022 Tom Rini <trini@konsulko.com>

SYS_NONCACHED_MEMORY: Correct comment in common/board_f.c

The comment block in reserve_noncached has a typo in one filename and
an incorrect filename in another function reference. Correct both of
these.

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

# 50128aeb 28-Oct-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

cyclic: get rid of cyclic_init()

Currently, we must call cyclic_init() at some point before
cyclic_register() becomes possible. That turns out to be somewhat
awkward, especially with SPL, and has resulted in a watchdog callback
not being registered, thus causing the board to prematurely reset.

We already rely on gd->cyclic reliably being set to NULL by the asm
code that clears all of gd. Now that the cyclic list is a hlist, and
thus an empty list is represented by a NULL head pointer, and struct
cyclic_drv has no other members, we can just as well drop a level of
indirection and put the hlist_head directly in struct
global_data. This doesn't increase the size of struct global_data,
gets rid of an early malloc(), and generates slightly smaller code.

But primarily, this avoids having to call cyclic_init() early; the cyclic
infrastructure is simply ready to register callbacks as soon as we
enter C code.

We can still end up with schedule() being called from asm very early,
so we still need to check that gd itself has been properly initialized
[*], but once it has, gd->cyclic_list is perfectly fine to access, and
will just be an empty list.

As for cyclic_uninit(), it was never really the opposite of
cyclic_init() since it didn't free the struct cyclic_drv nor set
gd->cyclic to NULL. Rename it to cyclic_unregister_all() and use that
in test/, and also insert a call at the end of the board_init_f
sequence so that gd->cyclic_list is a fresh empty list before we enter
board_init_r().

A small piece of ugliness is that I had to add a cast in
cyclic_get_list() to silence a "discards 'volatile' qualifier"
warning, but that is completely equivalent to the existing handling of
the uclass_root_s list_head member.

[*] I'm not really sure where we guarantee that the register used for
gd contains 0 until it gets explicitly initialized, but that must be
the case, otherwise testing gd for being NULL would not make much sense.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Tested-by: Tim Harvey <tharvey@gateworks.com> # imx8mm-venice-*

# 98463903 20-Oct-2022 Simon Glass <sjg@chromium.org>

Rename CONFIG_SYS_TEXT_BASE to CONFIG_TEXT_BASE

The current name is inconsistent with SPL which uses CONFIG_SPL_TEXT_BASE
and this makes it imposible to use CONFIG_VAL().

Rename it to resolve this problem.

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

# b86986c7 18-Oct-2022 Simon Glass <sjg@chromium.org>

video: Rename CONFIG_DM_VIDEO to CONFIG_VIDEO

Now that all the old code is gone, rename this option. Driver model
migration is now complete.

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

# f9b7bd7e 16-Oct-2022 Simon Glass <sjg@chromium.org>

video: cmd: Drop old LCD code

This relies on the old LCD implementation which is to be removed. Drop it.

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

# 9259bd17 10-Oct-2022 Michal Suchanek <msuchanek@suse.de>

common: board_f: Print information for all sysresets

Boards can have multiple sysresets, iterate all when printing sysreset
info.

Fixes: 23471aed5c ("board_f: Add reset status printing")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3c29c0fc 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: drop ifdefs around header includes

Drop the remaining ifdef around spl.h include.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# d63fc994 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: introduce arch_setup_dest_addr()

In order to move ppc-specific code out of setup_dest_addr(), provide an
arch-specific variant arch_setup_dest_addr(), that can be used by
architecture code to fix up the initial reloc address.

It is called at the end of setup_dest_addr() initcall and the default
implementation is a nop stub.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 85e68ae0 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: move CONFIG_MACH_TYPE logic to arch/arm/lib/bdinfo.c

asm/mach_type.h header and CONFIG_MACH_TYPE macro are arm-specific, so move
related bdinfo logic to arch_setup_bdinfo() in arch/arm/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 181cbd40 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: remove XTRN_DECLARE_GLOBAL_DATA_PTR dead code

The XTRN_DECLARE_GLOBAL_DATA_PTR declarations in ppc code are permanently
commented out, so there are no users for this macro:
#if 1
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r2")
#else /* We could use plain global data, but the resulting code is bigger */
#define XTRN_DECLARE_GLOBAL_DATA_PTR extern
#define DECLARE_GLOBAL_DATA_PTR XTRN_DECLARE_GLOBAL_DATA_PTR \
gd_t *gd
#endif

Remove all references to this macro, but add a documentation note regarding
the possibility of using plain global data for the GD pointer.

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

# 236f7396 18-Sep-2022 This contributor prefers not to receive mails <noreply@example.com>

board_f: show_dram_config: Print also real DRAM size

32-bit U-Boot builds cannot use more than around 2 GB of DDR memory. But on
some platforms/boards it is possible to connect also 4 GB SODIMM DDR memory.
U-Boot currently prints only effective size of RAM which can use, which may
be misleading as somebody would expect that this line prints total size of
connected DDR modules. So change show_dram_config code to prints both real
and effective DRAM size if they are different. If they are same then print
just one number like before. It is possible that effective size is just few
bytes smaller than the real size, so print both numbers only in case
function print_size() prints formats them differently.

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

# d92aee57 09-Sep-2022 This contributor prefers not to receive mails <noreply@example.com>

board_f: Fix printing gd->ram_size and gd->ram_top

Members gd->ram_size and gd->ram_top are of type phys_addr_t which does not
have to fit into ulong type. So cast them into unsigned long long.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 049704f8 09-Sep-2022 This contributor prefers not to receive mails <noreply@example.com>

board_f: Fix types for board_get_usable_ram_top()

Commit 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
changed type of ram_top member from ulong to phys_addr_t but did not
changed types in board_get_usable_ram_top() function which returns value
for ram_top.

So change ulong to phys_addr_t type also in board_get_usable_ram_top()
signature and implementations.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 29caf930 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]

# 70545642 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Integrate cyclic functionality at bootup in board_r/f

This patch adds a call to cyclic_init() to board_f/r.c, enabling the
common cyclic infrastructure. After this it's possible to add cyclic
functions via cyclic_register().

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

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

# 5d7f6014 20-Jun-2022 Tom Rini <trini@konsulko.com>

lcd: Remove legacy CONFIG_FB_ADDR code

No platforms set both CONFIG_LCD and CONFIG_FB_ADDR at this time, drop
this legacy code.

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

# d58c0074 24-Jun-2022 Michal Simek <michal.simek@amd.com>

microblaze: Add support for run time relocation

Microblaze is using NEEDS_MANUAL_RELOC from the beginnging. This is causing
issues with function pointer arrays which need to be updated manually after
relocation. Building code with -fPIC and linking with -pic will remove this
limitation and there is no longer need to run manual update.

By default still old option is enabled but by disabling NEEDS_MANUAL_RELOC
code will be compiled for full relocation.

The patch does couple of things which are connected to each other.
- Define STATIC_RELA dependency to call relocate-rela to fill sections.
- REMAKE_ELF was already enabled but u-boot file can't be used because
sections are empty. relocate-rela will fill them and output file is
u-boot.elf which should be used.
- Add support for full relocation (u-boot.elf)
- Add support for early relocation when u-boot.bin is loaded to different
address then CONFIG_SYS_TEXT_BASE
- Add rela.dyn and dynsym sections

Disabling NEEDS_MANUAL_RELOC U-Boot size increased by 10% of it's original
size (550kB to 608kB).

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/a845670b34925859b2e321875f7588a29f6655f9.1655299267.git.michal.simek@amd.com

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 24c904f3 06-Apr-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_MEM_TOP_HIDE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_MEM_TOP_HIDE

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

# 7fe32b34 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert arch_cpu_init_dm() to use events

Instead of a special function, send an event after driver model is inited
and adjust the boards which use this function.

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

# 42fdcebf 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert misc_init_f() to use events

This hook can be implmented using events, for the three boards that
actually use it.

Add the event type and event handlers. Drop CONFIG_MISC_INIT_F since we
can just use CONFIG_EVENT to control this. Since sandbox always enables
CONFIG_EVENT, we can drop the defconfig lines there too.

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

# 5a421904 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Set up the event system on start-up

Call event_init() before relocation to get the event system running.

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

# 7f3b79af 12-Jan-2022 Simon Glass <sjg@chromium.org>

bloblist: Rename the SPL tag

Add a U_BOOT prefix to this tag since it is specific to the U-Boot
project.

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

# d5b6e91b 03-Nov-2021 Simon Glass <sjg@chromium.org>

bloblist: Support allocating the bloblist

Typically the bloblist is positioned at a fixed address in memory until
relocation. This is convenient when it is set up in SPL or before
relocation.

But for EFI we want to set it up only when U-Boot proper is running. Add
a way to allocate it using malloc() and update the documentation to cover
this aspect of bloblist.

Note there are no tests of this feature at present, nor any direct testing
of bloblist_init().

This can be added, e.g. by making this option controllable at runtime.

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

# 47d7d036 13-Nov-2021 Marek Vasut <marex@denx.de>

board_f: Copy GD to new GD even if relocation disabled

Even if U-Boot has relocation disabled via GD_FLG_SKIP_RELOC , the
relocated stage of U-Boot still picks GD from new_gd location. The
U-Boot itself is not relocated, but GD might be, so copy the GD to
new GD location even if relocation is disabled.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Peng Fan <peng.fan@oss.nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# 55dabcc8 18-Aug-2021 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY

First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig. Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL. Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support. Convert all of the existing users to
one or more symbols.

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

# 69d9eda4 10-Jul-2021 Simon Glass <sjg@chromium.org>

i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

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

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

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

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

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

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <masahiroy@kernel.org>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@amd.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

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

common: Drop log.h from common header

Move this header out of the common header.

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

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

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

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

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

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

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

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

common: Drop net.h from common header

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

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

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

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

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

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

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

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

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

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

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

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

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

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

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

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

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

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

common: Move serial functions out of common.h

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

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

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

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

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

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

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

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

env: Move env_init() to env.h

Move env_init() over to the new header file.

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

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

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

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

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

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

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

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

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

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

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

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

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

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

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


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

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

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

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

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

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

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

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

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

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

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

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

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

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

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

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

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

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

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

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

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

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

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

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

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

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

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

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

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

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

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

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

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

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

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

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

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

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

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

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

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

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

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

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

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

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

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

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <masahiroy@kernel.org>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

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

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

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

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

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

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

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

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

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

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

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

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

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

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

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

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

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

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

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

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

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

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

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

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

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


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

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

# c956662c 10-Feb-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@amd.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <masahiroy@kernel.org>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

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

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

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

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@konsulko.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

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

# 746667f1 23-Nov-2014 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

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


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

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

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

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

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <masahiroy@kernel.org>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

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

# 5a1095a8 29-Aug-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

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

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

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

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <masahiroy@kernel.org>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

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

# 58dac327 05-Mar-2014 Masahiro Yamada <masahiroy@kernel.org>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

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


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <masahiroy@kernel.org>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

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

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <masahiroy@kernel.org>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

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

# 7f673c99 10-Jan-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

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


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

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

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

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

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

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


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

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

# a0ba279a 26-May-2013 Masahiro Yamada <masahiroy@kernel.org>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <masahiroy@kernel.org>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

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

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

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

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

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

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

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

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

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

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

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

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

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

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

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

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

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

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

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

# 3d653180 26-Sep-2023 Simon Glass <sjg@chromium.org>

bloblist: Support initing from multiple places

Typically the bloblist is set up after the devicetree is present. This
makes sense because bloblist may use malloc() to allocate the space it
needs.

However sometimes the devicetree itself may be present in the bloblist.
In that case it is at a known location in memory so we can init the
bloblist very early, before devicetree.

Add a flag to indicate whether the bloblist has been inited. Add a
function to init it only if needed. Use that in the init sequence.

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

# 3d6d5075 26-Sep-2023 Simon Glass <sjg@chromium.org>

spl: Use SYS_MALLOC_F instead of SYS_MALLOC_F_LEN

Use the new SPL/TPL/VPL_SYS_MALLOC_F symbols to determine whether the
malloc pool exists.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Sean Anderson <sean.anderson@seco.com>

# 6a32bfae 21-Aug-2023 Simon Glass <sjg@chromium.org>

freescale: Drop call to init_func_vid() in the init sequence

Use the misc_init_f event instead, which is designed for this purpose.

All boards with CONFIG_VID already enable CONFIG_EVENT.

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

# 13a7db9a 21-Aug-2023 Simon Glass <sjg@chromium.org>

x86: Convert arch_fsp_init() to use events

Convert this to use events instead of calling a function directly in the
init sequence.

Rename it to arch_fsp_init_f() to distinguish it from the one that happens
after relocation.

For FSPv2 nothing needs to be done here, so drop the empty function.

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

# c9eff0a6 21-Aug-2023 Simon Glass <sjg@chromium.org>

initcall: Support emitting events

At present the initcall list consists of a list of function pointers. Over
time the initcall lists will likely change to mostly emitting events,
since most of the calls are board- or arch-specific.

As a first step, allow an initcall to be an event type instead of a
function pointer. Add the required macro and update initcall_run_list() to
emit an event in that case, or ignore it if events are not enabled.

The bottom 8 bits of the function pointer are used to hold the event type,
with the rest being all ones. This should avoid any collision, since
initcalls should not be above 0xffffff00 in memory.

Convert misc_init_f over to use this mechanism.

Add comments to the initcall header file while we are here. Also fix up
the trace test to handle the change.

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

# 7e6e40c5 21-Aug-2023 Tom Rini <trini@konsulko.com>

Merge tag 'v2023.10-rc3' into next

Prepare v2023.10-rc3

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


# d768dd88 12-Aug-2023 Heinrich Schuchardt <xypron.glpk@gmx.de>

common: return type board_get_usable_ram_top

board_get_usable_ram_top() returns a physical address that is stored in
gd->ram_top. The return type of the function should be phys_addr_t like the
current type of gd->ram_top.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# b7080bfc 30-Jul-2023 Simon Glass <sjg@chromium.org>

video: Add a Kconfig option for SPL video handoff

At present this feature is enabled in SPL if a bloblist is available.
Some platforms may not want to use this, so add an option to allow the
feature to be disabled.

Note that the feature unfortunately only fills in part of the
video-handoff information, so causes failures on x86 platforms. For now,
disable it there.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> # qemu-x86_64

# ccea96f4 02-Aug-2023 Shiji Yang <yangshiji66@outlook.com>

treewide: unify the linker symbol reference format

Now all linker symbols are declared as type char[]. Though we can
reference the address via both the array name 'var' and its address
'&var'. It's better to unify them to avoid confusing developers.
This patch converts all '&var' linker symbol refrences to the most
commonly used format 'var'.

Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d8cb1dc9 21-Jul-2023 Bin Meng <bmeng.cn@gmail.com>

board_f: Cosmetic style fix

Some coding convention fixes for print_resetinfo().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5bc610a7 18-Jul-2023 Nikhil M Jain <n-jain1@ti.com>

common: board_f: Pass frame buffer info from SPL to u-boot

U-boot proper can use frame buffer address passed from SPL to reserve
the memory area used by framebuffer set in SPL so that splash image
set in SPL continues to get displayed while u-boot proper is running.

Put the framebuffer address and size in a bloblist to make them
available at u-boot proper, if in u-boot proper CONFIG_VIDEO is defined.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Devarsh Thakkar <devarsht@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8f015d37 15-Jul-2023 Simon Glass <sjg@chromium.org>

x86: Improve the trampoline in 64-bit mode

At present this leaves the stack at the pre-relocation value. This is not
ideal since we want to have U-Boot running entirely from the top of
memory.

In addition, the new global_data pointer is not actually used, since
the global_data pointer itself is relocated, then the pre-relocation value
is changed, so the effective value (after relocation) does not update.

Adjust the implementation to follow the 32-bit code more closely, with a
trampoline function which is passed the new stack and global_data pointer.
This ensures that the correct values come through even when relocating.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 874bf6e0 20-Jun-2023 Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

board_f: Relocate fdt even if GD_FLG_SKIP_RELOC is set

In case of OF_SEPARATE (!OF_EMBED), the devicetree blob is placed
after _end, and fdt_find_separate() always returns _end. There is
a .bss section after _end and the section is cleared before relocation.

When GD_FLG_SKIP_RELOC is set, relocation is skipped, so the blob is
still in .bss section, but will be cleared. As a result, the devicetree
become invalid.

To avoid this issue, should relocate it regardless of GD_FLG_SKIP_RELOC
in reloc_fdt().

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 56c3aa9a 22-Mar-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>

arch: m68k: Introduce trivial PIT based timer

The QEMU emulation of m68k does not support DMA timer, the only
timer that is supported is the PIT timer. Implement trivial PIT
timer support for m68k.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

# 2c88d5e1 15-Jan-2023 Simon Glass <sjg@chromium.org>

sandbox: Bring back setting mon_len in global_data

This change was made for the benefit of RISC-V but broke other
architectures also. In particular, tracing cannot work without this value.
Add it back for architectures which support it.

Fixes: 3c9fc23c443 ("sandbox: don't refer to symbol _init")
Signed-off-by: Simon Glass <sjg@chromium.org>

# 7c5c137c 04-Dec-2022 Tom Rini <trini@konsulko.com>

global: Migrate CONFIG_PRAM to CFG

Perform a simple rename of CONFIG_PRAM to CFG_PRAM

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

# 65cc0e2a 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_* to CFG_SYS_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS namespace do
not easily transition to Kconfig. In many cases they likely should come
from the device tree instead. Move these out of CONFIG namespace and in
to CFG namespace.

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

# aa6e94de 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_SDRAM_* to CFG_SYS_SDRAM_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS_SDRAM
namespace do not easily transition to Kconfig. In many cases they likely
should come from the device tree instead. Move these out of CONFIG
namespace and in to CFG namespace.

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

# 02f5a014 28-Oct-2022 Tom Rini <trini@konsulko.com>

SYS_NONCACHED_MEMORY: Correct comment in common/board_f.c

The comment block in reserve_noncached has a typo in one filename and
an incorrect filename in another function reference. Correct both of
these.

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

# 50128aeb 28-Oct-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

cyclic: get rid of cyclic_init()

Currently, we must call cyclic_init() at some point before
cyclic_register() becomes possible. That turns out to be somewhat
awkward, especially with SPL, and has resulted in a watchdog callback
not being registered, thus causing the board to prematurely reset.

We already rely on gd->cyclic reliably being set to NULL by the asm
code that clears all of gd. Now that the cyclic list is a hlist, and
thus an empty list is represented by a NULL head pointer, and struct
cyclic_drv has no other members, we can just as well drop a level of
indirection and put the hlist_head directly in struct
global_data. This doesn't increase the size of struct global_data,
gets rid of an early malloc(), and generates slightly smaller code.

But primarily, this avoids having to call cyclic_init() early; the cyclic
infrastructure is simply ready to register callbacks as soon as we
enter C code.

We can still end up with schedule() being called from asm very early,
so we still need to check that gd itself has been properly initialized
[*], but once it has, gd->cyclic_list is perfectly fine to access, and
will just be an empty list.

As for cyclic_uninit(), it was never really the opposite of
cyclic_init() since it didn't free the struct cyclic_drv nor set
gd->cyclic to NULL. Rename it to cyclic_unregister_all() and use that
in test/, and also insert a call at the end of the board_init_f
sequence so that gd->cyclic_list is a fresh empty list before we enter
board_init_r().

A small piece of ugliness is that I had to add a cast in
cyclic_get_list() to silence a "discards 'volatile' qualifier"
warning, but that is completely equivalent to the existing handling of
the uclass_root_s list_head member.

[*] I'm not really sure where we guarantee that the register used for
gd contains 0 until it gets explicitly initialized, but that must be
the case, otherwise testing gd for being NULL would not make much sense.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Tested-by: Tim Harvey <tharvey@gateworks.com> # imx8mm-venice-*

# 98463903 20-Oct-2022 Simon Glass <sjg@chromium.org>

Rename CONFIG_SYS_TEXT_BASE to CONFIG_TEXT_BASE

The current name is inconsistent with SPL which uses CONFIG_SPL_TEXT_BASE
and this makes it imposible to use CONFIG_VAL().

Rename it to resolve this problem.

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

# b86986c7 18-Oct-2022 Simon Glass <sjg@chromium.org>

video: Rename CONFIG_DM_VIDEO to CONFIG_VIDEO

Now that all the old code is gone, rename this option. Driver model
migration is now complete.

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

# f9b7bd7e 16-Oct-2022 Simon Glass <sjg@chromium.org>

video: cmd: Drop old LCD code

This relies on the old LCD implementation which is to be removed. Drop it.

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

# 9259bd17 10-Oct-2022 Michal Suchanek <msuchanek@suse.de>

common: board_f: Print information for all sysresets

Boards can have multiple sysresets, iterate all when printing sysreset
info.

Fixes: 23471aed5c ("board_f: Add reset status printing")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3c29c0fc 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: drop ifdefs around header includes

Drop the remaining ifdef around spl.h include.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# d63fc994 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: introduce arch_setup_dest_addr()

In order to move ppc-specific code out of setup_dest_addr(), provide an
arch-specific variant arch_setup_dest_addr(), that can be used by
architecture code to fix up the initial reloc address.

It is called at the end of setup_dest_addr() initcall and the default
implementation is a nop stub.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 85e68ae0 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: move CONFIG_MACH_TYPE logic to arch/arm/lib/bdinfo.c

asm/mach_type.h header and CONFIG_MACH_TYPE macro are arm-specific, so move
related bdinfo logic to arch_setup_bdinfo() in arch/arm/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 181cbd40 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: remove XTRN_DECLARE_GLOBAL_DATA_PTR dead code

The XTRN_DECLARE_GLOBAL_DATA_PTR declarations in ppc code are permanently
commented out, so there are no users for this macro:
#if 1
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r2")
#else /* We could use plain global data, but the resulting code is bigger */
#define XTRN_DECLARE_GLOBAL_DATA_PTR extern
#define DECLARE_GLOBAL_DATA_PTR XTRN_DECLARE_GLOBAL_DATA_PTR \
gd_t *gd
#endif

Remove all references to this macro, but add a documentation note regarding
the possibility of using plain global data for the GD pointer.

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

# 236f7396 18-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: show_dram_config: Print also real DRAM size

32-bit U-Boot builds cannot use more than around 2 GB of DDR memory. But on
some platforms/boards it is possible to connect also 4 GB SODIMM DDR memory.
U-Boot currently prints only effective size of RAM which can use, which may
be misleading as somebody would expect that this line prints total size of
connected DDR modules. So change show_dram_config code to prints both real
and effective DRAM size if they are different. If they are same then print
just one number like before. It is possible that effective size is just few
bytes smaller than the real size, so print both numbers only in case
function print_size() prints formats them differently.

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

# d92aee57 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix printing gd->ram_size and gd->ram_top

Members gd->ram_size and gd->ram_top are of type phys_addr_t which does not
have to fit into ulong type. So cast them into unsigned long long.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 049704f8 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix types for board_get_usable_ram_top()

Commit 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
changed type of ram_top member from ulong to phys_addr_t but did not
changed types in board_get_usable_ram_top() function which returns value
for ram_top.

So change ulong to phys_addr_t type also in board_get_usable_ram_top()
signature and implementations.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 29caf930 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]

# 70545642 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Integrate cyclic functionality at bootup in board_r/f

This patch adds a call to cyclic_init() to board_f/r.c, enabling the
common cyclic infrastructure. After this it's possible to add cyclic
functions via cyclic_register().

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

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

# 5d7f6014 20-Jun-2022 Tom Rini <trini@konsulko.com>

lcd: Remove legacy CONFIG_FB_ADDR code

No platforms set both CONFIG_LCD and CONFIG_FB_ADDR at this time, drop
this legacy code.

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

# d58c0074 24-Jun-2022 Michal Simek <michal.simek@amd.com>

microblaze: Add support for run time relocation

Microblaze is using NEEDS_MANUAL_RELOC from the beginnging. This is causing
issues with function pointer arrays which need to be updated manually after
relocation. Building code with -fPIC and linking with -pic will remove this
limitation and there is no longer need to run manual update.

By default still old option is enabled but by disabling NEEDS_MANUAL_RELOC
code will be compiled for full relocation.

The patch does couple of things which are connected to each other.
- Define STATIC_RELA dependency to call relocate-rela to fill sections.
- REMAKE_ELF was already enabled but u-boot file can't be used because
sections are empty. relocate-rela will fill them and output file is
u-boot.elf which should be used.
- Add support for full relocation (u-boot.elf)
- Add support for early relocation when u-boot.bin is loaded to different
address then CONFIG_SYS_TEXT_BASE
- Add rela.dyn and dynsym sections

Disabling NEEDS_MANUAL_RELOC U-Boot size increased by 10% of it's original
size (550kB to 608kB).

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/a845670b34925859b2e321875f7588a29f6655f9.1655299267.git.michal.simek@amd.com

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 24c904f3 06-Apr-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_MEM_TOP_HIDE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_MEM_TOP_HIDE

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

# 7fe32b34 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert arch_cpu_init_dm() to use events

Instead of a special function, send an event after driver model is inited
and adjust the boards which use this function.

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

# 42fdcebf 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert misc_init_f() to use events

This hook can be implmented using events, for the three boards that
actually use it.

Add the event type and event handlers. Drop CONFIG_MISC_INIT_F since we
can just use CONFIG_EVENT to control this. Since sandbox always enables
CONFIG_EVENT, we can drop the defconfig lines there too.

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

# 5a421904 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Set up the event system on start-up

Call event_init() before relocation to get the event system running.

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

# 7f3b79af 12-Jan-2022 Simon Glass <sjg@chromium.org>

bloblist: Rename the SPL tag

Add a U_BOOT prefix to this tag since it is specific to the U-Boot
project.

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

# d5b6e91b 03-Nov-2021 Simon Glass <sjg@chromium.org>

bloblist: Support allocating the bloblist

Typically the bloblist is positioned at a fixed address in memory until
relocation. This is convenient when it is set up in SPL or before
relocation.

But for EFI we want to set it up only when U-Boot proper is running. Add
a way to allocate it using malloc() and update the documentation to cover
this aspect of bloblist.

Note there are no tests of this feature at present, nor any direct testing
of bloblist_init().

This can be added, e.g. by making this option controllable at runtime.

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

# 47d7d036 13-Nov-2021 Marek Vasut <marex@denx.de>

board_f: Copy GD to new GD even if relocation disabled

Even if U-Boot has relocation disabled via GD_FLG_SKIP_RELOC , the
relocated stage of U-Boot still picks GD from new_gd location. The
U-Boot itself is not relocated, but GD might be, so copy the GD to
new GD location even if relocation is disabled.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Peng Fan <peng.fan@oss.nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# 55dabcc8 18-Aug-2021 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY

First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig. Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL. Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support. Convert all of the existing users to
one or more symbols.

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

# 69d9eda4 10-Jul-2021 Simon Glass <sjg@chromium.org>

i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

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

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

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

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

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

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <masahiroy@kernel.org>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@amd.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

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

common: Drop log.h from common header

Move this header out of the common header.

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

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

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

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

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

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

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

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

common: Drop net.h from common header

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

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

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

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

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

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

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

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

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

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

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

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

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

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

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

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

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

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

common: Move serial functions out of common.h

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

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

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

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

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

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

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

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

env: Move env_init() to env.h

Move env_init() over to the new header file.

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

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

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

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

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

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

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

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

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

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

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

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

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

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

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


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

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

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

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

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

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

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

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

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

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

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

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

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

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

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

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

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

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

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

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

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

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

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

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

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

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

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

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

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

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

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

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

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

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

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

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

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

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

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

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

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

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

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

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

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

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

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

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <masahiroy@kernel.org>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

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

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

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

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

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

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

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

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

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

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

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

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

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

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

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

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

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

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

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

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

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

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

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

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

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


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

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

# c956662c 10-Feb-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@amd.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <masahiroy@kernel.org>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

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

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

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

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@konsulko.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

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

# 746667f1 23-Nov-2014 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

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


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

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

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

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

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <masahiroy@kernel.org>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

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

# 5a1095a8 29-Aug-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

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

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

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

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <masahiroy@kernel.org>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

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

# 58dac327 05-Mar-2014 Masahiro Yamada <masahiroy@kernel.org>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

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


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <masahiroy@kernel.org>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

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

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <masahiroy@kernel.org>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

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

# 7f673c99 10-Jan-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

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


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

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

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

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

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

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


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

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

# a0ba279a 26-May-2013 Masahiro Yamada <masahiroy@kernel.org>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <masahiroy@kernel.org>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

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

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

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

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

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

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

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

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

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

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

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

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

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

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

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

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

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

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

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

# 6a32bfae 21-Aug-2023 Simon Glass <sjg@chromium.org>

freescale: Drop call to init_func_vid() in the init sequence

Use the misc_init_f event instead, which is designed for this purpose.

All boards with CONFIG_VID already enable CONFIG_EVENT.

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

# 13a7db9a 21-Aug-2023 Simon Glass <sjg@chromium.org>

x86: Convert arch_fsp_init() to use events

Convert this to use events instead of calling a function directly in the
init sequence.

Rename it to arch_fsp_init_f() to distinguish it from the one that happens
after relocation.

For FSPv2 nothing needs to be done here, so drop the empty function.

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

# c9eff0a6 21-Aug-2023 Simon Glass <sjg@chromium.org>

initcall: Support emitting events

At present the initcall list consists of a list of function pointers. Over
time the initcall lists will likely change to mostly emitting events,
since most of the calls are board- or arch-specific.

As a first step, allow an initcall to be an event type instead of a
function pointer. Add the required macro and update initcall_run_list() to
emit an event in that case, or ignore it if events are not enabled.

The bottom 8 bits of the function pointer are used to hold the event type,
with the rest being all ones. This should avoid any collision, since
initcalls should not be above 0xffffff00 in memory.

Convert misc_init_f over to use this mechanism.

Add comments to the initcall header file while we are here. Also fix up
the trace test to handle the change.

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

# 7e6e40c5 21-Aug-2023 Tom Rini <trini@konsulko.com>

Merge tag 'v2023.10-rc3' into next

Prepare v2023.10-rc3

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


# d768dd88 12-Aug-2023 Heinrich Schuchardt <xypron.glpk@gmx.de>

common: return type board_get_usable_ram_top

board_get_usable_ram_top() returns a physical address that is stored in
gd->ram_top. The return type of the function should be phys_addr_t like the
current type of gd->ram_top.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# b7080bfc 30-Jul-2023 Simon Glass <sjg@chromium.org>

video: Add a Kconfig option for SPL video handoff

At present this feature is enabled in SPL if a bloblist is available.
Some platforms may not want to use this, so add an option to allow the
feature to be disabled.

Note that the feature unfortunately only fills in part of the
video-handoff information, so causes failures on x86 platforms. For now,
disable it there.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> # qemu-x86_64

# ccea96f4 02-Aug-2023 Shiji Yang <yangshiji66@outlook.com>

treewide: unify the linker symbol reference format

Now all linker symbols are declared as type char[]. Though we can
reference the address via both the array name 'var' and its address
'&var'. It's better to unify them to avoid confusing developers.
This patch converts all '&var' linker symbol refrences to the most
commonly used format 'var'.

Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d8cb1dc9 21-Jul-2023 Bin Meng <bmeng.cn@gmail.com>

board_f: Cosmetic style fix

Some coding convention fixes for print_resetinfo().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5bc610a7 18-Jul-2023 Nikhil M Jain <n-jain1@ti.com>

common: board_f: Pass frame buffer info from SPL to u-boot

U-boot proper can use frame buffer address passed from SPL to reserve
the memory area used by framebuffer set in SPL so that splash image
set in SPL continues to get displayed while u-boot proper is running.

Put the framebuffer address and size in a bloblist to make them
available at u-boot proper, if in u-boot proper CONFIG_VIDEO is defined.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Devarsh Thakkar <devarsht@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8f015d37 15-Jul-2023 Simon Glass <sjg@chromium.org>

x86: Improve the trampoline in 64-bit mode

At present this leaves the stack at the pre-relocation value. This is not
ideal since we want to have U-Boot running entirely from the top of
memory.

In addition, the new global_data pointer is not actually used, since
the global_data pointer itself is relocated, then the pre-relocation value
is changed, so the effective value (after relocation) does not update.

Adjust the implementation to follow the 32-bit code more closely, with a
trampoline function which is passed the new stack and global_data pointer.
This ensures that the correct values come through even when relocating.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 874bf6e0 20-Jun-2023 Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

board_f: Relocate fdt even if GD_FLG_SKIP_RELOC is set

In case of OF_SEPARATE (!OF_EMBED), the devicetree blob is placed
after _end, and fdt_find_separate() always returns _end. There is
a .bss section after _end and the section is cleared before relocation.

When GD_FLG_SKIP_RELOC is set, relocation is skipped, so the blob is
still in .bss section, but will be cleared. As a result, the devicetree
become invalid.

To avoid this issue, should relocate it regardless of GD_FLG_SKIP_RELOC
in reloc_fdt().

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 56c3aa9a 22-Mar-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>

arch: m68k: Introduce trivial PIT based timer

The QEMU emulation of m68k does not support DMA timer, the only
timer that is supported is the PIT timer. Implement trivial PIT
timer support for m68k.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

# 2c88d5e1 15-Jan-2023 Simon Glass <sjg@chromium.org>

sandbox: Bring back setting mon_len in global_data

This change was made for the benefit of RISC-V but broke other
architectures also. In particular, tracing cannot work without this value.
Add it back for architectures which support it.

Fixes: 3c9fc23c443 ("sandbox: don't refer to symbol _init")
Signed-off-by: Simon Glass <sjg@chromium.org>

# 7c5c137c 04-Dec-2022 Tom Rini <trini@konsulko.com>

global: Migrate CONFIG_PRAM to CFG

Perform a simple rename of CONFIG_PRAM to CFG_PRAM

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

# 65cc0e2a 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_* to CFG_SYS_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS namespace do
not easily transition to Kconfig. In many cases they likely should come
from the device tree instead. Move these out of CONFIG namespace and in
to CFG namespace.

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

# aa6e94de 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_SDRAM_* to CFG_SYS_SDRAM_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS_SDRAM
namespace do not easily transition to Kconfig. In many cases they likely
should come from the device tree instead. Move these out of CONFIG
namespace and in to CFG namespace.

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

# 02f5a014 28-Oct-2022 Tom Rini <trini@konsulko.com>

SYS_NONCACHED_MEMORY: Correct comment in common/board_f.c

The comment block in reserve_noncached has a typo in one filename and
an incorrect filename in another function reference. Correct both of
these.

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

# 50128aeb 28-Oct-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

cyclic: get rid of cyclic_init()

Currently, we must call cyclic_init() at some point before
cyclic_register() becomes possible. That turns out to be somewhat
awkward, especially with SPL, and has resulted in a watchdog callback
not being registered, thus causing the board to prematurely reset.

We already rely on gd->cyclic reliably being set to NULL by the asm
code that clears all of gd. Now that the cyclic list is a hlist, and
thus an empty list is represented by a NULL head pointer, and struct
cyclic_drv has no other members, we can just as well drop a level of
indirection and put the hlist_head directly in struct
global_data. This doesn't increase the size of struct global_data,
gets rid of an early malloc(), and generates slightly smaller code.

But primarily, this avoids having to call cyclic_init() early; the cyclic
infrastructure is simply ready to register callbacks as soon as we
enter C code.

We can still end up with schedule() being called from asm very early,
so we still need to check that gd itself has been properly initialized
[*], but once it has, gd->cyclic_list is perfectly fine to access, and
will just be an empty list.

As for cyclic_uninit(), it was never really the opposite of
cyclic_init() since it didn't free the struct cyclic_drv nor set
gd->cyclic to NULL. Rename it to cyclic_unregister_all() and use that
in test/, and also insert a call at the end of the board_init_f
sequence so that gd->cyclic_list is a fresh empty list before we enter
board_init_r().

A small piece of ugliness is that I had to add a cast in
cyclic_get_list() to silence a "discards 'volatile' qualifier"
warning, but that is completely equivalent to the existing handling of
the uclass_root_s list_head member.

[*] I'm not really sure where we guarantee that the register used for
gd contains 0 until it gets explicitly initialized, but that must be
the case, otherwise testing gd for being NULL would not make much sense.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Tested-by: Tim Harvey <tharvey@gateworks.com> # imx8mm-venice-*

# 98463903 20-Oct-2022 Simon Glass <sjg@chromium.org>

Rename CONFIG_SYS_TEXT_BASE to CONFIG_TEXT_BASE

The current name is inconsistent with SPL which uses CONFIG_SPL_TEXT_BASE
and this makes it imposible to use CONFIG_VAL().

Rename it to resolve this problem.

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

# b86986c7 18-Oct-2022 Simon Glass <sjg@chromium.org>

video: Rename CONFIG_DM_VIDEO to CONFIG_VIDEO

Now that all the old code is gone, rename this option. Driver model
migration is now complete.

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

# f9b7bd7e 16-Oct-2022 Simon Glass <sjg@chromium.org>

video: cmd: Drop old LCD code

This relies on the old LCD implementation which is to be removed. Drop it.

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

# 9259bd17 10-Oct-2022 Michal Suchanek <msuchanek@suse.de>

common: board_f: Print information for all sysresets

Boards can have multiple sysresets, iterate all when printing sysreset
info.

Fixes: 23471aed5c ("board_f: Add reset status printing")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3c29c0fc 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: drop ifdefs around header includes

Drop the remaining ifdef around spl.h include.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# d63fc994 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: introduce arch_setup_dest_addr()

In order to move ppc-specific code out of setup_dest_addr(), provide an
arch-specific variant arch_setup_dest_addr(), that can be used by
architecture code to fix up the initial reloc address.

It is called at the end of setup_dest_addr() initcall and the default
implementation is a nop stub.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 85e68ae0 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: move CONFIG_MACH_TYPE logic to arch/arm/lib/bdinfo.c

asm/mach_type.h header and CONFIG_MACH_TYPE macro are arm-specific, so move
related bdinfo logic to arch_setup_bdinfo() in arch/arm/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 181cbd40 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: remove XTRN_DECLARE_GLOBAL_DATA_PTR dead code

The XTRN_DECLARE_GLOBAL_DATA_PTR declarations in ppc code are permanently
commented out, so there are no users for this macro:
#if 1
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r2")
#else /* We could use plain global data, but the resulting code is bigger */
#define XTRN_DECLARE_GLOBAL_DATA_PTR extern
#define DECLARE_GLOBAL_DATA_PTR XTRN_DECLARE_GLOBAL_DATA_PTR \
gd_t *gd
#endif

Remove all references to this macro, but add a documentation note regarding
the possibility of using plain global data for the GD pointer.

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

# 236f7396 18-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: show_dram_config: Print also real DRAM size

32-bit U-Boot builds cannot use more than around 2 GB of DDR memory. But on
some platforms/boards it is possible to connect also 4 GB SODIMM DDR memory.
U-Boot currently prints only effective size of RAM which can use, which may
be misleading as somebody would expect that this line prints total size of
connected DDR modules. So change show_dram_config code to prints both real
and effective DRAM size if they are different. If they are same then print
just one number like before. It is possible that effective size is just few
bytes smaller than the real size, so print both numbers only in case
function print_size() prints formats them differently.

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

# d92aee57 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix printing gd->ram_size and gd->ram_top

Members gd->ram_size and gd->ram_top are of type phys_addr_t which does not
have to fit into ulong type. So cast them into unsigned long long.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 049704f8 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix types for board_get_usable_ram_top()

Commit 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
changed type of ram_top member from ulong to phys_addr_t but did not
changed types in board_get_usable_ram_top() function which returns value
for ram_top.

So change ulong to phys_addr_t type also in board_get_usable_ram_top()
signature and implementations.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 29caf930 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]

# 70545642 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Integrate cyclic functionality at bootup in board_r/f

This patch adds a call to cyclic_init() to board_f/r.c, enabling the
common cyclic infrastructure. After this it's possible to add cyclic
functions via cyclic_register().

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

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

# 5d7f6014 20-Jun-2022 Tom Rini <trini@konsulko.com>

lcd: Remove legacy CONFIG_FB_ADDR code

No platforms set both CONFIG_LCD and CONFIG_FB_ADDR at this time, drop
this legacy code.

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

# d58c0074 24-Jun-2022 Michal Simek <michal.simek@amd.com>

microblaze: Add support for run time relocation

Microblaze is using NEEDS_MANUAL_RELOC from the beginnging. This is causing
issues with function pointer arrays which need to be updated manually after
relocation. Building code with -fPIC and linking with -pic will remove this
limitation and there is no longer need to run manual update.

By default still old option is enabled but by disabling NEEDS_MANUAL_RELOC
code will be compiled for full relocation.

The patch does couple of things which are connected to each other.
- Define STATIC_RELA dependency to call relocate-rela to fill sections.
- REMAKE_ELF was already enabled but u-boot file can't be used because
sections are empty. relocate-rela will fill them and output file is
u-boot.elf which should be used.
- Add support for full relocation (u-boot.elf)
- Add support for early relocation when u-boot.bin is loaded to different
address then CONFIG_SYS_TEXT_BASE
- Add rela.dyn and dynsym sections

Disabling NEEDS_MANUAL_RELOC U-Boot size increased by 10% of it's original
size (550kB to 608kB).

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/a845670b34925859b2e321875f7588a29f6655f9.1655299267.git.michal.simek@amd.com

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 24c904f3 06-Apr-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_MEM_TOP_HIDE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_MEM_TOP_HIDE

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

# 7fe32b34 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert arch_cpu_init_dm() to use events

Instead of a special function, send an event after driver model is inited
and adjust the boards which use this function.

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

# 42fdcebf 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert misc_init_f() to use events

This hook can be implmented using events, for the three boards that
actually use it.

Add the event type and event handlers. Drop CONFIG_MISC_INIT_F since we
can just use CONFIG_EVENT to control this. Since sandbox always enables
CONFIG_EVENT, we can drop the defconfig lines there too.

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

# 5a421904 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Set up the event system on start-up

Call event_init() before relocation to get the event system running.

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

# 7f3b79af 12-Jan-2022 Simon Glass <sjg@chromium.org>

bloblist: Rename the SPL tag

Add a U_BOOT prefix to this tag since it is specific to the U-Boot
project.

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

# d5b6e91b 03-Nov-2021 Simon Glass <sjg@chromium.org>

bloblist: Support allocating the bloblist

Typically the bloblist is positioned at a fixed address in memory until
relocation. This is convenient when it is set up in SPL or before
relocation.

But for EFI we want to set it up only when U-Boot proper is running. Add
a way to allocate it using malloc() and update the documentation to cover
this aspect of bloblist.

Note there are no tests of this feature at present, nor any direct testing
of bloblist_init().

This can be added, e.g. by making this option controllable at runtime.

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

# 47d7d036 13-Nov-2021 Marek Vasut <marex@denx.de>

board_f: Copy GD to new GD even if relocation disabled

Even if U-Boot has relocation disabled via GD_FLG_SKIP_RELOC , the
relocated stage of U-Boot still picks GD from new_gd location. The
U-Boot itself is not relocated, but GD might be, so copy the GD to
new GD location even if relocation is disabled.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Peng Fan <peng.fan@oss.nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# 55dabcc8 18-Aug-2021 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY

First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig. Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL. Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support. Convert all of the existing users to
one or more symbols.

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

# 69d9eda4 10-Jul-2021 Simon Glass <sjg@chromium.org>

i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

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

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

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

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

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

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <masahiroy@kernel.org>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@amd.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

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

common: Drop log.h from common header

Move this header out of the common header.

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

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

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

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

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

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

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

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

common: Drop net.h from common header

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

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

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

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

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

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

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

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

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

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

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

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

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

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

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

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

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

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

common: Move serial functions out of common.h

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

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

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

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

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

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

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

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

env: Move env_init() to env.h

Move env_init() over to the new header file.

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

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

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

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

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

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

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

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

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

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

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

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

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

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

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


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

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

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

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

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

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

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

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

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

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

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

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

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

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

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

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

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

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

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

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

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

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

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

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

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

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

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

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

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

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

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

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

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

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

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

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

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

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

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

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

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

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

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

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

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

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

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

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <masahiroy@kernel.org>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

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

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

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

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

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

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

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

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

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

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

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

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

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

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

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

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

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

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

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

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

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

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

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

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

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


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

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

# c956662c 10-Feb-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@amd.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <masahiroy@kernel.org>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

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

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

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

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@konsulko.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

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

# 746667f1 23-Nov-2014 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

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


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

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

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

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

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <masahiroy@kernel.org>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

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

# 5a1095a8 29-Aug-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

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

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

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

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <masahiroy@kernel.org>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

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

# 58dac327 05-Mar-2014 Masahiro Yamada <masahiroy@kernel.org>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

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


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <masahiroy@kernel.org>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

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

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <masahiroy@kernel.org>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

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

# 7f673c99 10-Jan-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

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


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

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

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

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

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

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


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

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

# a0ba279a 26-May-2013 Masahiro Yamada <masahiroy@kernel.org>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <masahiroy@kernel.org>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

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

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

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

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

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

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

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

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

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

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

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

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

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

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

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

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

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

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

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

# d768dd88 12-Aug-2023 Heinrich Schuchardt <xypron.glpk@gmx.de>

common: return type board_get_usable_ram_top

board_get_usable_ram_top() returns a physical address that is stored in
gd->ram_top. The return type of the function should be phys_addr_t like the
current type of gd->ram_top.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# b7080bfc 30-Jul-2023 Simon Glass <sjg@chromium.org>

video: Add a Kconfig option for SPL video handoff

At present this feature is enabled in SPL if a bloblist is available.
Some platforms may not want to use this, so add an option to allow the
feature to be disabled.

Note that the feature unfortunately only fills in part of the
video-handoff information, so causes failures on x86 platforms. For now,
disable it there.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> # qemu-x86_64

# 5bc610a7 18-Jul-2023 Nikhil M Jain <n-jain1@ti.com>

common: board_f: Pass frame buffer info from SPL to u-boot

U-boot proper can use frame buffer address passed from SPL to reserve
the memory area used by framebuffer set in SPL so that splash image
set in SPL continues to get displayed while u-boot proper is running.

Put the framebuffer address and size in a bloblist to make them
available at u-boot proper, if in u-boot proper CONFIG_VIDEO is defined.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Devarsh Thakkar <devarsht@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8f015d37 15-Jul-2023 Simon Glass <sjg@chromium.org>

x86: Improve the trampoline in 64-bit mode

At present this leaves the stack at the pre-relocation value. This is not
ideal since we want to have U-Boot running entirely from the top of
memory.

In addition, the new global_data pointer is not actually used, since
the global_data pointer itself is relocated, then the pre-relocation value
is changed, so the effective value (after relocation) does not update.

Adjust the implementation to follow the 32-bit code more closely, with a
trampoline function which is passed the new stack and global_data pointer.
This ensures that the correct values come through even when relocating.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 874bf6e0 20-Jun-2023 Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

board_f: Relocate fdt even if GD_FLG_SKIP_RELOC is set

In case of OF_SEPARATE (!OF_EMBED), the devicetree blob is placed
after _end, and fdt_find_separate() always returns _end. There is
a .bss section after _end and the section is cleared before relocation.

When GD_FLG_SKIP_RELOC is set, relocation is skipped, so the blob is
still in .bss section, but will be cleared. As a result, the devicetree
become invalid.

To avoid this issue, should relocate it regardless of GD_FLG_SKIP_RELOC
in reloc_fdt().

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 56c3aa9a 22-Mar-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>

arch: m68k: Introduce trivial PIT based timer

The QEMU emulation of m68k does not support DMA timer, the only
timer that is supported is the PIT timer. Implement trivial PIT
timer support for m68k.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

# 2c88d5e1 15-Jan-2023 Simon Glass <sjg@chromium.org>

sandbox: Bring back setting mon_len in global_data

This change was made for the benefit of RISC-V but broke other
architectures also. In particular, tracing cannot work without this value.
Add it back for architectures which support it.

Fixes: 3c9fc23c443 ("sandbox: don't refer to symbol _init")
Signed-off-by: Simon Glass <sjg@chromium.org>

# 7c5c137c 04-Dec-2022 Tom Rini <trini@konsulko.com>

global: Migrate CONFIG_PRAM to CFG

Perform a simple rename of CONFIG_PRAM to CFG_PRAM

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

# 65cc0e2a 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_* to CFG_SYS_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS namespace do
not easily transition to Kconfig. In many cases they likely should come
from the device tree instead. Move these out of CONFIG namespace and in
to CFG namespace.

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

# aa6e94de 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_SDRAM_* to CFG_SYS_SDRAM_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS_SDRAM
namespace do not easily transition to Kconfig. In many cases they likely
should come from the device tree instead. Move these out of CONFIG
namespace and in to CFG namespace.

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

# 02f5a014 28-Oct-2022 Tom Rini <trini@konsulko.com>

SYS_NONCACHED_MEMORY: Correct comment in common/board_f.c

The comment block in reserve_noncached has a typo in one filename and
an incorrect filename in another function reference. Correct both of
these.

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

# 50128aeb 28-Oct-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

cyclic: get rid of cyclic_init()

Currently, we must call cyclic_init() at some point before
cyclic_register() becomes possible. That turns out to be somewhat
awkward, especially with SPL, and has resulted in a watchdog callback
not being registered, thus causing the board to prematurely reset.

We already rely on gd->cyclic reliably being set to NULL by the asm
code that clears all of gd. Now that the cyclic list is a hlist, and
thus an empty list is represented by a NULL head pointer, and struct
cyclic_drv has no other members, we can just as well drop a level of
indirection and put the hlist_head directly in struct
global_data. This doesn't increase the size of struct global_data,
gets rid of an early malloc(), and generates slightly smaller code.

But primarily, this avoids having to call cyclic_init() early; the cyclic
infrastructure is simply ready to register callbacks as soon as we
enter C code.

We can still end up with schedule() being called from asm very early,
so we still need to check that gd itself has been properly initialized
[*], but once it has, gd->cyclic_list is perfectly fine to access, and
will just be an empty list.

As for cyclic_uninit(), it was never really the opposite of
cyclic_init() since it didn't free the struct cyclic_drv nor set
gd->cyclic to NULL. Rename it to cyclic_unregister_all() and use that
in test/, and also insert a call at the end of the board_init_f
sequence so that gd->cyclic_list is a fresh empty list before we enter
board_init_r().

A small piece of ugliness is that I had to add a cast in
cyclic_get_list() to silence a "discards 'volatile' qualifier"
warning, but that is completely equivalent to the existing handling of
the uclass_root_s list_head member.

[*] I'm not really sure where we guarantee that the register used for
gd contains 0 until it gets explicitly initialized, but that must be
the case, otherwise testing gd for being NULL would not make much sense.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Tested-by: Tim Harvey <tharvey@gateworks.com> # imx8mm-venice-*

# 98463903 20-Oct-2022 Simon Glass <sjg@chromium.org>

Rename CONFIG_SYS_TEXT_BASE to CONFIG_TEXT_BASE

The current name is inconsistent with SPL which uses CONFIG_SPL_TEXT_BASE
and this makes it imposible to use CONFIG_VAL().

Rename it to resolve this problem.

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

# b86986c7 18-Oct-2022 Simon Glass <sjg@chromium.org>

video: Rename CONFIG_DM_VIDEO to CONFIG_VIDEO

Now that all the old code is gone, rename this option. Driver model
migration is now complete.

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

# f9b7bd7e 16-Oct-2022 Simon Glass <sjg@chromium.org>

video: cmd: Drop old LCD code

This relies on the old LCD implementation which is to be removed. Drop it.

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

# 9259bd17 10-Oct-2022 Michal Suchanek <msuchanek@suse.de>

common: board_f: Print information for all sysresets

Boards can have multiple sysresets, iterate all when printing sysreset
info.

Fixes: 23471aed5c ("board_f: Add reset status printing")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3c29c0fc 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: drop ifdefs around header includes

Drop the remaining ifdef around spl.h include.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# d63fc994 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: introduce arch_setup_dest_addr()

In order to move ppc-specific code out of setup_dest_addr(), provide an
arch-specific variant arch_setup_dest_addr(), that can be used by
architecture code to fix up the initial reloc address.

It is called at the end of setup_dest_addr() initcall and the default
implementation is a nop stub.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 85e68ae0 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: move CONFIG_MACH_TYPE logic to arch/arm/lib/bdinfo.c

asm/mach_type.h header and CONFIG_MACH_TYPE macro are arm-specific, so move
related bdinfo logic to arch_setup_bdinfo() in arch/arm/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 181cbd40 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: remove XTRN_DECLARE_GLOBAL_DATA_PTR dead code

The XTRN_DECLARE_GLOBAL_DATA_PTR declarations in ppc code are permanently
commented out, so there are no users for this macro:
#if 1
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r2")
#else /* We could use plain global data, but the resulting code is bigger */
#define XTRN_DECLARE_GLOBAL_DATA_PTR extern
#define DECLARE_GLOBAL_DATA_PTR XTRN_DECLARE_GLOBAL_DATA_PTR \
gd_t *gd
#endif

Remove all references to this macro, but add a documentation note regarding
the possibility of using plain global data for the GD pointer.

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

# 236f7396 18-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: show_dram_config: Print also real DRAM size

32-bit U-Boot builds cannot use more than around 2 GB of DDR memory. But on
some platforms/boards it is possible to connect also 4 GB SODIMM DDR memory.
U-Boot currently prints only effective size of RAM which can use, which may
be misleading as somebody would expect that this line prints total size of
connected DDR modules. So change show_dram_config code to prints both real
and effective DRAM size if they are different. If they are same then print
just one number like before. It is possible that effective size is just few
bytes smaller than the real size, so print both numbers only in case
function print_size() prints formats them differently.

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

# d92aee57 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix printing gd->ram_size and gd->ram_top

Members gd->ram_size and gd->ram_top are of type phys_addr_t which does not
have to fit into ulong type. So cast them into unsigned long long.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 049704f8 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix types for board_get_usable_ram_top()

Commit 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
changed type of ram_top member from ulong to phys_addr_t but did not
changed types in board_get_usable_ram_top() function which returns value
for ram_top.

So change ulong to phys_addr_t type also in board_get_usable_ram_top()
signature and implementations.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 29caf930 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]

# 70545642 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Integrate cyclic functionality at bootup in board_r/f

This patch adds a call to cyclic_init() to board_f/r.c, enabling the
common cyclic infrastructure. After this it's possible to add cyclic
functions via cyclic_register().

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

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

# 5d7f6014 20-Jun-2022 Tom Rini <trini@konsulko.com>

lcd: Remove legacy CONFIG_FB_ADDR code

No platforms set both CONFIG_LCD and CONFIG_FB_ADDR at this time, drop
this legacy code.

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

# d58c0074 24-Jun-2022 Michal Simek <michal.simek@amd.com>

microblaze: Add support for run time relocation

Microblaze is using NEEDS_MANUAL_RELOC from the beginnging. This is causing
issues with function pointer arrays which need to be updated manually after
relocation. Building code with -fPIC and linking with -pic will remove this
limitation and there is no longer need to run manual update.

By default still old option is enabled but by disabling NEEDS_MANUAL_RELOC
code will be compiled for full relocation.

The patch does couple of things which are connected to each other.
- Define STATIC_RELA dependency to call relocate-rela to fill sections.
- REMAKE_ELF was already enabled but u-boot file can't be used because
sections are empty. relocate-rela will fill them and output file is
u-boot.elf which should be used.
- Add support for full relocation (u-boot.elf)
- Add support for early relocation when u-boot.bin is loaded to different
address then CONFIG_SYS_TEXT_BASE
- Add rela.dyn and dynsym sections

Disabling NEEDS_MANUAL_RELOC U-Boot size increased by 10% of it's original
size (550kB to 608kB).

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/a845670b34925859b2e321875f7588a29f6655f9.1655299267.git.michal.simek@amd.com

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 24c904f3 06-Apr-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_MEM_TOP_HIDE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_MEM_TOP_HIDE

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

# 7fe32b34 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert arch_cpu_init_dm() to use events

Instead of a special function, send an event after driver model is inited
and adjust the boards which use this function.

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

# 42fdcebf 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert misc_init_f() to use events

This hook can be implmented using events, for the three boards that
actually use it.

Add the event type and event handlers. Drop CONFIG_MISC_INIT_F since we
can just use CONFIG_EVENT to control this. Since sandbox always enables
CONFIG_EVENT, we can drop the defconfig lines there too.

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

# 5a421904 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Set up the event system on start-up

Call event_init() before relocation to get the event system running.

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

# 7f3b79af 12-Jan-2022 Simon Glass <sjg@chromium.org>

bloblist: Rename the SPL tag

Add a U_BOOT prefix to this tag since it is specific to the U-Boot
project.

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

# d5b6e91b 03-Nov-2021 Simon Glass <sjg@chromium.org>

bloblist: Support allocating the bloblist

Typically the bloblist is positioned at a fixed address in memory until
relocation. This is convenient when it is set up in SPL or before
relocation.

But for EFI we want to set it up only when U-Boot proper is running. Add
a way to allocate it using malloc() and update the documentation to cover
this aspect of bloblist.

Note there are no tests of this feature at present, nor any direct testing
of bloblist_init().

This can be added, e.g. by making this option controllable at runtime.

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

# 47d7d036 13-Nov-2021 Marek Vasut <marex@denx.de>

board_f: Copy GD to new GD even if relocation disabled

Even if U-Boot has relocation disabled via GD_FLG_SKIP_RELOC , the
relocated stage of U-Boot still picks GD from new_gd location. The
U-Boot itself is not relocated, but GD might be, so copy the GD to
new GD location even if relocation is disabled.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Peng Fan <peng.fan@oss.nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# 55dabcc8 18-Aug-2021 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY

First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig. Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL. Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support. Convert all of the existing users to
one or more symbols.

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

# 69d9eda4 10-Jul-2021 Simon Glass <sjg@chromium.org>

i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

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

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

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

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

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

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <masahiroy@kernel.org>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@amd.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

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

common: Drop log.h from common header

Move this header out of the common header.

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

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

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

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

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

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

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

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

common: Drop net.h from common header

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

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

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

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

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

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

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

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

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

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

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

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

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

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

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

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

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

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

common: Move serial functions out of common.h

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

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

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

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

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

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

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

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

env: Move env_init() to env.h

Move env_init() over to the new header file.

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

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

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

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

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

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

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

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

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

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

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

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

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

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

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


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

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

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

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

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

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

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

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

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

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

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

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

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

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

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

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

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

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

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

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

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

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

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

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

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

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

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

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

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

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

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

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

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

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

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

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

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

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

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

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

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

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

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

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

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

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

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

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <masahiroy@kernel.org>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

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

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

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

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

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

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

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

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

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

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

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

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

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

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

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

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

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

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

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

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

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

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

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

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

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


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

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

# c956662c 10-Feb-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@amd.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <masahiroy@kernel.org>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

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

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

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

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@konsulko.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

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

# 746667f1 23-Nov-2014 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

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


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

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

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

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

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <masahiroy@kernel.org>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

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

# 5a1095a8 29-Aug-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

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

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

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

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <masahiroy@kernel.org>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

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

# 58dac327 05-Mar-2014 Masahiro Yamada <masahiroy@kernel.org>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

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


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <masahiroy@kernel.org>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

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

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <masahiroy@kernel.org>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

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

# 7f673c99 10-Jan-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

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


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

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

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

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

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

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


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

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

# a0ba279a 26-May-2013 Masahiro Yamada <masahiroy@kernel.org>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <masahiroy@kernel.org>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

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

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

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

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

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

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

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

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

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

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

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

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

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

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

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

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

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

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

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

# b7080bfc 30-Jul-2023 Simon Glass <sjg@chromium.org>

video: Add a Kconfig option for SPL video handoff

At present this feature is enabled in SPL if a bloblist is available.
Some platforms may not want to use this, so add an option to allow the
feature to be disabled.

Note that the feature unfortunately only fills in part of the
video-handoff information, so causes failures on x86 platforms. For now,
disable it there.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> # qemu-x86_64

# 5bc610a7 18-Jul-2023 Nikhil M Jain <n-jain1@ti.com>

common: board_f: Pass frame buffer info from SPL to u-boot

U-boot proper can use frame buffer address passed from SPL to reserve
the memory area used by framebuffer set in SPL so that splash image
set in SPL continues to get displayed while u-boot proper is running.

Put the framebuffer address and size in a bloblist to make them
available at u-boot proper, if in u-boot proper CONFIG_VIDEO is defined.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Devarsh Thakkar <devarsht@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8f015d37 15-Jul-2023 Simon Glass <sjg@chromium.org>

x86: Improve the trampoline in 64-bit mode

At present this leaves the stack at the pre-relocation value. This is not
ideal since we want to have U-Boot running entirely from the top of
memory.

In addition, the new global_data pointer is not actually used, since
the global_data pointer itself is relocated, then the pre-relocation value
is changed, so the effective value (after relocation) does not update.

Adjust the implementation to follow the 32-bit code more closely, with a
trampoline function which is passed the new stack and global_data pointer.
This ensures that the correct values come through even when relocating.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 874bf6e0 20-Jun-2023 Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

board_f: Relocate fdt even if GD_FLG_SKIP_RELOC is set

In case of OF_SEPARATE (!OF_EMBED), the devicetree blob is placed
after _end, and fdt_find_separate() always returns _end. There is
a .bss section after _end and the section is cleared before relocation.

When GD_FLG_SKIP_RELOC is set, relocation is skipped, so the blob is
still in .bss section, but will be cleared. As a result, the devicetree
become invalid.

To avoid this issue, should relocate it regardless of GD_FLG_SKIP_RELOC
in reloc_fdt().

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 56c3aa9a 22-Mar-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>

arch: m68k: Introduce trivial PIT based timer

The QEMU emulation of m68k does not support DMA timer, the only
timer that is supported is the PIT timer. Implement trivial PIT
timer support for m68k.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

# 2c88d5e1 15-Jan-2023 Simon Glass <sjg@chromium.org>

sandbox: Bring back setting mon_len in global_data

This change was made for the benefit of RISC-V but broke other
architectures also. In particular, tracing cannot work without this value.
Add it back for architectures which support it.

Fixes: 3c9fc23c443 ("sandbox: don't refer to symbol _init")
Signed-off-by: Simon Glass <sjg@chromium.org>

# 7c5c137c 04-Dec-2022 Tom Rini <trini@konsulko.com>

global: Migrate CONFIG_PRAM to CFG

Perform a simple rename of CONFIG_PRAM to CFG_PRAM

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

# 65cc0e2a 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_* to CFG_SYS_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS namespace do
not easily transition to Kconfig. In many cases they likely should come
from the device tree instead. Move these out of CONFIG namespace and in
to CFG namespace.

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

# aa6e94de 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_SDRAM_* to CFG_SYS_SDRAM_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS_SDRAM
namespace do not easily transition to Kconfig. In many cases they likely
should come from the device tree instead. Move these out of CONFIG
namespace and in to CFG namespace.

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

# 02f5a014 28-Oct-2022 Tom Rini <trini@konsulko.com>

SYS_NONCACHED_MEMORY: Correct comment in common/board_f.c

The comment block in reserve_noncached has a typo in one filename and
an incorrect filename in another function reference. Correct both of
these.

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

# 50128aeb 28-Oct-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

cyclic: get rid of cyclic_init()

Currently, we must call cyclic_init() at some point before
cyclic_register() becomes possible. That turns out to be somewhat
awkward, especially with SPL, and has resulted in a watchdog callback
not being registered, thus causing the board to prematurely reset.

We already rely on gd->cyclic reliably being set to NULL by the asm
code that clears all of gd. Now that the cyclic list is a hlist, and
thus an empty list is represented by a NULL head pointer, and struct
cyclic_drv has no other members, we can just as well drop a level of
indirection and put the hlist_head directly in struct
global_data. This doesn't increase the size of struct global_data,
gets rid of an early malloc(), and generates slightly smaller code.

But primarily, this avoids having to call cyclic_init() early; the cyclic
infrastructure is simply ready to register callbacks as soon as we
enter C code.

We can still end up with schedule() being called from asm very early,
so we still need to check that gd itself has been properly initialized
[*], but once it has, gd->cyclic_list is perfectly fine to access, and
will just be an empty list.

As for cyclic_uninit(), it was never really the opposite of
cyclic_init() since it didn't free the struct cyclic_drv nor set
gd->cyclic to NULL. Rename it to cyclic_unregister_all() and use that
in test/, and also insert a call at the end of the board_init_f
sequence so that gd->cyclic_list is a fresh empty list before we enter
board_init_r().

A small piece of ugliness is that I had to add a cast in
cyclic_get_list() to silence a "discards 'volatile' qualifier"
warning, but that is completely equivalent to the existing handling of
the uclass_root_s list_head member.

[*] I'm not really sure where we guarantee that the register used for
gd contains 0 until it gets explicitly initialized, but that must be
the case, otherwise testing gd for being NULL would not make much sense.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Tested-by: Tim Harvey <tharvey@gateworks.com> # imx8mm-venice-*

# 98463903 20-Oct-2022 Simon Glass <sjg@chromium.org>

Rename CONFIG_SYS_TEXT_BASE to CONFIG_TEXT_BASE

The current name is inconsistent with SPL which uses CONFIG_SPL_TEXT_BASE
and this makes it imposible to use CONFIG_VAL().

Rename it to resolve this problem.

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

# b86986c7 18-Oct-2022 Simon Glass <sjg@chromium.org>

video: Rename CONFIG_DM_VIDEO to CONFIG_VIDEO

Now that all the old code is gone, rename this option. Driver model
migration is now complete.

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

# f9b7bd7e 16-Oct-2022 Simon Glass <sjg@chromium.org>

video: cmd: Drop old LCD code

This relies on the old LCD implementation which is to be removed. Drop it.

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

# 9259bd17 10-Oct-2022 Michal Suchanek <msuchanek@suse.de>

common: board_f: Print information for all sysresets

Boards can have multiple sysresets, iterate all when printing sysreset
info.

Fixes: 23471aed5c ("board_f: Add reset status printing")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3c29c0fc 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: drop ifdefs around header includes

Drop the remaining ifdef around spl.h include.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# d63fc994 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: introduce arch_setup_dest_addr()

In order to move ppc-specific code out of setup_dest_addr(), provide an
arch-specific variant arch_setup_dest_addr(), that can be used by
architecture code to fix up the initial reloc address.

It is called at the end of setup_dest_addr() initcall and the default
implementation is a nop stub.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 85e68ae0 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: move CONFIG_MACH_TYPE logic to arch/arm/lib/bdinfo.c

asm/mach_type.h header and CONFIG_MACH_TYPE macro are arm-specific, so move
related bdinfo logic to arch_setup_bdinfo() in arch/arm/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 181cbd40 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: remove XTRN_DECLARE_GLOBAL_DATA_PTR dead code

The XTRN_DECLARE_GLOBAL_DATA_PTR declarations in ppc code are permanently
commented out, so there are no users for this macro:
#if 1
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r2")
#else /* We could use plain global data, but the resulting code is bigger */
#define XTRN_DECLARE_GLOBAL_DATA_PTR extern
#define DECLARE_GLOBAL_DATA_PTR XTRN_DECLARE_GLOBAL_DATA_PTR \
gd_t *gd
#endif

Remove all references to this macro, but add a documentation note regarding
the possibility of using plain global data for the GD pointer.

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

# 236f7396 18-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: show_dram_config: Print also real DRAM size

32-bit U-Boot builds cannot use more than around 2 GB of DDR memory. But on
some platforms/boards it is possible to connect also 4 GB SODIMM DDR memory.
U-Boot currently prints only effective size of RAM which can use, which may
be misleading as somebody would expect that this line prints total size of
connected DDR modules. So change show_dram_config code to prints both real
and effective DRAM size if they are different. If they are same then print
just one number like before. It is possible that effective size is just few
bytes smaller than the real size, so print both numbers only in case
function print_size() prints formats them differently.

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

# d92aee57 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix printing gd->ram_size and gd->ram_top

Members gd->ram_size and gd->ram_top are of type phys_addr_t which does not
have to fit into ulong type. So cast them into unsigned long long.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 049704f8 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix types for board_get_usable_ram_top()

Commit 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
changed type of ram_top member from ulong to phys_addr_t but did not
changed types in board_get_usable_ram_top() function which returns value
for ram_top.

So change ulong to phys_addr_t type also in board_get_usable_ram_top()
signature and implementations.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 29caf930 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]

# 70545642 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Integrate cyclic functionality at bootup in board_r/f

This patch adds a call to cyclic_init() to board_f/r.c, enabling the
common cyclic infrastructure. After this it's possible to add cyclic
functions via cyclic_register().

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

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

# 5d7f6014 20-Jun-2022 Tom Rini <trini@konsulko.com>

lcd: Remove legacy CONFIG_FB_ADDR code

No platforms set both CONFIG_LCD and CONFIG_FB_ADDR at this time, drop
this legacy code.

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

# d58c0074 24-Jun-2022 Michal Simek <michal.simek@amd.com>

microblaze: Add support for run time relocation

Microblaze is using NEEDS_MANUAL_RELOC from the beginnging. This is causing
issues with function pointer arrays which need to be updated manually after
relocation. Building code with -fPIC and linking with -pic will remove this
limitation and there is no longer need to run manual update.

By default still old option is enabled but by disabling NEEDS_MANUAL_RELOC
code will be compiled for full relocation.

The patch does couple of things which are connected to each other.
- Define STATIC_RELA dependency to call relocate-rela to fill sections.
- REMAKE_ELF was already enabled but u-boot file can't be used because
sections are empty. relocate-rela will fill them and output file is
u-boot.elf which should be used.
- Add support for full relocation (u-boot.elf)
- Add support for early relocation when u-boot.bin is loaded to different
address then CONFIG_SYS_TEXT_BASE
- Add rela.dyn and dynsym sections

Disabling NEEDS_MANUAL_RELOC U-Boot size increased by 10% of it's original
size (550kB to 608kB).

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/a845670b34925859b2e321875f7588a29f6655f9.1655299267.git.michal.simek@amd.com

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 24c904f3 06-Apr-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_MEM_TOP_HIDE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_MEM_TOP_HIDE

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

# 7fe32b34 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert arch_cpu_init_dm() to use events

Instead of a special function, send an event after driver model is inited
and adjust the boards which use this function.

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

# 42fdcebf 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert misc_init_f() to use events

This hook can be implmented using events, for the three boards that
actually use it.

Add the event type and event handlers. Drop CONFIG_MISC_INIT_F since we
can just use CONFIG_EVENT to control this. Since sandbox always enables
CONFIG_EVENT, we can drop the defconfig lines there too.

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

# 5a421904 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Set up the event system on start-up

Call event_init() before relocation to get the event system running.

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

# 7f3b79af 12-Jan-2022 Simon Glass <sjg@chromium.org>

bloblist: Rename the SPL tag

Add a U_BOOT prefix to this tag since it is specific to the U-Boot
project.

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

# d5b6e91b 03-Nov-2021 Simon Glass <sjg@chromium.org>

bloblist: Support allocating the bloblist

Typically the bloblist is positioned at a fixed address in memory until
relocation. This is convenient when it is set up in SPL or before
relocation.

But for EFI we want to set it up only when U-Boot proper is running. Add
a way to allocate it using malloc() and update the documentation to cover
this aspect of bloblist.

Note there are no tests of this feature at present, nor any direct testing
of bloblist_init().

This can be added, e.g. by making this option controllable at runtime.

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

# 47d7d036 13-Nov-2021 Marek Vasut <marex@denx.de>

board_f: Copy GD to new GD even if relocation disabled

Even if U-Boot has relocation disabled via GD_FLG_SKIP_RELOC , the
relocated stage of U-Boot still picks GD from new_gd location. The
U-Boot itself is not relocated, but GD might be, so copy the GD to
new GD location even if relocation is disabled.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Peng Fan <peng.fan@oss.nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# 55dabcc8 18-Aug-2021 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY

First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig. Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL. Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support. Convert all of the existing users to
one or more symbols.

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

# 69d9eda4 10-Jul-2021 Simon Glass <sjg@chromium.org>

i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

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

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

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

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

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

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <masahiroy@kernel.org>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@amd.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

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

common: Drop log.h from common header

Move this header out of the common header.

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

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

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

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

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

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

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

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

common: Drop net.h from common header

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

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

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

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

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

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

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

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

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

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

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

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

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

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

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

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

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

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

common: Move serial functions out of common.h

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

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

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

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

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

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

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

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

env: Move env_init() to env.h

Move env_init() over to the new header file.

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

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

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

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

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

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

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

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

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

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

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

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

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

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

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


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

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

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

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

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <masahiroy@kernel.org>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@amd.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <masahiroy@kernel.org>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@konsulko.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <masahiroy@kernel.org>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <masahiroy@kernel.org>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <masahiroy@kernel.org>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <masahiroy@kernel.org>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <masahiroy@kernel.org>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <masahiroy@kernel.org>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <masahiroy@kernel.org>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 5bc610a7 18-Jul-2023 Nikhil M Jain <n-jain1@ti.com>

common: board_f: Pass frame buffer info from SPL to u-boot

U-boot proper can use frame buffer address passed from SPL to reserve
the memory area used by framebuffer set in SPL so that splash image
set in SPL continues to get displayed while u-boot proper is running.

Put the framebuffer address and size in a bloblist to make them
available at u-boot proper, if in u-boot proper CONFIG_VIDEO is defined.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
Reviewed-by: Devarsh Thakkar <devarsht@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8f015d37 15-Jul-2023 Simon Glass <sjg@chromium.org>

x86: Improve the trampoline in 64-bit mode

At present this leaves the stack at the pre-relocation value. This is not
ideal since we want to have U-Boot running entirely from the top of
memory.

In addition, the new global_data pointer is not actually used, since
the global_data pointer itself is relocated, then the pre-relocation value
is changed, so the effective value (after relocation) does not update.

Adjust the implementation to follow the 32-bit code more closely, with a
trampoline function which is passed the new stack and global_data pointer.
This ensures that the correct values come through even when relocating.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 874bf6e0 20-Jun-2023 Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

board_f: Relocate fdt even if GD_FLG_SKIP_RELOC is set

In case of OF_SEPARATE (!OF_EMBED), the devicetree blob is placed
after _end, and fdt_find_separate() always returns _end. There is
a .bss section after _end and the section is cleared before relocation.

When GD_FLG_SKIP_RELOC is set, relocation is skipped, so the blob is
still in .bss section, but will be cleared. As a result, the devicetree
become invalid.

To avoid this issue, should relocate it regardless of GD_FLG_SKIP_RELOC
in reloc_fdt().

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 56c3aa9a 22-Mar-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>

arch: m68k: Introduce trivial PIT based timer

The QEMU emulation of m68k does not support DMA timer, the only
timer that is supported is the PIT timer. Implement trivial PIT
timer support for m68k.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

# 2c88d5e1 15-Jan-2023 Simon Glass <sjg@chromium.org>

sandbox: Bring back setting mon_len in global_data

This change was made for the benefit of RISC-V but broke other
architectures also. In particular, tracing cannot work without this value.
Add it back for architectures which support it.

Fixes: 3c9fc23c443 ("sandbox: don't refer to symbol _init")
Signed-off-by: Simon Glass <sjg@chromium.org>

# 7c5c137c 04-Dec-2022 Tom Rini <trini@konsulko.com>

global: Migrate CONFIG_PRAM to CFG

Perform a simple rename of CONFIG_PRAM to CFG_PRAM

Signed-off-by: Tom Rini <trini@konsulko.com>

# 65cc0e2a 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_* to CFG_SYS_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS namespace do
not easily transition to Kconfig. In many cases they likely should come
from the device tree instead. Move these out of CONFIG namespace and in
to CFG namespace.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# aa6e94de 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_SDRAM_* to CFG_SYS_SDRAM_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS_SDRAM
namespace do not easily transition to Kconfig. In many cases they likely
should come from the device tree instead. Move these out of CONFIG
namespace and in to CFG namespace.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 02f5a014 28-Oct-2022 Tom Rini <trini@konsulko.com>

SYS_NONCACHED_MEMORY: Correct comment in common/board_f.c

The comment block in reserve_noncached has a typo in one filename and
an incorrect filename in another function reference. Correct both of
these.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 50128aeb 28-Oct-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

cyclic: get rid of cyclic_init()

Currently, we must call cyclic_init() at some point before
cyclic_register() becomes possible. That turns out to be somewhat
awkward, especially with SPL, and has resulted in a watchdog callback
not being registered, thus causing the board to prematurely reset.

We already rely on gd->cyclic reliably being set to NULL by the asm
code that clears all of gd. Now that the cyclic list is a hlist, and
thus an empty list is represented by a NULL head pointer, and struct
cyclic_drv has no other members, we can just as well drop a level of
indirection and put the hlist_head directly in struct
global_data. This doesn't increase the size of struct global_data,
gets rid of an early malloc(), and generates slightly smaller code.

But primarily, this avoids having to call cyclic_init() early; the cyclic
infrastructure is simply ready to register callbacks as soon as we
enter C code.

We can still end up with schedule() being called from asm very early,
so we still need to check that gd itself has been properly initialized
[*], but once it has, gd->cyclic_list is perfectly fine to access, and
will just be an empty list.

As for cyclic_uninit(), it was never really the opposite of
cyclic_init() since it didn't free the struct cyclic_drv nor set
gd->cyclic to NULL. Rename it to cyclic_unregister_all() and use that
in test/, and also insert a call at the end of the board_init_f
sequence so that gd->cyclic_list is a fresh empty list before we enter
board_init_r().

A small piece of ugliness is that I had to add a cast in
cyclic_get_list() to silence a "discards 'volatile' qualifier"
warning, but that is completely equivalent to the existing handling of
the uclass_root_s list_head member.

[*] I'm not really sure where we guarantee that the register used for
gd contains 0 until it gets explicitly initialized, but that must be
the case, otherwise testing gd for being NULL would not make much sense.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Tested-by: Tim Harvey <tharvey@gateworks.com> # imx8mm-venice-*

# 98463903 20-Oct-2022 Simon Glass <sjg@chromium.org>

Rename CONFIG_SYS_TEXT_BASE to CONFIG_TEXT_BASE

The current name is inconsistent with SPL which uses CONFIG_SPL_TEXT_BASE
and this makes it imposible to use CONFIG_VAL().

Rename it to resolve this problem.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b86986c7 18-Oct-2022 Simon Glass <sjg@chromium.org>

video: Rename CONFIG_DM_VIDEO to CONFIG_VIDEO

Now that all the old code is gone, rename this option. Driver model
migration is now complete.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f9b7bd7e 16-Oct-2022 Simon Glass <sjg@chromium.org>

video: cmd: Drop old LCD code

This relies on the old LCD implementation which is to be removed. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9259bd17 10-Oct-2022 Michal Suchanek <msuchanek@suse.de>

common: board_f: Print information for all sysresets

Boards can have multiple sysresets, iterate all when printing sysreset
info.

Fixes: 23471aed5c ("board_f: Add reset status printing")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3c29c0fc 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: drop ifdefs around header includes

Drop the remaining ifdef around spl.h include.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# d63fc994 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: introduce arch_setup_dest_addr()

In order to move ppc-specific code out of setup_dest_addr(), provide an
arch-specific variant arch_setup_dest_addr(), that can be used by
architecture code to fix up the initial reloc address.

It is called at the end of setup_dest_addr() initcall and the default
implementation is a nop stub.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 85e68ae0 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: move CONFIG_MACH_TYPE logic to arch/arm/lib/bdinfo.c

asm/mach_type.h header and CONFIG_MACH_TYPE macro are arm-specific, so move
related bdinfo logic to arch_setup_bdinfo() in arch/arm/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 181cbd40 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: remove XTRN_DECLARE_GLOBAL_DATA_PTR dead code

The XTRN_DECLARE_GLOBAL_DATA_PTR declarations in ppc code are permanently
commented out, so there are no users for this macro:
#if 1
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r2")
#else /* We could use plain global data, but the resulting code is bigger */
#define XTRN_DECLARE_GLOBAL_DATA_PTR extern
#define DECLARE_GLOBAL_DATA_PTR XTRN_DECLARE_GLOBAL_DATA_PTR \
gd_t *gd
#endif

Remove all references to this macro, but add a documentation note regarding
the possibility of using plain global data for the GD pointer.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 236f7396 18-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: show_dram_config: Print also real DRAM size

32-bit U-Boot builds cannot use more than around 2 GB of DDR memory. But on
some platforms/boards it is possible to connect also 4 GB SODIMM DDR memory.
U-Boot currently prints only effective size of RAM which can use, which may
be misleading as somebody would expect that this line prints total size of
connected DDR modules. So change show_dram_config code to prints both real
and effective DRAM size if they are different. If they are same then print
just one number like before. It is possible that effective size is just few
bytes smaller than the real size, so print both numbers only in case
function print_size() prints formats them differently.

Signed-off-by: Pali Rohár <pali@kernel.org>

# d92aee57 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix printing gd->ram_size and gd->ram_top

Members gd->ram_size and gd->ram_top are of type phys_addr_t which does not
have to fit into ulong type. So cast them into unsigned long long.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 049704f8 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix types for board_get_usable_ram_top()

Commit 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
changed type of ram_top member from ulong to phys_addr_t but did not
changed types in board_get_usable_ram_top() function which returns value
for ram_top.

So change ulong to phys_addr_t type also in board_get_usable_ram_top()
signature and implementations.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 29caf930 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]

# 70545642 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Integrate cyclic functionality at bootup in board_r/f

This patch adds a call to cyclic_init() to board_f/r.c, enabling the
common cyclic infrastructure. After this it's possible to add cyclic
functions via cyclic_register().

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5d7f6014 20-Jun-2022 Tom Rini <trini@konsulko.com>

lcd: Remove legacy CONFIG_FB_ADDR code

No platforms set both CONFIG_LCD and CONFIG_FB_ADDR at this time, drop
this legacy code.

Signed-off-by: Tom Rini <trini@konsulko.com>

# d58c0074 24-Jun-2022 Michal Simek <michal.simek@amd.com>

microblaze: Add support for run time relocation

Microblaze is using NEEDS_MANUAL_RELOC from the beginnging. This is causing
issues with function pointer arrays which need to be updated manually after
relocation. Building code with -fPIC and linking with -pic will remove this
limitation and there is no longer need to run manual update.

By default still old option is enabled but by disabling NEEDS_MANUAL_RELOC
code will be compiled for full relocation.

The patch does couple of things which are connected to each other.
- Define STATIC_RELA dependency to call relocate-rela to fill sections.
- REMAKE_ELF was already enabled but u-boot file can't be used because
sections are empty. relocate-rela will fill them and output file is
u-boot.elf which should be used.
- Add support for full relocation (u-boot.elf)
- Add support for early relocation when u-boot.bin is loaded to different
address then CONFIG_SYS_TEXT_BASE
- Add rela.dyn and dynsym sections

Disabling NEEDS_MANUAL_RELOC U-Boot size increased by 10% of it's original
size (550kB to 608kB).

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/a845670b34925859b2e321875f7588a29f6655f9.1655299267.git.michal.simek@amd.com

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 24c904f3 06-Apr-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_MEM_TOP_HIDE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_MEM_TOP_HIDE

Signed-off-by: Tom Rini <trini@konsulko.com>

# 7fe32b34 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert arch_cpu_init_dm() to use events

Instead of a special function, send an event after driver model is inited
and adjust the boards which use this function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 42fdcebf 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert misc_init_f() to use events

This hook can be implmented using events, for the three boards that
actually use it.

Add the event type and event handlers. Drop CONFIG_MISC_INIT_F since we
can just use CONFIG_EVENT to control this. Since sandbox always enables
CONFIG_EVENT, we can drop the defconfig lines there too.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a421904 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Set up the event system on start-up

Call event_init() before relocation to get the event system running.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7f3b79af 12-Jan-2022 Simon Glass <sjg@chromium.org>

bloblist: Rename the SPL tag

Add a U_BOOT prefix to this tag since it is specific to the U-Boot
project.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d5b6e91b 03-Nov-2021 Simon Glass <sjg@chromium.org>

bloblist: Support allocating the bloblist

Typically the bloblist is positioned at a fixed address in memory until
relocation. This is convenient when it is set up in SPL or before
relocation.

But for EFI we want to set it up only when U-Boot proper is running. Add
a way to allocate it using malloc() and update the documentation to cover
this aspect of bloblist.

Note there are no tests of this feature at present, nor any direct testing
of bloblist_init().

This can be added, e.g. by making this option controllable at runtime.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 47d7d036 13-Nov-2021 Marek Vasut <marex@denx.de>

board_f: Copy GD to new GD even if relocation disabled

Even if U-Boot has relocation disabled via GD_FLG_SKIP_RELOC , the
relocated stage of U-Boot still picks GD from new_gd location. The
U-Boot itself is not relocated, but GD might be, so copy the GD to
new GD location even if relocation is disabled.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Peng Fan <peng.fan@oss.nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# 55dabcc8 18-Aug-2021 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY

First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig. Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL. Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support. Convert all of the existing users to
one or more symbols.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 69d9eda4 10-Jul-2021 Simon Glass <sjg@chromium.org>

i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@amd.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@amd.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@konsulko.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 8f015d37 15-Jul-2023 Simon Glass <sjg@chromium.org>

x86: Improve the trampoline in 64-bit mode

At present this leaves the stack at the pre-relocation value. This is not
ideal since we want to have U-Boot running entirely from the top of
memory.

In addition, the new global_data pointer is not actually used, since
the global_data pointer itself is relocated, then the pre-relocation value
is changed, so the effective value (after relocation) does not update.

Adjust the implementation to follow the 32-bit code more closely, with a
trampoline function which is passed the new stack and global_data pointer.
This ensures that the correct values come through even when relocating.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 874bf6e0 20-Jun-2023 Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

board_f: Relocate fdt even if GD_FLG_SKIP_RELOC is set

In case of OF_SEPARATE (!OF_EMBED), the devicetree blob is placed
after _end, and fdt_find_separate() always returns _end. There is
a .bss section after _end and the section is cleared before relocation.

When GD_FLG_SKIP_RELOC is set, relocation is skipped, so the blob is
still in .bss section, but will be cleared. As a result, the devicetree
become invalid.

To avoid this issue, should relocate it regardless of GD_FLG_SKIP_RELOC
in reloc_fdt().

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 56c3aa9a 22-Mar-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>

arch: m68k: Introduce trivial PIT based timer

The QEMU emulation of m68k does not support DMA timer, the only
timer that is supported is the PIT timer. Implement trivial PIT
timer support for m68k.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

# 2c88d5e1 15-Jan-2023 Simon Glass <sjg@chromium.org>

sandbox: Bring back setting mon_len in global_data

This change was made for the benefit of RISC-V but broke other
architectures also. In particular, tracing cannot work without this value.
Add it back for architectures which support it.

Fixes: 3c9fc23c443 ("sandbox: don't refer to symbol _init")
Signed-off-by: Simon Glass <sjg@chromium.org>

# 7c5c137c 04-Dec-2022 Tom Rini <trini@konsulko.com>

global: Migrate CONFIG_PRAM to CFG

Perform a simple rename of CONFIG_PRAM to CFG_PRAM

Signed-off-by: Tom Rini <trini@konsulko.com>

# 65cc0e2a 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_* to CFG_SYS_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS namespace do
not easily transition to Kconfig. In many cases they likely should come
from the device tree instead. Move these out of CONFIG namespace and in
to CFG namespace.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# aa6e94de 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_SDRAM_* to CFG_SYS_SDRAM_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS_SDRAM
namespace do not easily transition to Kconfig. In many cases they likely
should come from the device tree instead. Move these out of CONFIG
namespace and in to CFG namespace.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 02f5a014 28-Oct-2022 Tom Rini <trini@konsulko.com>

SYS_NONCACHED_MEMORY: Correct comment in common/board_f.c

The comment block in reserve_noncached has a typo in one filename and
an incorrect filename in another function reference. Correct both of
these.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 50128aeb 28-Oct-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

cyclic: get rid of cyclic_init()

Currently, we must call cyclic_init() at some point before
cyclic_register() becomes possible. That turns out to be somewhat
awkward, especially with SPL, and has resulted in a watchdog callback
not being registered, thus causing the board to prematurely reset.

We already rely on gd->cyclic reliably being set to NULL by the asm
code that clears all of gd. Now that the cyclic list is a hlist, and
thus an empty list is represented by a NULL head pointer, and struct
cyclic_drv has no other members, we can just as well drop a level of
indirection and put the hlist_head directly in struct
global_data. This doesn't increase the size of struct global_data,
gets rid of an early malloc(), and generates slightly smaller code.

But primarily, this avoids having to call cyclic_init() early; the cyclic
infrastructure is simply ready to register callbacks as soon as we
enter C code.

We can still end up with schedule() being called from asm very early,
so we still need to check that gd itself has been properly initialized
[*], but once it has, gd->cyclic_list is perfectly fine to access, and
will just be an empty list.

As for cyclic_uninit(), it was never really the opposite of
cyclic_init() since it didn't free the struct cyclic_drv nor set
gd->cyclic to NULL. Rename it to cyclic_unregister_all() and use that
in test/, and also insert a call at the end of the board_init_f
sequence so that gd->cyclic_list is a fresh empty list before we enter
board_init_r().

A small piece of ugliness is that I had to add a cast in
cyclic_get_list() to silence a "discards 'volatile' qualifier"
warning, but that is completely equivalent to the existing handling of
the uclass_root_s list_head member.

[*] I'm not really sure where we guarantee that the register used for
gd contains 0 until it gets explicitly initialized, but that must be
the case, otherwise testing gd for being NULL would not make much sense.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Tested-by: Tim Harvey <tharvey@gateworks.com> # imx8mm-venice-*

# 98463903 20-Oct-2022 Simon Glass <sjg@chromium.org>

Rename CONFIG_SYS_TEXT_BASE to CONFIG_TEXT_BASE

The current name is inconsistent with SPL which uses CONFIG_SPL_TEXT_BASE
and this makes it imposible to use CONFIG_VAL().

Rename it to resolve this problem.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b86986c7 18-Oct-2022 Simon Glass <sjg@chromium.org>

video: Rename CONFIG_DM_VIDEO to CONFIG_VIDEO

Now that all the old code is gone, rename this option. Driver model
migration is now complete.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f9b7bd7e 16-Oct-2022 Simon Glass <sjg@chromium.org>

video: cmd: Drop old LCD code

This relies on the old LCD implementation which is to be removed. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9259bd17 10-Oct-2022 Michal Suchanek <msuchanek@suse.de>

common: board_f: Print information for all sysresets

Boards can have multiple sysresets, iterate all when printing sysreset
info.

Fixes: 23471aed5c ("board_f: Add reset status printing")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3c29c0fc 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: drop ifdefs around header includes

Drop the remaining ifdef around spl.h include.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# d63fc994 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: introduce arch_setup_dest_addr()

In order to move ppc-specific code out of setup_dest_addr(), provide an
arch-specific variant arch_setup_dest_addr(), that can be used by
architecture code to fix up the initial reloc address.

It is called at the end of setup_dest_addr() initcall and the default
implementation is a nop stub.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 85e68ae0 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: move CONFIG_MACH_TYPE logic to arch/arm/lib/bdinfo.c

asm/mach_type.h header and CONFIG_MACH_TYPE macro are arm-specific, so move
related bdinfo logic to arch_setup_bdinfo() in arch/arm/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 181cbd40 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: remove XTRN_DECLARE_GLOBAL_DATA_PTR dead code

The XTRN_DECLARE_GLOBAL_DATA_PTR declarations in ppc code are permanently
commented out, so there are no users for this macro:
#if 1
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r2")
#else /* We could use plain global data, but the resulting code is bigger */
#define XTRN_DECLARE_GLOBAL_DATA_PTR extern
#define DECLARE_GLOBAL_DATA_PTR XTRN_DECLARE_GLOBAL_DATA_PTR \
gd_t *gd
#endif

Remove all references to this macro, but add a documentation note regarding
the possibility of using plain global data for the GD pointer.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 236f7396 18-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: show_dram_config: Print also real DRAM size

32-bit U-Boot builds cannot use more than around 2 GB of DDR memory. But on
some platforms/boards it is possible to connect also 4 GB SODIMM DDR memory.
U-Boot currently prints only effective size of RAM which can use, which may
be misleading as somebody would expect that this line prints total size of
connected DDR modules. So change show_dram_config code to prints both real
and effective DRAM size if they are different. If they are same then print
just one number like before. It is possible that effective size is just few
bytes smaller than the real size, so print both numbers only in case
function print_size() prints formats them differently.

Signed-off-by: Pali Rohár <pali@kernel.org>

# d92aee57 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix printing gd->ram_size and gd->ram_top

Members gd->ram_size and gd->ram_top are of type phys_addr_t which does not
have to fit into ulong type. So cast them into unsigned long long.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 049704f8 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix types for board_get_usable_ram_top()

Commit 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
changed type of ram_top member from ulong to phys_addr_t but did not
changed types in board_get_usable_ram_top() function which returns value
for ram_top.

So change ulong to phys_addr_t type also in board_get_usable_ram_top()
signature and implementations.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 29caf930 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]

# 70545642 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Integrate cyclic functionality at bootup in board_r/f

This patch adds a call to cyclic_init() to board_f/r.c, enabling the
common cyclic infrastructure. After this it's possible to add cyclic
functions via cyclic_register().

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5d7f6014 20-Jun-2022 Tom Rini <trini@konsulko.com>

lcd: Remove legacy CONFIG_FB_ADDR code

No platforms set both CONFIG_LCD and CONFIG_FB_ADDR at this time, drop
this legacy code.

Signed-off-by: Tom Rini <trini@konsulko.com>

# d58c0074 24-Jun-2022 Michal Simek <michal.simek@amd.com>

microblaze: Add support for run time relocation

Microblaze is using NEEDS_MANUAL_RELOC from the beginnging. This is causing
issues with function pointer arrays which need to be updated manually after
relocation. Building code with -fPIC and linking with -pic will remove this
limitation and there is no longer need to run manual update.

By default still old option is enabled but by disabling NEEDS_MANUAL_RELOC
code will be compiled for full relocation.

The patch does couple of things which are connected to each other.
- Define STATIC_RELA dependency to call relocate-rela to fill sections.
- REMAKE_ELF was already enabled but u-boot file can't be used because
sections are empty. relocate-rela will fill them and output file is
u-boot.elf which should be used.
- Add support for full relocation (u-boot.elf)
- Add support for early relocation when u-boot.bin is loaded to different
address then CONFIG_SYS_TEXT_BASE
- Add rela.dyn and dynsym sections

Disabling NEEDS_MANUAL_RELOC U-Boot size increased by 10% of it's original
size (550kB to 608kB).

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/a845670b34925859b2e321875f7588a29f6655f9.1655299267.git.michal.simek@amd.com

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 24c904f3 06-Apr-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_MEM_TOP_HIDE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_MEM_TOP_HIDE

Signed-off-by: Tom Rini <trini@konsulko.com>

# 7fe32b34 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert arch_cpu_init_dm() to use events

Instead of a special function, send an event after driver model is inited
and adjust the boards which use this function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 42fdcebf 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert misc_init_f() to use events

This hook can be implmented using events, for the three boards that
actually use it.

Add the event type and event handlers. Drop CONFIG_MISC_INIT_F since we
can just use CONFIG_EVENT to control this. Since sandbox always enables
CONFIG_EVENT, we can drop the defconfig lines there too.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a421904 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Set up the event system on start-up

Call event_init() before relocation to get the event system running.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7f3b79af 12-Jan-2022 Simon Glass <sjg@chromium.org>

bloblist: Rename the SPL tag

Add a U_BOOT prefix to this tag since it is specific to the U-Boot
project.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d5b6e91b 03-Nov-2021 Simon Glass <sjg@chromium.org>

bloblist: Support allocating the bloblist

Typically the bloblist is positioned at a fixed address in memory until
relocation. This is convenient when it is set up in SPL or before
relocation.

But for EFI we want to set it up only when U-Boot proper is running. Add
a way to allocate it using malloc() and update the documentation to cover
this aspect of bloblist.

Note there are no tests of this feature at present, nor any direct testing
of bloblist_init().

This can be added, e.g. by making this option controllable at runtime.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 47d7d036 13-Nov-2021 Marek Vasut <marex@denx.de>

board_f: Copy GD to new GD even if relocation disabled

Even if U-Boot has relocation disabled via GD_FLG_SKIP_RELOC , the
relocated stage of U-Boot still picks GD from new_gd location. The
U-Boot itself is not relocated, but GD might be, so copy the GD to
new GD location even if relocation is disabled.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Peng Fan <peng.fan@oss.nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# 55dabcc8 18-Aug-2021 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY

First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig. Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL. Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support. Convert all of the existing users to
one or more symbols.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 69d9eda4 10-Jul-2021 Simon Glass <sjg@chromium.org>

i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@amd.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@amd.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@konsulko.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 874bf6e0 20-Jun-2023 Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

board_f: Relocate fdt even if GD_FLG_SKIP_RELOC is set

In case of OF_SEPARATE (!OF_EMBED), the devicetree blob is placed
after _end, and fdt_find_separate() always returns _end. There is
a .bss section after _end and the section is cleared before relocation.

When GD_FLG_SKIP_RELOC is set, relocation is skipped, so the blob is
still in .bss section, but will be cleared. As a result, the devicetree
become invalid.

To avoid this issue, should relocate it regardless of GD_FLG_SKIP_RELOC
in reloc_fdt().

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 56c3aa9a 22-Mar-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>

arch: m68k: Introduce trivial PIT based timer

The QEMU emulation of m68k does not support DMA timer, the only
timer that is supported is the PIT timer. Implement trivial PIT
timer support for m68k.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

# 2c88d5e1 15-Jan-2023 Simon Glass <sjg@chromium.org>

sandbox: Bring back setting mon_len in global_data

This change was made for the benefit of RISC-V but broke other
architectures also. In particular, tracing cannot work without this value.
Add it back for architectures which support it.

Fixes: 3c9fc23c443 ("sandbox: don't refer to symbol _init")
Signed-off-by: Simon Glass <sjg@chromium.org>

# 7c5c137c 04-Dec-2022 Tom Rini <trini@konsulko.com>

global: Migrate CONFIG_PRAM to CFG

Perform a simple rename of CONFIG_PRAM to CFG_PRAM

Signed-off-by: Tom Rini <trini@konsulko.com>

# 65cc0e2a 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_* to CFG_SYS_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS namespace do
not easily transition to Kconfig. In many cases they likely should come
from the device tree instead. Move these out of CONFIG namespace and in
to CFG namespace.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# aa6e94de 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_SDRAM_* to CFG_SYS_SDRAM_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS_SDRAM
namespace do not easily transition to Kconfig. In many cases they likely
should come from the device tree instead. Move these out of CONFIG
namespace and in to CFG namespace.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 02f5a014 28-Oct-2022 Tom Rini <trini@konsulko.com>

SYS_NONCACHED_MEMORY: Correct comment in common/board_f.c

The comment block in reserve_noncached has a typo in one filename and
an incorrect filename in another function reference. Correct both of
these.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 50128aeb 28-Oct-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

cyclic: get rid of cyclic_init()

Currently, we must call cyclic_init() at some point before
cyclic_register() becomes possible. That turns out to be somewhat
awkward, especially with SPL, and has resulted in a watchdog callback
not being registered, thus causing the board to prematurely reset.

We already rely on gd->cyclic reliably being set to NULL by the asm
code that clears all of gd. Now that the cyclic list is a hlist, and
thus an empty list is represented by a NULL head pointer, and struct
cyclic_drv has no other members, we can just as well drop a level of
indirection and put the hlist_head directly in struct
global_data. This doesn't increase the size of struct global_data,
gets rid of an early malloc(), and generates slightly smaller code.

But primarily, this avoids having to call cyclic_init() early; the cyclic
infrastructure is simply ready to register callbacks as soon as we
enter C code.

We can still end up with schedule() being called from asm very early,
so we still need to check that gd itself has been properly initialized
[*], but once it has, gd->cyclic_list is perfectly fine to access, and
will just be an empty list.

As for cyclic_uninit(), it was never really the opposite of
cyclic_init() since it didn't free the struct cyclic_drv nor set
gd->cyclic to NULL. Rename it to cyclic_unregister_all() and use that
in test/, and also insert a call at the end of the board_init_f
sequence so that gd->cyclic_list is a fresh empty list before we enter
board_init_r().

A small piece of ugliness is that I had to add a cast in
cyclic_get_list() to silence a "discards 'volatile' qualifier"
warning, but that is completely equivalent to the existing handling of
the uclass_root_s list_head member.

[*] I'm not really sure where we guarantee that the register used for
gd contains 0 until it gets explicitly initialized, but that must be
the case, otherwise testing gd for being NULL would not make much sense.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Tested-by: Tim Harvey <tharvey@gateworks.com> # imx8mm-venice-*

# 98463903 20-Oct-2022 Simon Glass <sjg@chromium.org>

Rename CONFIG_SYS_TEXT_BASE to CONFIG_TEXT_BASE

The current name is inconsistent with SPL which uses CONFIG_SPL_TEXT_BASE
and this makes it imposible to use CONFIG_VAL().

Rename it to resolve this problem.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b86986c7 18-Oct-2022 Simon Glass <sjg@chromium.org>

video: Rename CONFIG_DM_VIDEO to CONFIG_VIDEO

Now that all the old code is gone, rename this option. Driver model
migration is now complete.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f9b7bd7e 16-Oct-2022 Simon Glass <sjg@chromium.org>

video: cmd: Drop old LCD code

This relies on the old LCD implementation which is to be removed. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9259bd17 10-Oct-2022 Michal Suchanek <msuchanek@suse.de>

common: board_f: Print information for all sysresets

Boards can have multiple sysresets, iterate all when printing sysreset
info.

Fixes: 23471aed5c ("board_f: Add reset status printing")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3c29c0fc 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: drop ifdefs around header includes

Drop the remaining ifdef around spl.h include.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# d63fc994 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: introduce arch_setup_dest_addr()

In order to move ppc-specific code out of setup_dest_addr(), provide an
arch-specific variant arch_setup_dest_addr(), that can be used by
architecture code to fix up the initial reloc address.

It is called at the end of setup_dest_addr() initcall and the default
implementation is a nop stub.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 85e68ae0 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: move CONFIG_MACH_TYPE logic to arch/arm/lib/bdinfo.c

asm/mach_type.h header and CONFIG_MACH_TYPE macro are arm-specific, so move
related bdinfo logic to arch_setup_bdinfo() in arch/arm/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 181cbd40 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: remove XTRN_DECLARE_GLOBAL_DATA_PTR dead code

The XTRN_DECLARE_GLOBAL_DATA_PTR declarations in ppc code are permanently
commented out, so there are no users for this macro:
#if 1
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r2")
#else /* We could use plain global data, but the resulting code is bigger */
#define XTRN_DECLARE_GLOBAL_DATA_PTR extern
#define DECLARE_GLOBAL_DATA_PTR XTRN_DECLARE_GLOBAL_DATA_PTR \
gd_t *gd
#endif

Remove all references to this macro, but add a documentation note regarding
the possibility of using plain global data for the GD pointer.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 236f7396 18-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: show_dram_config: Print also real DRAM size

32-bit U-Boot builds cannot use more than around 2 GB of DDR memory. But on
some platforms/boards it is possible to connect also 4 GB SODIMM DDR memory.
U-Boot currently prints only effective size of RAM which can use, which may
be misleading as somebody would expect that this line prints total size of
connected DDR modules. So change show_dram_config code to prints both real
and effective DRAM size if they are different. If they are same then print
just one number like before. It is possible that effective size is just few
bytes smaller than the real size, so print both numbers only in case
function print_size() prints formats them differently.

Signed-off-by: Pali Rohár <pali@kernel.org>

# d92aee57 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix printing gd->ram_size and gd->ram_top

Members gd->ram_size and gd->ram_top are of type phys_addr_t which does not
have to fit into ulong type. So cast them into unsigned long long.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 049704f8 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix types for board_get_usable_ram_top()

Commit 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
changed type of ram_top member from ulong to phys_addr_t but did not
changed types in board_get_usable_ram_top() function which returns value
for ram_top.

So change ulong to phys_addr_t type also in board_get_usable_ram_top()
signature and implementations.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 29caf930 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]

# 70545642 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Integrate cyclic functionality at bootup in board_r/f

This patch adds a call to cyclic_init() to board_f/r.c, enabling the
common cyclic infrastructure. After this it's possible to add cyclic
functions via cyclic_register().

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5d7f6014 20-Jun-2022 Tom Rini <trini@konsulko.com>

lcd: Remove legacy CONFIG_FB_ADDR code

No platforms set both CONFIG_LCD and CONFIG_FB_ADDR at this time, drop
this legacy code.

Signed-off-by: Tom Rini <trini@konsulko.com>

# d58c0074 24-Jun-2022 Michal Simek <michal.simek@amd.com>

microblaze: Add support for run time relocation

Microblaze is using NEEDS_MANUAL_RELOC from the beginnging. This is causing
issues with function pointer arrays which need to be updated manually after
relocation. Building code with -fPIC and linking with -pic will remove this
limitation and there is no longer need to run manual update.

By default still old option is enabled but by disabling NEEDS_MANUAL_RELOC
code will be compiled for full relocation.

The patch does couple of things which are connected to each other.
- Define STATIC_RELA dependency to call relocate-rela to fill sections.
- REMAKE_ELF was already enabled but u-boot file can't be used because
sections are empty. relocate-rela will fill them and output file is
u-boot.elf which should be used.
- Add support for full relocation (u-boot.elf)
- Add support for early relocation when u-boot.bin is loaded to different
address then CONFIG_SYS_TEXT_BASE
- Add rela.dyn and dynsym sections

Disabling NEEDS_MANUAL_RELOC U-Boot size increased by 10% of it's original
size (550kB to 608kB).

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/a845670b34925859b2e321875f7588a29f6655f9.1655299267.git.michal.simek@amd.com

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 24c904f3 06-Apr-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_MEM_TOP_HIDE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_MEM_TOP_HIDE

Signed-off-by: Tom Rini <trini@konsulko.com>

# 7fe32b34 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert arch_cpu_init_dm() to use events

Instead of a special function, send an event after driver model is inited
and adjust the boards which use this function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 42fdcebf 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert misc_init_f() to use events

This hook can be implmented using events, for the three boards that
actually use it.

Add the event type and event handlers. Drop CONFIG_MISC_INIT_F since we
can just use CONFIG_EVENT to control this. Since sandbox always enables
CONFIG_EVENT, we can drop the defconfig lines there too.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a421904 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Set up the event system on start-up

Call event_init() before relocation to get the event system running.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7f3b79af 12-Jan-2022 Simon Glass <sjg@chromium.org>

bloblist: Rename the SPL tag

Add a U_BOOT prefix to this tag since it is specific to the U-Boot
project.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d5b6e91b 03-Nov-2021 Simon Glass <sjg@chromium.org>

bloblist: Support allocating the bloblist

Typically the bloblist is positioned at a fixed address in memory until
relocation. This is convenient when it is set up in SPL or before
relocation.

But for EFI we want to set it up only when U-Boot proper is running. Add
a way to allocate it using malloc() and update the documentation to cover
this aspect of bloblist.

Note there are no tests of this feature at present, nor any direct testing
of bloblist_init().

This can be added, e.g. by making this option controllable at runtime.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 47d7d036 13-Nov-2021 Marek Vasut <marex@denx.de>

board_f: Copy GD to new GD even if relocation disabled

Even if U-Boot has relocation disabled via GD_FLG_SKIP_RELOC , the
relocated stage of U-Boot still picks GD from new_gd location. The
U-Boot itself is not relocated, but GD might be, so copy the GD to
new GD location even if relocation is disabled.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Peng Fan <peng.fan@oss.nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# 55dabcc8 18-Aug-2021 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY

First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig. Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL. Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support. Convert all of the existing users to
one or more symbols.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 69d9eda4 10-Jul-2021 Simon Glass <sjg@chromium.org>

i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@amd.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@amd.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@konsulko.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 56c3aa9a 22-Mar-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>

arch: m68k: Introduce trivial PIT based timer

The QEMU emulation of m68k does not support DMA timer, the only
timer that is supported is the PIT timer. Implement trivial PIT
timer support for m68k.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

# 2c88d5e1 15-Jan-2023 Simon Glass <sjg@chromium.org>

sandbox: Bring back setting mon_len in global_data

This change was made for the benefit of RISC-V but broke other
architectures also. In particular, tracing cannot work without this value.
Add it back for architectures which support it.

Fixes: 3c9fc23c443 ("sandbox: don't refer to symbol _init")
Signed-off-by: Simon Glass <sjg@chromium.org>

# 7c5c137c 04-Dec-2022 Tom Rini <trini@konsulko.com>

global: Migrate CONFIG_PRAM to CFG

Perform a simple rename of CONFIG_PRAM to CFG_PRAM

Signed-off-by: Tom Rini <trini@konsulko.com>

# 65cc0e2a 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_* to CFG_SYS_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS namespace do
not easily transition to Kconfig. In many cases they likely should come
from the device tree instead. Move these out of CONFIG namespace and in
to CFG namespace.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# aa6e94de 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_SDRAM_* to CFG_SYS_SDRAM_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS_SDRAM
namespace do not easily transition to Kconfig. In many cases they likely
should come from the device tree instead. Move these out of CONFIG
namespace and in to CFG namespace.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 02f5a014 28-Oct-2022 Tom Rini <trini@konsulko.com>

SYS_NONCACHED_MEMORY: Correct comment in common/board_f.c

The comment block in reserve_noncached has a typo in one filename and
an incorrect filename in another function reference. Correct both of
these.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 50128aeb 28-Oct-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

cyclic: get rid of cyclic_init()

Currently, we must call cyclic_init() at some point before
cyclic_register() becomes possible. That turns out to be somewhat
awkward, especially with SPL, and has resulted in a watchdog callback
not being registered, thus causing the board to prematurely reset.

We already rely on gd->cyclic reliably being set to NULL by the asm
code that clears all of gd. Now that the cyclic list is a hlist, and
thus an empty list is represented by a NULL head pointer, and struct
cyclic_drv has no other members, we can just as well drop a level of
indirection and put the hlist_head directly in struct
global_data. This doesn't increase the size of struct global_data,
gets rid of an early malloc(), and generates slightly smaller code.

But primarily, this avoids having to call cyclic_init() early; the cyclic
infrastructure is simply ready to register callbacks as soon as we
enter C code.

We can still end up with schedule() being called from asm very early,
so we still need to check that gd itself has been properly initialized
[*], but once it has, gd->cyclic_list is perfectly fine to access, and
will just be an empty list.

As for cyclic_uninit(), it was never really the opposite of
cyclic_init() since it didn't free the struct cyclic_drv nor set
gd->cyclic to NULL. Rename it to cyclic_unregister_all() and use that
in test/, and also insert a call at the end of the board_init_f
sequence so that gd->cyclic_list is a fresh empty list before we enter
board_init_r().

A small piece of ugliness is that I had to add a cast in
cyclic_get_list() to silence a "discards 'volatile' qualifier"
warning, but that is completely equivalent to the existing handling of
the uclass_root_s list_head member.

[*] I'm not really sure where we guarantee that the register used for
gd contains 0 until it gets explicitly initialized, but that must be
the case, otherwise testing gd for being NULL would not make much sense.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Tested-by: Tim Harvey <tharvey@gateworks.com> # imx8mm-venice-*

# 98463903 20-Oct-2022 Simon Glass <sjg@chromium.org>

Rename CONFIG_SYS_TEXT_BASE to CONFIG_TEXT_BASE

The current name is inconsistent with SPL which uses CONFIG_SPL_TEXT_BASE
and this makes it imposible to use CONFIG_VAL().

Rename it to resolve this problem.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b86986c7 18-Oct-2022 Simon Glass <sjg@chromium.org>

video: Rename CONFIG_DM_VIDEO to CONFIG_VIDEO

Now that all the old code is gone, rename this option. Driver model
migration is now complete.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f9b7bd7e 16-Oct-2022 Simon Glass <sjg@chromium.org>

video: cmd: Drop old LCD code

This relies on the old LCD implementation which is to be removed. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9259bd17 10-Oct-2022 Michal Suchanek <msuchanek@suse.de>

common: board_f: Print information for all sysresets

Boards can have multiple sysresets, iterate all when printing sysreset
info.

Fixes: 23471aed5c ("board_f: Add reset status printing")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3c29c0fc 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: drop ifdefs around header includes

Drop the remaining ifdef around spl.h include.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# d63fc994 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: introduce arch_setup_dest_addr()

In order to move ppc-specific code out of setup_dest_addr(), provide an
arch-specific variant arch_setup_dest_addr(), that can be used by
architecture code to fix up the initial reloc address.

It is called at the end of setup_dest_addr() initcall and the default
implementation is a nop stub.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 85e68ae0 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: move CONFIG_MACH_TYPE logic to arch/arm/lib/bdinfo.c

asm/mach_type.h header and CONFIG_MACH_TYPE macro are arm-specific, so move
related bdinfo logic to arch_setup_bdinfo() in arch/arm/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 181cbd40 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: remove XTRN_DECLARE_GLOBAL_DATA_PTR dead code

The XTRN_DECLARE_GLOBAL_DATA_PTR declarations in ppc code are permanently
commented out, so there are no users for this macro:
#if 1
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r2")
#else /* We could use plain global data, but the resulting code is bigger */
#define XTRN_DECLARE_GLOBAL_DATA_PTR extern
#define DECLARE_GLOBAL_DATA_PTR XTRN_DECLARE_GLOBAL_DATA_PTR \
gd_t *gd
#endif

Remove all references to this macro, but add a documentation note regarding
the possibility of using plain global data for the GD pointer.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 236f7396 18-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: show_dram_config: Print also real DRAM size

32-bit U-Boot builds cannot use more than around 2 GB of DDR memory. But on
some platforms/boards it is possible to connect also 4 GB SODIMM DDR memory.
U-Boot currently prints only effective size of RAM which can use, which may
be misleading as somebody would expect that this line prints total size of
connected DDR modules. So change show_dram_config code to prints both real
and effective DRAM size if they are different. If they are same then print
just one number like before. It is possible that effective size is just few
bytes smaller than the real size, so print both numbers only in case
function print_size() prints formats them differently.

Signed-off-by: Pali Rohár <pali@kernel.org>

# d92aee57 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix printing gd->ram_size and gd->ram_top

Members gd->ram_size and gd->ram_top are of type phys_addr_t which does not
have to fit into ulong type. So cast them into unsigned long long.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 049704f8 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix types for board_get_usable_ram_top()

Commit 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
changed type of ram_top member from ulong to phys_addr_t but did not
changed types in board_get_usable_ram_top() function which returns value
for ram_top.

So change ulong to phys_addr_t type also in board_get_usable_ram_top()
signature and implementations.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 29caf930 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]

# 70545642 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Integrate cyclic functionality at bootup in board_r/f

This patch adds a call to cyclic_init() to board_f/r.c, enabling the
common cyclic infrastructure. After this it's possible to add cyclic
functions via cyclic_register().

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5d7f6014 20-Jun-2022 Tom Rini <trini@konsulko.com>

lcd: Remove legacy CONFIG_FB_ADDR code

No platforms set both CONFIG_LCD and CONFIG_FB_ADDR at this time, drop
this legacy code.

Signed-off-by: Tom Rini <trini@konsulko.com>

# d58c0074 24-Jun-2022 Michal Simek <michal.simek@amd.com>

microblaze: Add support for run time relocation

Microblaze is using NEEDS_MANUAL_RELOC from the beginnging. This is causing
issues with function pointer arrays which need to be updated manually after
relocation. Building code with -fPIC and linking with -pic will remove this
limitation and there is no longer need to run manual update.

By default still old option is enabled but by disabling NEEDS_MANUAL_RELOC
code will be compiled for full relocation.

The patch does couple of things which are connected to each other.
- Define STATIC_RELA dependency to call relocate-rela to fill sections.
- REMAKE_ELF was already enabled but u-boot file can't be used because
sections are empty. relocate-rela will fill them and output file is
u-boot.elf which should be used.
- Add support for full relocation (u-boot.elf)
- Add support for early relocation when u-boot.bin is loaded to different
address then CONFIG_SYS_TEXT_BASE
- Add rela.dyn and dynsym sections

Disabling NEEDS_MANUAL_RELOC U-Boot size increased by 10% of it's original
size (550kB to 608kB).

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/a845670b34925859b2e321875f7588a29f6655f9.1655299267.git.michal.simek@amd.com

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 24c904f3 06-Apr-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_MEM_TOP_HIDE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_MEM_TOP_HIDE

Signed-off-by: Tom Rini <trini@konsulko.com>

# 7fe32b34 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert arch_cpu_init_dm() to use events

Instead of a special function, send an event after driver model is inited
and adjust the boards which use this function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 42fdcebf 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert misc_init_f() to use events

This hook can be implmented using events, for the three boards that
actually use it.

Add the event type and event handlers. Drop CONFIG_MISC_INIT_F since we
can just use CONFIG_EVENT to control this. Since sandbox always enables
CONFIG_EVENT, we can drop the defconfig lines there too.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a421904 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Set up the event system on start-up

Call event_init() before relocation to get the event system running.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7f3b79af 12-Jan-2022 Simon Glass <sjg@chromium.org>

bloblist: Rename the SPL tag

Add a U_BOOT prefix to this tag since it is specific to the U-Boot
project.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d5b6e91b 03-Nov-2021 Simon Glass <sjg@chromium.org>

bloblist: Support allocating the bloblist

Typically the bloblist is positioned at a fixed address in memory until
relocation. This is convenient when it is set up in SPL or before
relocation.

But for EFI we want to set it up only when U-Boot proper is running. Add
a way to allocate it using malloc() and update the documentation to cover
this aspect of bloblist.

Note there are no tests of this feature at present, nor any direct testing
of bloblist_init().

This can be added, e.g. by making this option controllable at runtime.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 47d7d036 13-Nov-2021 Marek Vasut <marex@denx.de>

board_f: Copy GD to new GD even if relocation disabled

Even if U-Boot has relocation disabled via GD_FLG_SKIP_RELOC , the
relocated stage of U-Boot still picks GD from new_gd location. The
U-Boot itself is not relocated, but GD might be, so copy the GD to
new GD location even if relocation is disabled.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Peng Fan <peng.fan@oss.nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# 55dabcc8 18-Aug-2021 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY

First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig. Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL. Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support. Convert all of the existing users to
one or more symbols.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 69d9eda4 10-Jul-2021 Simon Glass <sjg@chromium.org>

i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@amd.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@konsulko.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 2c88d5e1 15-Jan-2023 Simon Glass <sjg@chromium.org>

sandbox: Bring back setting mon_len in global_data

This change was made for the benefit of RISC-V but broke other
architectures also. In particular, tracing cannot work without this value.
Add it back for architectures which support it.

Fixes: 3c9fc23c443 ("sandbox: don't refer to symbol _init")
Signed-off-by: Simon Glass <sjg@chromium.org>

# 7c5c137c 04-Dec-2022 Tom Rini <trini@konsulko.com>

global: Migrate CONFIG_PRAM to CFG

Perform a simple rename of CONFIG_PRAM to CFG_PRAM

Signed-off-by: Tom Rini <trini@konsulko.com>

# 65cc0e2a 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_* to CFG_SYS_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS namespace do
not easily transition to Kconfig. In many cases they likely should come
from the device tree instead. Move these out of CONFIG namespace and in
to CFG namespace.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# aa6e94de 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_SDRAM_* to CFG_SYS_SDRAM_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS_SDRAM
namespace do not easily transition to Kconfig. In many cases they likely
should come from the device tree instead. Move these out of CONFIG
namespace and in to CFG namespace.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 02f5a014 28-Oct-2022 Tom Rini <trini@konsulko.com>

SYS_NONCACHED_MEMORY: Correct comment in common/board_f.c

The comment block in reserve_noncached has a typo in one filename and
an incorrect filename in another function reference. Correct both of
these.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 50128aeb 28-Oct-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

cyclic: get rid of cyclic_init()

Currently, we must call cyclic_init() at some point before
cyclic_register() becomes possible. That turns out to be somewhat
awkward, especially with SPL, and has resulted in a watchdog callback
not being registered, thus causing the board to prematurely reset.

We already rely on gd->cyclic reliably being set to NULL by the asm
code that clears all of gd. Now that the cyclic list is a hlist, and
thus an empty list is represented by a NULL head pointer, and struct
cyclic_drv has no other members, we can just as well drop a level of
indirection and put the hlist_head directly in struct
global_data. This doesn't increase the size of struct global_data,
gets rid of an early malloc(), and generates slightly smaller code.

But primarily, this avoids having to call cyclic_init() early; the cyclic
infrastructure is simply ready to register callbacks as soon as we
enter C code.

We can still end up with schedule() being called from asm very early,
so we still need to check that gd itself has been properly initialized
[*], but once it has, gd->cyclic_list is perfectly fine to access, and
will just be an empty list.

As for cyclic_uninit(), it was never really the opposite of
cyclic_init() since it didn't free the struct cyclic_drv nor set
gd->cyclic to NULL. Rename it to cyclic_unregister_all() and use that
in test/, and also insert a call at the end of the board_init_f
sequence so that gd->cyclic_list is a fresh empty list before we enter
board_init_r().

A small piece of ugliness is that I had to add a cast in
cyclic_get_list() to silence a "discards 'volatile' qualifier"
warning, but that is completely equivalent to the existing handling of
the uclass_root_s list_head member.

[*] I'm not really sure where we guarantee that the register used for
gd contains 0 until it gets explicitly initialized, but that must be
the case, otherwise testing gd for being NULL would not make much sense.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Tested-by: Tim Harvey <tharvey@gateworks.com> # imx8mm-venice-*

# 98463903 20-Oct-2022 Simon Glass <sjg@chromium.org>

Rename CONFIG_SYS_TEXT_BASE to CONFIG_TEXT_BASE

The current name is inconsistent with SPL which uses CONFIG_SPL_TEXT_BASE
and this makes it imposible to use CONFIG_VAL().

Rename it to resolve this problem.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b86986c7 18-Oct-2022 Simon Glass <sjg@chromium.org>

video: Rename CONFIG_DM_VIDEO to CONFIG_VIDEO

Now that all the old code is gone, rename this option. Driver model
migration is now complete.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f9b7bd7e 16-Oct-2022 Simon Glass <sjg@chromium.org>

video: cmd: Drop old LCD code

This relies on the old LCD implementation which is to be removed. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9259bd17 10-Oct-2022 Michal Suchanek <msuchanek@suse.de>

common: board_f: Print information for all sysresets

Boards can have multiple sysresets, iterate all when printing sysreset
info.

Fixes: 23471aed5c ("board_f: Add reset status printing")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3c29c0fc 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: drop ifdefs around header includes

Drop the remaining ifdef around spl.h include.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# d63fc994 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: introduce arch_setup_dest_addr()

In order to move ppc-specific code out of setup_dest_addr(), provide an
arch-specific variant arch_setup_dest_addr(), that can be used by
architecture code to fix up the initial reloc address.

It is called at the end of setup_dest_addr() initcall and the default
implementation is a nop stub.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 85e68ae0 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: move CONFIG_MACH_TYPE logic to arch/arm/lib/bdinfo.c

asm/mach_type.h header and CONFIG_MACH_TYPE macro are arm-specific, so move
related bdinfo logic to arch_setup_bdinfo() in arch/arm/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 181cbd40 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: remove XTRN_DECLARE_GLOBAL_DATA_PTR dead code

The XTRN_DECLARE_GLOBAL_DATA_PTR declarations in ppc code are permanently
commented out, so there are no users for this macro:
#if 1
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r2")
#else /* We could use plain global data, but the resulting code is bigger */
#define XTRN_DECLARE_GLOBAL_DATA_PTR extern
#define DECLARE_GLOBAL_DATA_PTR XTRN_DECLARE_GLOBAL_DATA_PTR \
gd_t *gd
#endif

Remove all references to this macro, but add a documentation note regarding
the possibility of using plain global data for the GD pointer.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 236f7396 18-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: show_dram_config: Print also real DRAM size

32-bit U-Boot builds cannot use more than around 2 GB of DDR memory. But on
some platforms/boards it is possible to connect also 4 GB SODIMM DDR memory.
U-Boot currently prints only effective size of RAM which can use, which may
be misleading as somebody would expect that this line prints total size of
connected DDR modules. So change show_dram_config code to prints both real
and effective DRAM size if they are different. If they are same then print
just one number like before. It is possible that effective size is just few
bytes smaller than the real size, so print both numbers only in case
function print_size() prints formats them differently.

Signed-off-by: Pali Rohár <pali@kernel.org>

# d92aee57 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix printing gd->ram_size and gd->ram_top

Members gd->ram_size and gd->ram_top are of type phys_addr_t which does not
have to fit into ulong type. So cast them into unsigned long long.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 049704f8 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix types for board_get_usable_ram_top()

Commit 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
changed type of ram_top member from ulong to phys_addr_t but did not
changed types in board_get_usable_ram_top() function which returns value
for ram_top.

So change ulong to phys_addr_t type also in board_get_usable_ram_top()
signature and implementations.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 29caf930 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]

# 70545642 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Integrate cyclic functionality at bootup in board_r/f

This patch adds a call to cyclic_init() to board_f/r.c, enabling the
common cyclic infrastructure. After this it's possible to add cyclic
functions via cyclic_register().

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5d7f6014 20-Jun-2022 Tom Rini <trini@konsulko.com>

lcd: Remove legacy CONFIG_FB_ADDR code

No platforms set both CONFIG_LCD and CONFIG_FB_ADDR at this time, drop
this legacy code.

Signed-off-by: Tom Rini <trini@konsulko.com>

# d58c0074 24-Jun-2022 Michal Simek <michal.simek@amd.com>

microblaze: Add support for run time relocation

Microblaze is using NEEDS_MANUAL_RELOC from the beginnging. This is causing
issues with function pointer arrays which need to be updated manually after
relocation. Building code with -fPIC and linking with -pic will remove this
limitation and there is no longer need to run manual update.

By default still old option is enabled but by disabling NEEDS_MANUAL_RELOC
code will be compiled for full relocation.

The patch does couple of things which are connected to each other.
- Define STATIC_RELA dependency to call relocate-rela to fill sections.
- REMAKE_ELF was already enabled but u-boot file can't be used because
sections are empty. relocate-rela will fill them and output file is
u-boot.elf which should be used.
- Add support for full relocation (u-boot.elf)
- Add support for early relocation when u-boot.bin is loaded to different
address then CONFIG_SYS_TEXT_BASE
- Add rela.dyn and dynsym sections

Disabling NEEDS_MANUAL_RELOC U-Boot size increased by 10% of it's original
size (550kB to 608kB).

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/a845670b34925859b2e321875f7588a29f6655f9.1655299267.git.michal.simek@amd.com

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 24c904f3 06-Apr-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_MEM_TOP_HIDE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_MEM_TOP_HIDE

Signed-off-by: Tom Rini <trini@konsulko.com>

# 7fe32b34 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert arch_cpu_init_dm() to use events

Instead of a special function, send an event after driver model is inited
and adjust the boards which use this function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 42fdcebf 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert misc_init_f() to use events

This hook can be implmented using events, for the three boards that
actually use it.

Add the event type and event handlers. Drop CONFIG_MISC_INIT_F since we
can just use CONFIG_EVENT to control this. Since sandbox always enables
CONFIG_EVENT, we can drop the defconfig lines there too.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a421904 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Set up the event system on start-up

Call event_init() before relocation to get the event system running.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7f3b79af 12-Jan-2022 Simon Glass <sjg@chromium.org>

bloblist: Rename the SPL tag

Add a U_BOOT prefix to this tag since it is specific to the U-Boot
project.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d5b6e91b 03-Nov-2021 Simon Glass <sjg@chromium.org>

bloblist: Support allocating the bloblist

Typically the bloblist is positioned at a fixed address in memory until
relocation. This is convenient when it is set up in SPL or before
relocation.

But for EFI we want to set it up only when U-Boot proper is running. Add
a way to allocate it using malloc() and update the documentation to cover
this aspect of bloblist.

Note there are no tests of this feature at present, nor any direct testing
of bloblist_init().

This can be added, e.g. by making this option controllable at runtime.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 47d7d036 13-Nov-2021 Marek Vasut <marex@denx.de>

board_f: Copy GD to new GD even if relocation disabled

Even if U-Boot has relocation disabled via GD_FLG_SKIP_RELOC , the
relocated stage of U-Boot still picks GD from new_gd location. The
U-Boot itself is not relocated, but GD might be, so copy the GD to
new GD location even if relocation is disabled.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Peng Fan <peng.fan@oss.nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# 55dabcc8 18-Aug-2021 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY

First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig. Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL. Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support. Convert all of the existing users to
one or more symbols.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 69d9eda4 10-Jul-2021 Simon Glass <sjg@chromium.org>

i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@amd.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@konsulko.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 7c5c137c 04-Dec-2022 Tom Rini <trini@konsulko.com>

global: Migrate CONFIG_PRAM to CFG

Perform a simple rename of CONFIG_PRAM to CFG_PRAM

Signed-off-by: Tom Rini <trini@konsulko.com>

# 65cc0e2a 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_* to CFG_SYS_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS namespace do
not easily transition to Kconfig. In many cases they likely should come
from the device tree instead. Move these out of CONFIG namespace and in
to CFG namespace.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# aa6e94de 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_SDRAM_* to CFG_SYS_SDRAM_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS_SDRAM
namespace do not easily transition to Kconfig. In many cases they likely
should come from the device tree instead. Move these out of CONFIG
namespace and in to CFG namespace.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 02f5a014 28-Oct-2022 Tom Rini <trini@konsulko.com>

SYS_NONCACHED_MEMORY: Correct comment in common/board_f.c

The comment block in reserve_noncached has a typo in one filename and
an incorrect filename in another function reference. Correct both of
these.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 50128aeb 28-Oct-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

cyclic: get rid of cyclic_init()

Currently, we must call cyclic_init() at some point before
cyclic_register() becomes possible. That turns out to be somewhat
awkward, especially with SPL, and has resulted in a watchdog callback
not being registered, thus causing the board to prematurely reset.

We already rely on gd->cyclic reliably being set to NULL by the asm
code that clears all of gd. Now that the cyclic list is a hlist, and
thus an empty list is represented by a NULL head pointer, and struct
cyclic_drv has no other members, we can just as well drop a level of
indirection and put the hlist_head directly in struct
global_data. This doesn't increase the size of struct global_data,
gets rid of an early malloc(), and generates slightly smaller code.

But primarily, this avoids having to call cyclic_init() early; the cyclic
infrastructure is simply ready to register callbacks as soon as we
enter C code.

We can still end up with schedule() being called from asm very early,
so we still need to check that gd itself has been properly initialized
[*], but once it has, gd->cyclic_list is perfectly fine to access, and
will just be an empty list.

As for cyclic_uninit(), it was never really the opposite of
cyclic_init() since it didn't free the struct cyclic_drv nor set
gd->cyclic to NULL. Rename it to cyclic_unregister_all() and use that
in test/, and also insert a call at the end of the board_init_f
sequence so that gd->cyclic_list is a fresh empty list before we enter
board_init_r().

A small piece of ugliness is that I had to add a cast in
cyclic_get_list() to silence a "discards 'volatile' qualifier"
warning, but that is completely equivalent to the existing handling of
the uclass_root_s list_head member.

[*] I'm not really sure where we guarantee that the register used for
gd contains 0 until it gets explicitly initialized, but that must be
the case, otherwise testing gd for being NULL would not make much sense.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Tested-by: Tim Harvey <tharvey@gateworks.com> # imx8mm-venice-*

# 98463903 20-Oct-2022 Simon Glass <sjg@chromium.org>

Rename CONFIG_SYS_TEXT_BASE to CONFIG_TEXT_BASE

The current name is inconsistent with SPL which uses CONFIG_SPL_TEXT_BASE
and this makes it imposible to use CONFIG_VAL().

Rename it to resolve this problem.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b86986c7 18-Oct-2022 Simon Glass <sjg@chromium.org>

video: Rename CONFIG_DM_VIDEO to CONFIG_VIDEO

Now that all the old code is gone, rename this option. Driver model
migration is now complete.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f9b7bd7e 16-Oct-2022 Simon Glass <sjg@chromium.org>

video: cmd: Drop old LCD code

This relies on the old LCD implementation which is to be removed. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9259bd17 10-Oct-2022 Michal Suchanek <msuchanek@suse.de>

common: board_f: Print information for all sysresets

Boards can have multiple sysresets, iterate all when printing sysreset
info.

Fixes: 23471aed5c ("board_f: Add reset status printing")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3c29c0fc 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: drop ifdefs around header includes

Drop the remaining ifdef around spl.h include.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# d63fc994 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: introduce arch_setup_dest_addr()

In order to move ppc-specific code out of setup_dest_addr(), provide an
arch-specific variant arch_setup_dest_addr(), that can be used by
architecture code to fix up the initial reloc address.

It is called at the end of setup_dest_addr() initcall and the default
implementation is a nop stub.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 85e68ae0 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: move CONFIG_MACH_TYPE logic to arch/arm/lib/bdinfo.c

asm/mach_type.h header and CONFIG_MACH_TYPE macro are arm-specific, so move
related bdinfo logic to arch_setup_bdinfo() in arch/arm/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 181cbd40 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: remove XTRN_DECLARE_GLOBAL_DATA_PTR dead code

The XTRN_DECLARE_GLOBAL_DATA_PTR declarations in ppc code are permanently
commented out, so there are no users for this macro:
#if 1
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r2")
#else /* We could use plain global data, but the resulting code is bigger */
#define XTRN_DECLARE_GLOBAL_DATA_PTR extern
#define DECLARE_GLOBAL_DATA_PTR XTRN_DECLARE_GLOBAL_DATA_PTR \
gd_t *gd
#endif

Remove all references to this macro, but add a documentation note regarding
the possibility of using plain global data for the GD pointer.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 236f7396 18-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: show_dram_config: Print also real DRAM size

32-bit U-Boot builds cannot use more than around 2 GB of DDR memory. But on
some platforms/boards it is possible to connect also 4 GB SODIMM DDR memory.
U-Boot currently prints only effective size of RAM which can use, which may
be misleading as somebody would expect that this line prints total size of
connected DDR modules. So change show_dram_config code to prints both real
and effective DRAM size if they are different. If they are same then print
just one number like before. It is possible that effective size is just few
bytes smaller than the real size, so print both numbers only in case
function print_size() prints formats them differently.

Signed-off-by: Pali Rohár <pali@kernel.org>

# d92aee57 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix printing gd->ram_size and gd->ram_top

Members gd->ram_size and gd->ram_top are of type phys_addr_t which does not
have to fit into ulong type. So cast them into unsigned long long.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 049704f8 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix types for board_get_usable_ram_top()

Commit 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
changed type of ram_top member from ulong to phys_addr_t but did not
changed types in board_get_usable_ram_top() function which returns value
for ram_top.

So change ulong to phys_addr_t type also in board_get_usable_ram_top()
signature and implementations.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 29caf930 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]

# 70545642 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Integrate cyclic functionality at bootup in board_r/f

This patch adds a call to cyclic_init() to board_f/r.c, enabling the
common cyclic infrastructure. After this it's possible to add cyclic
functions via cyclic_register().

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5d7f6014 20-Jun-2022 Tom Rini <trini@konsulko.com>

lcd: Remove legacy CONFIG_FB_ADDR code

No platforms set both CONFIG_LCD and CONFIG_FB_ADDR at this time, drop
this legacy code.

Signed-off-by: Tom Rini <trini@konsulko.com>

# d58c0074 24-Jun-2022 Michal Simek <michal.simek@amd.com>

microblaze: Add support for run time relocation

Microblaze is using NEEDS_MANUAL_RELOC from the beginnging. This is causing
issues with function pointer arrays which need to be updated manually after
relocation. Building code with -fPIC and linking with -pic will remove this
limitation and there is no longer need to run manual update.

By default still old option is enabled but by disabling NEEDS_MANUAL_RELOC
code will be compiled for full relocation.

The patch does couple of things which are connected to each other.
- Define STATIC_RELA dependency to call relocate-rela to fill sections.
- REMAKE_ELF was already enabled but u-boot file can't be used because
sections are empty. relocate-rela will fill them and output file is
u-boot.elf which should be used.
- Add support for full relocation (u-boot.elf)
- Add support for early relocation when u-boot.bin is loaded to different
address then CONFIG_SYS_TEXT_BASE
- Add rela.dyn and dynsym sections

Disabling NEEDS_MANUAL_RELOC U-Boot size increased by 10% of it's original
size (550kB to 608kB).

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/a845670b34925859b2e321875f7588a29f6655f9.1655299267.git.michal.simek@amd.com

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 24c904f3 06-Apr-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_MEM_TOP_HIDE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_MEM_TOP_HIDE

Signed-off-by: Tom Rini <trini@konsulko.com>

# 7fe32b34 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert arch_cpu_init_dm() to use events

Instead of a special function, send an event after driver model is inited
and adjust the boards which use this function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 42fdcebf 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert misc_init_f() to use events

This hook can be implmented using events, for the three boards that
actually use it.

Add the event type and event handlers. Drop CONFIG_MISC_INIT_F since we
can just use CONFIG_EVENT to control this. Since sandbox always enables
CONFIG_EVENT, we can drop the defconfig lines there too.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a421904 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Set up the event system on start-up

Call event_init() before relocation to get the event system running.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7f3b79af 12-Jan-2022 Simon Glass <sjg@chromium.org>

bloblist: Rename the SPL tag

Add a U_BOOT prefix to this tag since it is specific to the U-Boot
project.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d5b6e91b 03-Nov-2021 Simon Glass <sjg@chromium.org>

bloblist: Support allocating the bloblist

Typically the bloblist is positioned at a fixed address in memory until
relocation. This is convenient when it is set up in SPL or before
relocation.

But for EFI we want to set it up only when U-Boot proper is running. Add
a way to allocate it using malloc() and update the documentation to cover
this aspect of bloblist.

Note there are no tests of this feature at present, nor any direct testing
of bloblist_init().

This can be added, e.g. by making this option controllable at runtime.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 47d7d036 13-Nov-2021 Marek Vasut <marex@denx.de>

board_f: Copy GD to new GD even if relocation disabled

Even if U-Boot has relocation disabled via GD_FLG_SKIP_RELOC , the
relocated stage of U-Boot still picks GD from new_gd location. The
U-Boot itself is not relocated, but GD might be, so copy the GD to
new GD location even if relocation is disabled.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Peng Fan <peng.fan@oss.nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# 55dabcc8 18-Aug-2021 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY

First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig. Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL. Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support. Convert all of the existing users to
one or more symbols.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 69d9eda4 10-Jul-2021 Simon Glass <sjg@chromium.org>

i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@amd.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@konsulko.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 02f5a014 28-Oct-2022 Tom Rini <trini@konsulko.com>

SYS_NONCACHED_MEMORY: Correct comment in common/board_f.c

The comment block in reserve_noncached has a typo in one filename and
an incorrect filename in another function reference. Correct both of
these.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 50128aeb 28-Oct-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

cyclic: get rid of cyclic_init()

Currently, we must call cyclic_init() at some point before
cyclic_register() becomes possible. That turns out to be somewhat
awkward, especially with SPL, and has resulted in a watchdog callback
not being registered, thus causing the board to prematurely reset.

We already rely on gd->cyclic reliably being set to NULL by the asm
code that clears all of gd. Now that the cyclic list is a hlist, and
thus an empty list is represented by a NULL head pointer, and struct
cyclic_drv has no other members, we can just as well drop a level of
indirection and put the hlist_head directly in struct
global_data. This doesn't increase the size of struct global_data,
gets rid of an early malloc(), and generates slightly smaller code.

But primarily, this avoids having to call cyclic_init() early; the cyclic
infrastructure is simply ready to register callbacks as soon as we
enter C code.

We can still end up with schedule() being called from asm very early,
so we still need to check that gd itself has been properly initialized
[*], but once it has, gd->cyclic_list is perfectly fine to access, and
will just be an empty list.

As for cyclic_uninit(), it was never really the opposite of
cyclic_init() since it didn't free the struct cyclic_drv nor set
gd->cyclic to NULL. Rename it to cyclic_unregister_all() and use that
in test/, and also insert a call at the end of the board_init_f
sequence so that gd->cyclic_list is a fresh empty list before we enter
board_init_r().

A small piece of ugliness is that I had to add a cast in
cyclic_get_list() to silence a "discards 'volatile' qualifier"
warning, but that is completely equivalent to the existing handling of
the uclass_root_s list_head member.

[*] I'm not really sure where we guarantee that the register used for
gd contains 0 until it gets explicitly initialized, but that must be
the case, otherwise testing gd for being NULL would not make much sense.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Tested-by: Tim Harvey <tharvey@gateworks.com> # imx8mm-venice-*

# 98463903 20-Oct-2022 Simon Glass <sjg@chromium.org>

Rename CONFIG_SYS_TEXT_BASE to CONFIG_TEXT_BASE

The current name is inconsistent with SPL which uses CONFIG_SPL_TEXT_BASE
and this makes it imposible to use CONFIG_VAL().

Rename it to resolve this problem.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b86986c7 18-Oct-2022 Simon Glass <sjg@chromium.org>

video: Rename CONFIG_DM_VIDEO to CONFIG_VIDEO

Now that all the old code is gone, rename this option. Driver model
migration is now complete.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f9b7bd7e 16-Oct-2022 Simon Glass <sjg@chromium.org>

video: cmd: Drop old LCD code

This relies on the old LCD implementation which is to be removed. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9259bd17 10-Oct-2022 Michal Suchanek <msuchanek@suse.de>

common: board_f: Print information for all sysresets

Boards can have multiple sysresets, iterate all when printing sysreset
info.

Fixes: 23471aed5c ("board_f: Add reset status printing")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3c29c0fc 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: drop ifdefs around header includes

Drop the remaining ifdef around spl.h include.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# d63fc994 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: introduce arch_setup_dest_addr()

In order to move ppc-specific code out of setup_dest_addr(), provide an
arch-specific variant arch_setup_dest_addr(), that can be used by
architecture code to fix up the initial reloc address.

It is called at the end of setup_dest_addr() initcall and the default
implementation is a nop stub.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 85e68ae0 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: move CONFIG_MACH_TYPE logic to arch/arm/lib/bdinfo.c

asm/mach_type.h header and CONFIG_MACH_TYPE macro are arm-specific, so move
related bdinfo logic to arch_setup_bdinfo() in arch/arm/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 181cbd40 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: remove XTRN_DECLARE_GLOBAL_DATA_PTR dead code

The XTRN_DECLARE_GLOBAL_DATA_PTR declarations in ppc code are permanently
commented out, so there are no users for this macro:
#if 1
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r2")
#else /* We could use plain global data, but the resulting code is bigger */
#define XTRN_DECLARE_GLOBAL_DATA_PTR extern
#define DECLARE_GLOBAL_DATA_PTR XTRN_DECLARE_GLOBAL_DATA_PTR \
gd_t *gd
#endif

Remove all references to this macro, but add a documentation note regarding
the possibility of using plain global data for the GD pointer.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 236f7396 18-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: show_dram_config: Print also real DRAM size

32-bit U-Boot builds cannot use more than around 2 GB of DDR memory. But on
some platforms/boards it is possible to connect also 4 GB SODIMM DDR memory.
U-Boot currently prints only effective size of RAM which can use, which may
be misleading as somebody would expect that this line prints total size of
connected DDR modules. So change show_dram_config code to prints both real
and effective DRAM size if they are different. If they are same then print
just one number like before. It is possible that effective size is just few
bytes smaller than the real size, so print both numbers only in case
function print_size() prints formats them differently.

Signed-off-by: Pali Rohár <pali@kernel.org>

# d92aee57 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix printing gd->ram_size and gd->ram_top

Members gd->ram_size and gd->ram_top are of type phys_addr_t which does not
have to fit into ulong type. So cast them into unsigned long long.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 049704f8 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix types for board_get_usable_ram_top()

Commit 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
changed type of ram_top member from ulong to phys_addr_t but did not
changed types in board_get_usable_ram_top() function which returns value
for ram_top.

So change ulong to phys_addr_t type also in board_get_usable_ram_top()
signature and implementations.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 29caf930 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]

# 70545642 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Integrate cyclic functionality at bootup in board_r/f

This patch adds a call to cyclic_init() to board_f/r.c, enabling the
common cyclic infrastructure. After this it's possible to add cyclic
functions via cyclic_register().

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5d7f6014 20-Jun-2022 Tom Rini <trini@konsulko.com>

lcd: Remove legacy CONFIG_FB_ADDR code

No platforms set both CONFIG_LCD and CONFIG_FB_ADDR at this time, drop
this legacy code.

Signed-off-by: Tom Rini <trini@konsulko.com>

# d58c0074 24-Jun-2022 Michal Simek <michal.simek@amd.com>

microblaze: Add support for run time relocation

Microblaze is using NEEDS_MANUAL_RELOC from the beginnging. This is causing
issues with function pointer arrays which need to be updated manually after
relocation. Building code with -fPIC and linking with -pic will remove this
limitation and there is no longer need to run manual update.

By default still old option is enabled but by disabling NEEDS_MANUAL_RELOC
code will be compiled for full relocation.

The patch does couple of things which are connected to each other.
- Define STATIC_RELA dependency to call relocate-rela to fill sections.
- REMAKE_ELF was already enabled but u-boot file can't be used because
sections are empty. relocate-rela will fill them and output file is
u-boot.elf which should be used.
- Add support for full relocation (u-boot.elf)
- Add support for early relocation when u-boot.bin is loaded to different
address then CONFIG_SYS_TEXT_BASE
- Add rela.dyn and dynsym sections

Disabling NEEDS_MANUAL_RELOC U-Boot size increased by 10% of it's original
size (550kB to 608kB).

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/a845670b34925859b2e321875f7588a29f6655f9.1655299267.git.michal.simek@amd.com

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 24c904f3 06-Apr-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_MEM_TOP_HIDE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_MEM_TOP_HIDE

Signed-off-by: Tom Rini <trini@konsulko.com>

# 7fe32b34 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert arch_cpu_init_dm() to use events

Instead of a special function, send an event after driver model is inited
and adjust the boards which use this function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 42fdcebf 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert misc_init_f() to use events

This hook can be implmented using events, for the three boards that
actually use it.

Add the event type and event handlers. Drop CONFIG_MISC_INIT_F since we
can just use CONFIG_EVENT to control this. Since sandbox always enables
CONFIG_EVENT, we can drop the defconfig lines there too.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a421904 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Set up the event system on start-up

Call event_init() before relocation to get the event system running.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7f3b79af 12-Jan-2022 Simon Glass <sjg@chromium.org>

bloblist: Rename the SPL tag

Add a U_BOOT prefix to this tag since it is specific to the U-Boot
project.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d5b6e91b 03-Nov-2021 Simon Glass <sjg@chromium.org>

bloblist: Support allocating the bloblist

Typically the bloblist is positioned at a fixed address in memory until
relocation. This is convenient when it is set up in SPL or before
relocation.

But for EFI we want to set it up only when U-Boot proper is running. Add
a way to allocate it using malloc() and update the documentation to cover
this aspect of bloblist.

Note there are no tests of this feature at present, nor any direct testing
of bloblist_init().

This can be added, e.g. by making this option controllable at runtime.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 47d7d036 13-Nov-2021 Marek Vasut <marex@denx.de>

board_f: Copy GD to new GD even if relocation disabled

Even if U-Boot has relocation disabled via GD_FLG_SKIP_RELOC , the
relocated stage of U-Boot still picks GD from new_gd location. The
U-Boot itself is not relocated, but GD might be, so copy the GD to
new GD location even if relocation is disabled.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Peng Fan <peng.fan@oss.nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# 55dabcc8 18-Aug-2021 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY

First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig. Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL. Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support. Convert all of the existing users to
one or more symbols.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 69d9eda4 10-Jul-2021 Simon Glass <sjg@chromium.org>

i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@amd.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@konsulko.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 50128aeb 28-Oct-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

cyclic: get rid of cyclic_init()

Currently, we must call cyclic_init() at some point before
cyclic_register() becomes possible. That turns out to be somewhat
awkward, especially with SPL, and has resulted in a watchdog callback
not being registered, thus causing the board to prematurely reset.

We already rely on gd->cyclic reliably being set to NULL by the asm
code that clears all of gd. Now that the cyclic list is a hlist, and
thus an empty list is represented by a NULL head pointer, and struct
cyclic_drv has no other members, we can just as well drop a level of
indirection and put the hlist_head directly in struct
global_data. This doesn't increase the size of struct global_data,
gets rid of an early malloc(), and generates slightly smaller code.

But primarily, this avoids having to call cyclic_init() early; the cyclic
infrastructure is simply ready to register callbacks as soon as we
enter C code.

We can still end up with schedule() being called from asm very early,
so we still need to check that gd itself has been properly initialized
[*], but once it has, gd->cyclic_list is perfectly fine to access, and
will just be an empty list.

As for cyclic_uninit(), it was never really the opposite of
cyclic_init() since it didn't free the struct cyclic_drv nor set
gd->cyclic to NULL. Rename it to cyclic_unregister_all() and use that
in test/, and also insert a call at the end of the board_init_f
sequence so that gd->cyclic_list is a fresh empty list before we enter
board_init_r().

A small piece of ugliness is that I had to add a cast in
cyclic_get_list() to silence a "discards 'volatile' qualifier"
warning, but that is completely equivalent to the existing handling of
the uclass_root_s list_head member.

[*] I'm not really sure where we guarantee that the register used for
gd contains 0 until it gets explicitly initialized, but that must be
the case, otherwise testing gd for being NULL would not make much sense.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Tested-by: Tim Harvey <tharvey@gateworks.com> # imx8mm-venice-*

# 98463903 20-Oct-2022 Simon Glass <sjg@chromium.org>

Rename CONFIG_SYS_TEXT_BASE to CONFIG_TEXT_BASE

The current name is inconsistent with SPL which uses CONFIG_SPL_TEXT_BASE
and this makes it imposible to use CONFIG_VAL().

Rename it to resolve this problem.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b86986c7 18-Oct-2022 Simon Glass <sjg@chromium.org>

video: Rename CONFIG_DM_VIDEO to CONFIG_VIDEO

Now that all the old code is gone, rename this option. Driver model
migration is now complete.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f9b7bd7e 16-Oct-2022 Simon Glass <sjg@chromium.org>

video: cmd: Drop old LCD code

This relies on the old LCD implementation which is to be removed. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9259bd17 10-Oct-2022 Michal Suchanek <msuchanek@suse.de>

common: board_f: Print information for all sysresets

Boards can have multiple sysresets, iterate all when printing sysreset
info.

Fixes: 23471aed5c ("board_f: Add reset status printing")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3c29c0fc 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: drop ifdefs around header includes

Drop the remaining ifdef around spl.h include.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# d63fc994 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: introduce arch_setup_dest_addr()

In order to move ppc-specific code out of setup_dest_addr(), provide an
arch-specific variant arch_setup_dest_addr(), that can be used by
architecture code to fix up the initial reloc address.

It is called at the end of setup_dest_addr() initcall and the default
implementation is a nop stub.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 85e68ae0 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: move CONFIG_MACH_TYPE logic to arch/arm/lib/bdinfo.c

asm/mach_type.h header and CONFIG_MACH_TYPE macro are arm-specific, so move
related bdinfo logic to arch_setup_bdinfo() in arch/arm/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 181cbd40 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: remove XTRN_DECLARE_GLOBAL_DATA_PTR dead code

The XTRN_DECLARE_GLOBAL_DATA_PTR declarations in ppc code are permanently
commented out, so there are no users for this macro:
#if 1
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r2")
#else /* We could use plain global data, but the resulting code is bigger */
#define XTRN_DECLARE_GLOBAL_DATA_PTR extern
#define DECLARE_GLOBAL_DATA_PTR XTRN_DECLARE_GLOBAL_DATA_PTR \
gd_t *gd
#endif

Remove all references to this macro, but add a documentation note regarding
the possibility of using plain global data for the GD pointer.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 236f7396 18-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: show_dram_config: Print also real DRAM size

32-bit U-Boot builds cannot use more than around 2 GB of DDR memory. But on
some platforms/boards it is possible to connect also 4 GB SODIMM DDR memory.
U-Boot currently prints only effective size of RAM which can use, which may
be misleading as somebody would expect that this line prints total size of
connected DDR modules. So change show_dram_config code to prints both real
and effective DRAM size if they are different. If they are same then print
just one number like before. It is possible that effective size is just few
bytes smaller than the real size, so print both numbers only in case
function print_size() prints formats them differently.

Signed-off-by: Pali Rohár <pali@kernel.org>

# d92aee57 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix printing gd->ram_size and gd->ram_top

Members gd->ram_size and gd->ram_top are of type phys_addr_t which does not
have to fit into ulong type. So cast them into unsigned long long.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 049704f8 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix types for board_get_usable_ram_top()

Commit 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
changed type of ram_top member from ulong to phys_addr_t but did not
changed types in board_get_usable_ram_top() function which returns value
for ram_top.

So change ulong to phys_addr_t type also in board_get_usable_ram_top()
signature and implementations.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 29caf930 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]

# 70545642 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Integrate cyclic functionality at bootup in board_r/f

This patch adds a call to cyclic_init() to board_f/r.c, enabling the
common cyclic infrastructure. After this it's possible to add cyclic
functions via cyclic_register().

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5d7f6014 20-Jun-2022 Tom Rini <trini@konsulko.com>

lcd: Remove legacy CONFIG_FB_ADDR code

No platforms set both CONFIG_LCD and CONFIG_FB_ADDR at this time, drop
this legacy code.

Signed-off-by: Tom Rini <trini@konsulko.com>

# d58c0074 24-Jun-2022 Michal Simek <michal.simek@amd.com>

microblaze: Add support for run time relocation

Microblaze is using NEEDS_MANUAL_RELOC from the beginnging. This is causing
issues with function pointer arrays which need to be updated manually after
relocation. Building code with -fPIC and linking with -pic will remove this
limitation and there is no longer need to run manual update.

By default still old option is enabled but by disabling NEEDS_MANUAL_RELOC
code will be compiled for full relocation.

The patch does couple of things which are connected to each other.
- Define STATIC_RELA dependency to call relocate-rela to fill sections.
- REMAKE_ELF was already enabled but u-boot file can't be used because
sections are empty. relocate-rela will fill them and output file is
u-boot.elf which should be used.
- Add support for full relocation (u-boot.elf)
- Add support for early relocation when u-boot.bin is loaded to different
address then CONFIG_SYS_TEXT_BASE
- Add rela.dyn and dynsym sections

Disabling NEEDS_MANUAL_RELOC U-Boot size increased by 10% of it's original
size (550kB to 608kB).

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/a845670b34925859b2e321875f7588a29f6655f9.1655299267.git.michal.simek@amd.com

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 24c904f3 06-Apr-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_MEM_TOP_HIDE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_MEM_TOP_HIDE

Signed-off-by: Tom Rini <trini@konsulko.com>

# 7fe32b34 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert arch_cpu_init_dm() to use events

Instead of a special function, send an event after driver model is inited
and adjust the boards which use this function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 42fdcebf 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert misc_init_f() to use events

This hook can be implmented using events, for the three boards that
actually use it.

Add the event type and event handlers. Drop CONFIG_MISC_INIT_F since we
can just use CONFIG_EVENT to control this. Since sandbox always enables
CONFIG_EVENT, we can drop the defconfig lines there too.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a421904 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Set up the event system on start-up

Call event_init() before relocation to get the event system running.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7f3b79af 12-Jan-2022 Simon Glass <sjg@chromium.org>

bloblist: Rename the SPL tag

Add a U_BOOT prefix to this tag since it is specific to the U-Boot
project.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d5b6e91b 03-Nov-2021 Simon Glass <sjg@chromium.org>

bloblist: Support allocating the bloblist

Typically the bloblist is positioned at a fixed address in memory until
relocation. This is convenient when it is set up in SPL or before
relocation.

But for EFI we want to set it up only when U-Boot proper is running. Add
a way to allocate it using malloc() and update the documentation to cover
this aspect of bloblist.

Note there are no tests of this feature at present, nor any direct testing
of bloblist_init().

This can be added, e.g. by making this option controllable at runtime.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 47d7d036 13-Nov-2021 Marek Vasut <marex@denx.de>

board_f: Copy GD to new GD even if relocation disabled

Even if U-Boot has relocation disabled via GD_FLG_SKIP_RELOC , the
relocated stage of U-Boot still picks GD from new_gd location. The
U-Boot itself is not relocated, but GD might be, so copy the GD to
new GD location even if relocation is disabled.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Peng Fan <peng.fan@oss.nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# 55dabcc8 18-Aug-2021 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY

First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig. Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL. Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support. Convert all of the existing users to
one or more symbols.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 69d9eda4 10-Jul-2021 Simon Glass <sjg@chromium.org>

i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@amd.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@konsulko.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 98463903 20-Oct-2022 Simon Glass <sjg@chromium.org>

Rename CONFIG_SYS_TEXT_BASE to CONFIG_TEXT_BASE

The current name is inconsistent with SPL which uses CONFIG_SPL_TEXT_BASE
and this makes it imposible to use CONFIG_VAL().

Rename it to resolve this problem.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b86986c7 18-Oct-2022 Simon Glass <sjg@chromium.org>

video: Rename CONFIG_DM_VIDEO to CONFIG_VIDEO

Now that all the old code is gone, rename this option. Driver model
migration is now complete.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f9b7bd7e 16-Oct-2022 Simon Glass <sjg@chromium.org>

video: cmd: Drop old LCD code

This relies on the old LCD implementation which is to be removed. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9259bd17 10-Oct-2022 Michal Suchanek <msuchanek@suse.de>

common: board_f: Print information for all sysresets

Boards can have multiple sysresets, iterate all when printing sysreset
info.

Fixes: 23471aed5c ("board_f: Add reset status printing")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3c29c0fc 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: drop ifdefs around header includes

Drop the remaining ifdef around spl.h include.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# d63fc994 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: introduce arch_setup_dest_addr()

In order to move ppc-specific code out of setup_dest_addr(), provide an
arch-specific variant arch_setup_dest_addr(), that can be used by
architecture code to fix up the initial reloc address.

It is called at the end of setup_dest_addr() initcall and the default
implementation is a nop stub.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 85e68ae0 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: move CONFIG_MACH_TYPE logic to arch/arm/lib/bdinfo.c

asm/mach_type.h header and CONFIG_MACH_TYPE macro are arm-specific, so move
related bdinfo logic to arch_setup_bdinfo() in arch/arm/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 181cbd40 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: remove XTRN_DECLARE_GLOBAL_DATA_PTR dead code

The XTRN_DECLARE_GLOBAL_DATA_PTR declarations in ppc code are permanently
commented out, so there are no users for this macro:
#if 1
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r2")
#else /* We could use plain global data, but the resulting code is bigger */
#define XTRN_DECLARE_GLOBAL_DATA_PTR extern
#define DECLARE_GLOBAL_DATA_PTR XTRN_DECLARE_GLOBAL_DATA_PTR \
gd_t *gd
#endif

Remove all references to this macro, but add a documentation note regarding
the possibility of using plain global data for the GD pointer.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 236f7396 18-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: show_dram_config: Print also real DRAM size

32-bit U-Boot builds cannot use more than around 2 GB of DDR memory. But on
some platforms/boards it is possible to connect also 4 GB SODIMM DDR memory.
U-Boot currently prints only effective size of RAM which can use, which may
be misleading as somebody would expect that this line prints total size of
connected DDR modules. So change show_dram_config code to prints both real
and effective DRAM size if they are different. If they are same then print
just one number like before. It is possible that effective size is just few
bytes smaller than the real size, so print both numbers only in case
function print_size() prints formats them differently.

Signed-off-by: Pali Rohár <pali@kernel.org>

# d92aee57 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix printing gd->ram_size and gd->ram_top

Members gd->ram_size and gd->ram_top are of type phys_addr_t which does not
have to fit into ulong type. So cast them into unsigned long long.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 049704f8 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix types for board_get_usable_ram_top()

Commit 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
changed type of ram_top member from ulong to phys_addr_t but did not
changed types in board_get_usable_ram_top() function which returns value
for ram_top.

So change ulong to phys_addr_t type also in board_get_usable_ram_top()
signature and implementations.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 29caf930 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]

# 70545642 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Integrate cyclic functionality at bootup in board_r/f

This patch adds a call to cyclic_init() to board_f/r.c, enabling the
common cyclic infrastructure. After this it's possible to add cyclic
functions via cyclic_register().

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5d7f6014 20-Jun-2022 Tom Rini <trini@konsulko.com>

lcd: Remove legacy CONFIG_FB_ADDR code

No platforms set both CONFIG_LCD and CONFIG_FB_ADDR at this time, drop
this legacy code.

Signed-off-by: Tom Rini <trini@konsulko.com>

# d58c0074 24-Jun-2022 Michal Simek <michal.simek@amd.com>

microblaze: Add support for run time relocation

Microblaze is using NEEDS_MANUAL_RELOC from the beginnging. This is causing
issues with function pointer arrays which need to be updated manually after
relocation. Building code with -fPIC and linking with -pic will remove this
limitation and there is no longer need to run manual update.

By default still old option is enabled but by disabling NEEDS_MANUAL_RELOC
code will be compiled for full relocation.

The patch does couple of things which are connected to each other.
- Define STATIC_RELA dependency to call relocate-rela to fill sections.
- REMAKE_ELF was already enabled but u-boot file can't be used because
sections are empty. relocate-rela will fill them and output file is
u-boot.elf which should be used.
- Add support for full relocation (u-boot.elf)
- Add support for early relocation when u-boot.bin is loaded to different
address then CONFIG_SYS_TEXT_BASE
- Add rela.dyn and dynsym sections

Disabling NEEDS_MANUAL_RELOC U-Boot size increased by 10% of it's original
size (550kB to 608kB).

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/a845670b34925859b2e321875f7588a29f6655f9.1655299267.git.michal.simek@amd.com

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 24c904f3 06-Apr-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_MEM_TOP_HIDE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_MEM_TOP_HIDE

Signed-off-by: Tom Rini <trini@konsulko.com>

# 7fe32b34 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert arch_cpu_init_dm() to use events

Instead of a special function, send an event after driver model is inited
and adjust the boards which use this function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 42fdcebf 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert misc_init_f() to use events

This hook can be implmented using events, for the three boards that
actually use it.

Add the event type and event handlers. Drop CONFIG_MISC_INIT_F since we
can just use CONFIG_EVENT to control this. Since sandbox always enables
CONFIG_EVENT, we can drop the defconfig lines there too.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a421904 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Set up the event system on start-up

Call event_init() before relocation to get the event system running.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7f3b79af 12-Jan-2022 Simon Glass <sjg@chromium.org>

bloblist: Rename the SPL tag

Add a U_BOOT prefix to this tag since it is specific to the U-Boot
project.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d5b6e91b 03-Nov-2021 Simon Glass <sjg@chromium.org>

bloblist: Support allocating the bloblist

Typically the bloblist is positioned at a fixed address in memory until
relocation. This is convenient when it is set up in SPL or before
relocation.

But for EFI we want to set it up only when U-Boot proper is running. Add
a way to allocate it using malloc() and update the documentation to cover
this aspect of bloblist.

Note there are no tests of this feature at present, nor any direct testing
of bloblist_init().

This can be added, e.g. by making this option controllable at runtime.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 47d7d036 13-Nov-2021 Marek Vasut <marex@denx.de>

board_f: Copy GD to new GD even if relocation disabled

Even if U-Boot has relocation disabled via GD_FLG_SKIP_RELOC , the
relocated stage of U-Boot still picks GD from new_gd location. The
U-Boot itself is not relocated, but GD might be, so copy the GD to
new GD location even if relocation is disabled.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Peng Fan <peng.fan@oss.nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# 55dabcc8 18-Aug-2021 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY

First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig. Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL. Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support. Convert all of the existing users to
one or more symbols.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 69d9eda4 10-Jul-2021 Simon Glass <sjg@chromium.org>

i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@amd.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@konsulko.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 9259bd17 10-Oct-2022 Michal Suchanek <msuchanek@suse.de>

common: board_f: Print information for all sysresets

Boards can have multiple sysresets, iterate all when printing sysreset
info.

Fixes: 23471aed5c ("board_f: Add reset status printing")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3c29c0fc 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: drop ifdefs around header includes

Drop the remaining ifdef around spl.h include.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# d63fc994 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: introduce arch_setup_dest_addr()

In order to move ppc-specific code out of setup_dest_addr(), provide an
arch-specific variant arch_setup_dest_addr(), that can be used by
architecture code to fix up the initial reloc address.

It is called at the end of setup_dest_addr() initcall and the default
implementation is a nop stub.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 85e68ae0 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: move CONFIG_MACH_TYPE logic to arch/arm/lib/bdinfo.c

asm/mach_type.h header and CONFIG_MACH_TYPE macro are arm-specific, so move
related bdinfo logic to arch_setup_bdinfo() in arch/arm/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 181cbd40 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: remove XTRN_DECLARE_GLOBAL_DATA_PTR dead code

The XTRN_DECLARE_GLOBAL_DATA_PTR declarations in ppc code are permanently
commented out, so there are no users for this macro:
#if 1
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r2")
#else /* We could use plain global data, but the resulting code is bigger */
#define XTRN_DECLARE_GLOBAL_DATA_PTR extern
#define DECLARE_GLOBAL_DATA_PTR XTRN_DECLARE_GLOBAL_DATA_PTR \
gd_t *gd
#endif

Remove all references to this macro, but add a documentation note regarding
the possibility of using plain global data for the GD pointer.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 236f7396 18-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: show_dram_config: Print also real DRAM size

32-bit U-Boot builds cannot use more than around 2 GB of DDR memory. But on
some platforms/boards it is possible to connect also 4 GB SODIMM DDR memory.
U-Boot currently prints only effective size of RAM which can use, which may
be misleading as somebody would expect that this line prints total size of
connected DDR modules. So change show_dram_config code to prints both real
and effective DRAM size if they are different. If they are same then print
just one number like before. It is possible that effective size is just few
bytes smaller than the real size, so print both numbers only in case
function print_size() prints formats them differently.

Signed-off-by: Pali Rohár <pali@kernel.org>

# d92aee57 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix printing gd->ram_size and gd->ram_top

Members gd->ram_size and gd->ram_top are of type phys_addr_t which does not
have to fit into ulong type. So cast them into unsigned long long.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 049704f8 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix types for board_get_usable_ram_top()

Commit 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
changed type of ram_top member from ulong to phys_addr_t but did not
changed types in board_get_usable_ram_top() function which returns value
for ram_top.

So change ulong to phys_addr_t type also in board_get_usable_ram_top()
signature and implementations.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 29caf930 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]

# 70545642 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Integrate cyclic functionality at bootup in board_r/f

This patch adds a call to cyclic_init() to board_f/r.c, enabling the
common cyclic infrastructure. After this it's possible to add cyclic
functions via cyclic_register().

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5d7f6014 20-Jun-2022 Tom Rini <trini@konsulko.com>

lcd: Remove legacy CONFIG_FB_ADDR code

No platforms set both CONFIG_LCD and CONFIG_FB_ADDR at this time, drop
this legacy code.

Signed-off-by: Tom Rini <trini@konsulko.com>

# d58c0074 24-Jun-2022 Michal Simek <michal.simek@amd.com>

microblaze: Add support for run time relocation

Microblaze is using NEEDS_MANUAL_RELOC from the beginnging. This is causing
issues with function pointer arrays which need to be updated manually after
relocation. Building code with -fPIC and linking with -pic will remove this
limitation and there is no longer need to run manual update.

By default still old option is enabled but by disabling NEEDS_MANUAL_RELOC
code will be compiled for full relocation.

The patch does couple of things which are connected to each other.
- Define STATIC_RELA dependency to call relocate-rela to fill sections.
- REMAKE_ELF was already enabled but u-boot file can't be used because
sections are empty. relocate-rela will fill them and output file is
u-boot.elf which should be used.
- Add support for full relocation (u-boot.elf)
- Add support for early relocation when u-boot.bin is loaded to different
address then CONFIG_SYS_TEXT_BASE
- Add rela.dyn and dynsym sections

Disabling NEEDS_MANUAL_RELOC U-Boot size increased by 10% of it's original
size (550kB to 608kB).

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/a845670b34925859b2e321875f7588a29f6655f9.1655299267.git.michal.simek@amd.com

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 24c904f3 06-Apr-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_MEM_TOP_HIDE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_MEM_TOP_HIDE

Signed-off-by: Tom Rini <trini@konsulko.com>

# 7fe32b34 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert arch_cpu_init_dm() to use events

Instead of a special function, send an event after driver model is inited
and adjust the boards which use this function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 42fdcebf 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert misc_init_f() to use events

This hook can be implmented using events, for the three boards that
actually use it.

Add the event type and event handlers. Drop CONFIG_MISC_INIT_F since we
can just use CONFIG_EVENT to control this. Since sandbox always enables
CONFIG_EVENT, we can drop the defconfig lines there too.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a421904 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Set up the event system on start-up

Call event_init() before relocation to get the event system running.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7f3b79af 12-Jan-2022 Simon Glass <sjg@chromium.org>

bloblist: Rename the SPL tag

Add a U_BOOT prefix to this tag since it is specific to the U-Boot
project.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d5b6e91b 03-Nov-2021 Simon Glass <sjg@chromium.org>

bloblist: Support allocating the bloblist

Typically the bloblist is positioned at a fixed address in memory until
relocation. This is convenient when it is set up in SPL or before
relocation.

But for EFI we want to set it up only when U-Boot proper is running. Add
a way to allocate it using malloc() and update the documentation to cover
this aspect of bloblist.

Note there are no tests of this feature at present, nor any direct testing
of bloblist_init().

This can be added, e.g. by making this option controllable at runtime.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 47d7d036 13-Nov-2021 Marek Vasut <marex@denx.de>

board_f: Copy GD to new GD even if relocation disabled

Even if U-Boot has relocation disabled via GD_FLG_SKIP_RELOC , the
relocated stage of U-Boot still picks GD from new_gd location. The
U-Boot itself is not relocated, but GD might be, so copy the GD to
new GD location even if relocation is disabled.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Peng Fan <peng.fan@oss.nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# 55dabcc8 18-Aug-2021 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY

First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig. Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL. Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support. Convert all of the existing users to
one or more symbols.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 69d9eda4 10-Jul-2021 Simon Glass <sjg@chromium.org>

i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@amd.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@konsulko.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 3c29c0fc 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: drop ifdefs around header includes

Drop the remaining ifdef around spl.h include.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# d63fc994 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: introduce arch_setup_dest_addr()

In order to move ppc-specific code out of setup_dest_addr(), provide an
arch-specific variant arch_setup_dest_addr(), that can be used by
architecture code to fix up the initial reloc address.

It is called at the end of setup_dest_addr() initcall and the default
implementation is a nop stub.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 85e68ae0 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: move CONFIG_MACH_TYPE logic to arch/arm/lib/bdinfo.c

asm/mach_type.h header and CONFIG_MACH_TYPE macro are arm-specific, so move
related bdinfo logic to arch_setup_bdinfo() in arch/arm/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 181cbd40 13-Sep-2022 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: remove XTRN_DECLARE_GLOBAL_DATA_PTR dead code

The XTRN_DECLARE_GLOBAL_DATA_PTR declarations in ppc code are permanently
commented out, so there are no users for this macro:
#if 1
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r2")
#else /* We could use plain global data, but the resulting code is bigger */
#define XTRN_DECLARE_GLOBAL_DATA_PTR extern
#define DECLARE_GLOBAL_DATA_PTR XTRN_DECLARE_GLOBAL_DATA_PTR \
gd_t *gd
#endif

Remove all references to this macro, but add a documentation note regarding
the possibility of using plain global data for the GD pointer.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 236f7396 18-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: show_dram_config: Print also real DRAM size

32-bit U-Boot builds cannot use more than around 2 GB of DDR memory. But on
some platforms/boards it is possible to connect also 4 GB SODIMM DDR memory.
U-Boot currently prints only effective size of RAM which can use, which may
be misleading as somebody would expect that this line prints total size of
connected DDR modules. So change show_dram_config code to prints both real
and effective DRAM size if they are different. If they are same then print
just one number like before. It is possible that effective size is just few
bytes smaller than the real size, so print both numbers only in case
function print_size() prints formats them differently.

Signed-off-by: Pali Rohár <pali@kernel.org>

# d92aee57 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix printing gd->ram_size and gd->ram_top

Members gd->ram_size and gd->ram_top are of type phys_addr_t which does not
have to fit into ulong type. So cast them into unsigned long long.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 049704f8 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix types for board_get_usable_ram_top()

Commit 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
changed type of ram_top member from ulong to phys_addr_t but did not
changed types in board_get_usable_ram_top() function which returns value
for ram_top.

So change ulong to phys_addr_t type also in board_get_usable_ram_top()
signature and implementations.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 29caf930 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]

# 70545642 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Integrate cyclic functionality at bootup in board_r/f

This patch adds a call to cyclic_init() to board_f/r.c, enabling the
common cyclic infrastructure. After this it's possible to add cyclic
functions via cyclic_register().

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5d7f6014 20-Jun-2022 Tom Rini <trini@konsulko.com>

lcd: Remove legacy CONFIG_FB_ADDR code

No platforms set both CONFIG_LCD and CONFIG_FB_ADDR at this time, drop
this legacy code.

Signed-off-by: Tom Rini <trini@konsulko.com>

# d58c0074 24-Jun-2022 Michal Simek <michal.simek@amd.com>

microblaze: Add support for run time relocation

Microblaze is using NEEDS_MANUAL_RELOC from the beginnging. This is causing
issues with function pointer arrays which need to be updated manually after
relocation. Building code with -fPIC and linking with -pic will remove this
limitation and there is no longer need to run manual update.

By default still old option is enabled but by disabling NEEDS_MANUAL_RELOC
code will be compiled for full relocation.

The patch does couple of things which are connected to each other.
- Define STATIC_RELA dependency to call relocate-rela to fill sections.
- REMAKE_ELF was already enabled but u-boot file can't be used because
sections are empty. relocate-rela will fill them and output file is
u-boot.elf which should be used.
- Add support for full relocation (u-boot.elf)
- Add support for early relocation when u-boot.bin is loaded to different
address then CONFIG_SYS_TEXT_BASE
- Add rela.dyn and dynsym sections

Disabling NEEDS_MANUAL_RELOC U-Boot size increased by 10% of it's original
size (550kB to 608kB).

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/a845670b34925859b2e321875f7588a29f6655f9.1655299267.git.michal.simek@amd.com

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 24c904f3 06-Apr-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_MEM_TOP_HIDE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_MEM_TOP_HIDE

Signed-off-by: Tom Rini <trini@konsulko.com>

# 7fe32b34 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert arch_cpu_init_dm() to use events

Instead of a special function, send an event after driver model is inited
and adjust the boards which use this function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 42fdcebf 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert misc_init_f() to use events

This hook can be implmented using events, for the three boards that
actually use it.

Add the event type and event handlers. Drop CONFIG_MISC_INIT_F since we
can just use CONFIG_EVENT to control this. Since sandbox always enables
CONFIG_EVENT, we can drop the defconfig lines there too.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a421904 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Set up the event system on start-up

Call event_init() before relocation to get the event system running.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7f3b79af 12-Jan-2022 Simon Glass <sjg@chromium.org>

bloblist: Rename the SPL tag

Add a U_BOOT prefix to this tag since it is specific to the U-Boot
project.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d5b6e91b 03-Nov-2021 Simon Glass <sjg@chromium.org>

bloblist: Support allocating the bloblist

Typically the bloblist is positioned at a fixed address in memory until
relocation. This is convenient when it is set up in SPL or before
relocation.

But for EFI we want to set it up only when U-Boot proper is running. Add
a way to allocate it using malloc() and update the documentation to cover
this aspect of bloblist.

Note there are no tests of this feature at present, nor any direct testing
of bloblist_init().

This can be added, e.g. by making this option controllable at runtime.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 47d7d036 13-Nov-2021 Marek Vasut <marex@denx.de>

board_f: Copy GD to new GD even if relocation disabled

Even if U-Boot has relocation disabled via GD_FLG_SKIP_RELOC , the
relocated stage of U-Boot still picks GD from new_gd location. The
U-Boot itself is not relocated, but GD might be, so copy the GD to
new GD location even if relocation is disabled.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Peng Fan <peng.fan@oss.nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# 55dabcc8 18-Aug-2021 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY

First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig. Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL. Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support. Convert all of the existing users to
one or more symbols.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 69d9eda4 10-Jul-2021 Simon Glass <sjg@chromium.org>

i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@amd.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@konsulko.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 236f7396 18-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: show_dram_config: Print also real DRAM size

32-bit U-Boot builds cannot use more than around 2 GB of DDR memory. But on
some platforms/boards it is possible to connect also 4 GB SODIMM DDR memory.
U-Boot currently prints only effective size of RAM which can use, which may
be misleading as somebody would expect that this line prints total size of
connected DDR modules. So change show_dram_config code to prints both real
and effective DRAM size if they are different. If they are same then print
just one number like before. It is possible that effective size is just few
bytes smaller than the real size, so print both numbers only in case
function print_size() prints formats them differently.

Signed-off-by: Pali Rohár <pali@kernel.org>

# d92aee57 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix printing gd->ram_size and gd->ram_top

Members gd->ram_size and gd->ram_top are of type phys_addr_t which does not
have to fit into ulong type. So cast them into unsigned long long.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 049704f8 09-Sep-2022 Pali Rohár <pali@kernel.org>

board_f: Fix types for board_get_usable_ram_top()

Commit 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
changed type of ram_top member from ulong to phys_addr_t but did not
changed types in board_get_usable_ram_top() function which returns value
for ram_top.

So change ulong to phys_addr_t type also in board_get_usable_ram_top()
signature and implementations.

Fixes: 37dc958947ed ("global_data.h: Change ram_top type to phys_addr_t")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 29caf930 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]

# 70545642 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Integrate cyclic functionality at bootup in board_r/f

This patch adds a call to cyclic_init() to board_f/r.c, enabling the
common cyclic infrastructure. After this it's possible to add cyclic
functions via cyclic_register().

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5d7f6014 20-Jun-2022 Tom Rini <trini@konsulko.com>

lcd: Remove legacy CONFIG_FB_ADDR code

No platforms set both CONFIG_LCD and CONFIG_FB_ADDR at this time, drop
this legacy code.

Signed-off-by: Tom Rini <trini@konsulko.com>

# d58c0074 24-Jun-2022 Michal Simek <michal.simek@amd.com>

microblaze: Add support for run time relocation

Microblaze is using NEEDS_MANUAL_RELOC from the beginnging. This is causing
issues with function pointer arrays which need to be updated manually after
relocation. Building code with -fPIC and linking with -pic will remove this
limitation and there is no longer need to run manual update.

By default still old option is enabled but by disabling NEEDS_MANUAL_RELOC
code will be compiled for full relocation.

The patch does couple of things which are connected to each other.
- Define STATIC_RELA dependency to call relocate-rela to fill sections.
- REMAKE_ELF was already enabled but u-boot file can't be used because
sections are empty. relocate-rela will fill them and output file is
u-boot.elf which should be used.
- Add support for full relocation (u-boot.elf)
- Add support for early relocation when u-boot.bin is loaded to different
address then CONFIG_SYS_TEXT_BASE
- Add rela.dyn and dynsym sections

Disabling NEEDS_MANUAL_RELOC U-Boot size increased by 10% of it's original
size (550kB to 608kB).

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/a845670b34925859b2e321875f7588a29f6655f9.1655299267.git.michal.simek@amd.com

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 24c904f3 06-Apr-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_MEM_TOP_HIDE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_MEM_TOP_HIDE

Signed-off-by: Tom Rini <trini@konsulko.com>

# 7fe32b34 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert arch_cpu_init_dm() to use events

Instead of a special function, send an event after driver model is inited
and adjust the boards which use this function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 42fdcebf 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert misc_init_f() to use events

This hook can be implmented using events, for the three boards that
actually use it.

Add the event type and event handlers. Drop CONFIG_MISC_INIT_F since we
can just use CONFIG_EVENT to control this. Since sandbox always enables
CONFIG_EVENT, we can drop the defconfig lines there too.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a421904 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Set up the event system on start-up

Call event_init() before relocation to get the event system running.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7f3b79af 12-Jan-2022 Simon Glass <sjg@chromium.org>

bloblist: Rename the SPL tag

Add a U_BOOT prefix to this tag since it is specific to the U-Boot
project.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d5b6e91b 03-Nov-2021 Simon Glass <sjg@chromium.org>

bloblist: Support allocating the bloblist

Typically the bloblist is positioned at a fixed address in memory until
relocation. This is convenient when it is set up in SPL or before
relocation.

But for EFI we want to set it up only when U-Boot proper is running. Add
a way to allocate it using malloc() and update the documentation to cover
this aspect of bloblist.

Note there are no tests of this feature at present, nor any direct testing
of bloblist_init().

This can be added, e.g. by making this option controllable at runtime.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 47d7d036 13-Nov-2021 Marek Vasut <marex@denx.de>

board_f: Copy GD to new GD even if relocation disabled

Even if U-Boot has relocation disabled via GD_FLG_SKIP_RELOC , the
relocated stage of U-Boot still picks GD from new_gd location. The
U-Boot itself is not relocated, but GD might be, so copy the GD to
new GD location even if relocation is disabled.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Peng Fan <peng.fan@oss.nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# 55dabcc8 18-Aug-2021 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY

First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig. Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL. Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support. Convert all of the existing users to
one or more symbols.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 69d9eda4 10-Jul-2021 Simon Glass <sjg@chromium.org>

i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@amd.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@konsulko.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5d7f6014 20-Jun-2022 Tom Rini <trini@konsulko.com>

lcd: Remove legacy CONFIG_FB_ADDR code

No platforms set both CONFIG_LCD and CONFIG_FB_ADDR at this time, drop
this legacy code.

Signed-off-by: Tom Rini <trini@konsulko.com>

# d58c0074 24-Jun-2022 Michal Simek <michal.simek@amd.com>

microblaze: Add support for run time relocation

Microblaze is using NEEDS_MANUAL_RELOC from the beginnging. This is causing
issues with function pointer arrays which need to be updated manually after
relocation. Building code with -fPIC and linking with -pic will remove this
limitation and there is no longer need to run manual update.

By default still old option is enabled but by disabling NEEDS_MANUAL_RELOC
code will be compiled for full relocation.

The patch does couple of things which are connected to each other.
- Define STATIC_RELA dependency to call relocate-rela to fill sections.
- REMAKE_ELF was already enabled but u-boot file can't be used because
sections are empty. relocate-rela will fill them and output file is
u-boot.elf which should be used.
- Add support for full relocation (u-boot.elf)
- Add support for early relocation when u-boot.bin is loaded to different
address then CONFIG_SYS_TEXT_BASE
- Add rela.dyn and dynsym sections

Disabling NEEDS_MANUAL_RELOC U-Boot size increased by 10% of it's original
size (550kB to 608kB).

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/a845670b34925859b2e321875f7588a29f6655f9.1655299267.git.michal.simek@amd.com

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 24c904f3 06-Apr-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_MEM_TOP_HIDE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_MEM_TOP_HIDE

Signed-off-by: Tom Rini <trini@konsulko.com>

# 7fe32b34 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert arch_cpu_init_dm() to use events

Instead of a special function, send an event after driver model is inited
and adjust the boards which use this function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 42fdcebf 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert misc_init_f() to use events

This hook can be implmented using events, for the three boards that
actually use it.

Add the event type and event handlers. Drop CONFIG_MISC_INIT_F since we
can just use CONFIG_EVENT to control this. Since sandbox always enables
CONFIG_EVENT, we can drop the defconfig lines there too.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a421904 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Set up the event system on start-up

Call event_init() before relocation to get the event system running.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7f3b79af 12-Jan-2022 Simon Glass <sjg@chromium.org>

bloblist: Rename the SPL tag

Add a U_BOOT prefix to this tag since it is specific to the U-Boot
project.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d5b6e91b 03-Nov-2021 Simon Glass <sjg@chromium.org>

bloblist: Support allocating the bloblist

Typically the bloblist is positioned at a fixed address in memory until
relocation. This is convenient when it is set up in SPL or before
relocation.

But for EFI we want to set it up only when U-Boot proper is running. Add
a way to allocate it using malloc() and update the documentation to cover
this aspect of bloblist.

Note there are no tests of this feature at present, nor any direct testing
of bloblist_init().

This can be added, e.g. by making this option controllable at runtime.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 47d7d036 13-Nov-2021 Marek Vasut <marex@denx.de>

board_f: Copy GD to new GD even if relocation disabled

Even if U-Boot has relocation disabled via GD_FLG_SKIP_RELOC , the
relocated stage of U-Boot still picks GD from new_gd location. The
U-Boot itself is not relocated, but GD might be, so copy the GD to
new GD location even if relocation is disabled.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Peng Fan <peng.fan@oss.nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# 55dabcc8 18-Aug-2021 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY

First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig. Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL. Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support. Convert all of the existing users to
one or more symbols.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 69d9eda4 10-Jul-2021 Simon Glass <sjg@chromium.org>

i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@amd.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@konsulko.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 5d7f6014 20-Jun-2022 Tom Rini <trini@konsulko.com>

lcd: Remove legacy CONFIG_FB_ADDR code

No platforms set both CONFIG_LCD and CONFIG_FB_ADDR at this time, drop
this legacy code.

Signed-off-by: Tom Rini <trini@konsulko.com>

# d58c0074 24-Jun-2022 Michal Simek <michal.simek@amd.com>

microblaze: Add support for run time relocation

Microblaze is using NEEDS_MANUAL_RELOC from the beginnging. This is causing
issues with function pointer arrays which need to be updated manually after
relocation. Building code with -fPIC and linking with -pic will remove this
limitation and there is no longer need to run manual update.

By default still old option is enabled but by disabling NEEDS_MANUAL_RELOC
code will be compiled for full relocation.

The patch does couple of things which are connected to each other.
- Define STATIC_RELA dependency to call relocate-rela to fill sections.
- REMAKE_ELF was already enabled but u-boot file can't be used because
sections are empty. relocate-rela will fill them and output file is
u-boot.elf which should be used.
- Add support for full relocation (u-boot.elf)
- Add support for early relocation when u-boot.bin is loaded to different
address then CONFIG_SYS_TEXT_BASE
- Add rela.dyn and dynsym sections

Disabling NEEDS_MANUAL_RELOC U-Boot size increased by 10% of it's original
size (550kB to 608kB).

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/a845670b34925859b2e321875f7588a29f6655f9.1655299267.git.michal.simek@amd.com

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 24c904f3 06-Apr-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_MEM_TOP_HIDE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_MEM_TOP_HIDE

Signed-off-by: Tom Rini <trini@konsulko.com>

# 7fe32b34 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert arch_cpu_init_dm() to use events

Instead of a special function, send an event after driver model is inited
and adjust the boards which use this function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 42fdcebf 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert misc_init_f() to use events

This hook can be implmented using events, for the three boards that
actually use it.

Add the event type and event handlers. Drop CONFIG_MISC_INIT_F since we
can just use CONFIG_EVENT to control this. Since sandbox always enables
CONFIG_EVENT, we can drop the defconfig lines there too.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a421904 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Set up the event system on start-up

Call event_init() before relocation to get the event system running.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7f3b79af 12-Jan-2022 Simon Glass <sjg@chromium.org>

bloblist: Rename the SPL tag

Add a U_BOOT prefix to this tag since it is specific to the U-Boot
project.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d5b6e91b 03-Nov-2021 Simon Glass <sjg@chromium.org>

bloblist: Support allocating the bloblist

Typically the bloblist is positioned at a fixed address in memory until
relocation. This is convenient when it is set up in SPL or before
relocation.

But for EFI we want to set it up only when U-Boot proper is running. Add
a way to allocate it using malloc() and update the documentation to cover
this aspect of bloblist.

Note there are no tests of this feature at present, nor any direct testing
of bloblist_init().

This can be added, e.g. by making this option controllable at runtime.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 47d7d036 13-Nov-2021 Marek Vasut <marex@denx.de>

board_f: Copy GD to new GD even if relocation disabled

Even if U-Boot has relocation disabled via GD_FLG_SKIP_RELOC , the
relocated stage of U-Boot still picks GD from new_gd location. The
U-Boot itself is not relocated, but GD might be, so copy the GD to
new GD location even if relocation is disabled.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Peng Fan <peng.fan@oss.nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# 55dabcc8 18-Aug-2021 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY

First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig. Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL. Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support. Convert all of the existing users to
one or more symbols.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 69d9eda4 10-Jul-2021 Simon Glass <sjg@chromium.org>

i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@amd.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@konsulko.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 24c904f3 06-Apr-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_MEM_TOP_HIDE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_MEM_TOP_HIDE

Signed-off-by: Tom Rini <trini@konsulko.com>

# 7fe32b34 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert arch_cpu_init_dm() to use events

Instead of a special function, send an event after driver model is inited
and adjust the boards which use this function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 42fdcebf 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert misc_init_f() to use events

This hook can be implmented using events, for the three boards that
actually use it.

Add the event type and event handlers. Drop CONFIG_MISC_INIT_F since we
can just use CONFIG_EVENT to control this. Since sandbox always enables
CONFIG_EVENT, we can drop the defconfig lines there too.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a421904 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Set up the event system on start-up

Call event_init() before relocation to get the event system running.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7f3b79af 12-Jan-2022 Simon Glass <sjg@chromium.org>

bloblist: Rename the SPL tag

Add a U_BOOT prefix to this tag since it is specific to the U-Boot
project.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d5b6e91b 03-Nov-2021 Simon Glass <sjg@chromium.org>

bloblist: Support allocating the bloblist

Typically the bloblist is positioned at a fixed address in memory until
relocation. This is convenient when it is set up in SPL or before
relocation.

But for EFI we want to set it up only when U-Boot proper is running. Add
a way to allocate it using malloc() and update the documentation to cover
this aspect of bloblist.

Note there are no tests of this feature at present, nor any direct testing
of bloblist_init().

This can be added, e.g. by making this option controllable at runtime.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 47d7d036 13-Nov-2021 Marek Vasut <marex@denx.de>

board_f: Copy GD to new GD even if relocation disabled

Even if U-Boot has relocation disabled via GD_FLG_SKIP_RELOC , the
relocated stage of U-Boot still picks GD from new_gd location. The
U-Boot itself is not relocated, but GD might be, so copy the GD to
new GD location even if relocation is disabled.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Peng Fan <peng.fan@oss.nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# 55dabcc8 18-Aug-2021 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY

First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig. Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL. Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support. Convert all of the existing users to
one or more symbols.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 69d9eda4 10-Jul-2021 Simon Glass <sjg@chromium.org>

i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@amd.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@konsulko.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 24c904f3 06-Apr-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_MEM_TOP_HIDE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_MEM_TOP_HIDE

Signed-off-by: Tom Rini <trini@konsulko.com>

# 7fe32b34 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert arch_cpu_init_dm() to use events

Instead of a special function, send an event after driver model is inited
and adjust the boards which use this function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 42fdcebf 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert misc_init_f() to use events

This hook can be implmented using events, for the three boards that
actually use it.

Add the event type and event handlers. Drop CONFIG_MISC_INIT_F since we
can just use CONFIG_EVENT to control this. Since sandbox always enables
CONFIG_EVENT, we can drop the defconfig lines there too.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a421904 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Set up the event system on start-up

Call event_init() before relocation to get the event system running.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7f3b79af 12-Jan-2022 Simon Glass <sjg@chromium.org>

bloblist: Rename the SPL tag

Add a U_BOOT prefix to this tag since it is specific to the U-Boot
project.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d5b6e91b 03-Nov-2021 Simon Glass <sjg@chromium.org>

bloblist: Support allocating the bloblist

Typically the bloblist is positioned at a fixed address in memory until
relocation. This is convenient when it is set up in SPL or before
relocation.

But for EFI we want to set it up only when U-Boot proper is running. Add
a way to allocate it using malloc() and update the documentation to cover
this aspect of bloblist.

Note there are no tests of this feature at present, nor any direct testing
of bloblist_init().

This can be added, e.g. by making this option controllable at runtime.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 47d7d036 13-Nov-2021 Marek Vasut <marex@denx.de>

board_f: Copy GD to new GD even if relocation disabled

Even if U-Boot has relocation disabled via GD_FLG_SKIP_RELOC , the
relocated stage of U-Boot still picks GD from new_gd location. The
U-Boot itself is not relocated, but GD might be, so copy the GD to
new GD location even if relocation is disabled.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Peng Fan <peng.fan@oss.nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# 55dabcc8 18-Aug-2021 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY

First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig. Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL. Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support. Convert all of the existing users to
one or more symbols.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 69d9eda4 10-Jul-2021 Simon Glass <sjg@chromium.org>

i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@amd.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@konsulko.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 7fe32b34 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert arch_cpu_init_dm() to use events

Instead of a special function, send an event after driver model is inited
and adjust the boards which use this function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 42fdcebf 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Convert misc_init_f() to use events

This hook can be implmented using events, for the three boards that
actually use it.

Add the event type and event handlers. Drop CONFIG_MISC_INIT_F since we
can just use CONFIG_EVENT to control this. Since sandbox always enables
CONFIG_EVENT, we can drop the defconfig lines there too.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a421904 04-Mar-2022 Simon Glass <sjg@chromium.org>

event: Set up the event system on start-up

Call event_init() before relocation to get the event system running.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7f3b79af 12-Jan-2022 Simon Glass <sjg@chromium.org>

bloblist: Rename the SPL tag

Add a U_BOOT prefix to this tag since it is specific to the U-Boot
project.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d5b6e91b 03-Nov-2021 Simon Glass <sjg@chromium.org>

bloblist: Support allocating the bloblist

Typically the bloblist is positioned at a fixed address in memory until
relocation. This is convenient when it is set up in SPL or before
relocation.

But for EFI we want to set it up only when U-Boot proper is running. Add
a way to allocate it using malloc() and update the documentation to cover
this aspect of bloblist.

Note there are no tests of this feature at present, nor any direct testing
of bloblist_init().

This can be added, e.g. by making this option controllable at runtime.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 47d7d036 13-Nov-2021 Marek Vasut <marex@denx.de>

board_f: Copy GD to new GD even if relocation disabled

Even if U-Boot has relocation disabled via GD_FLG_SKIP_RELOC , the
relocated stage of U-Boot still picks GD from new_gd location. The
U-Boot itself is not relocated, but GD might be, so copy the GD to
new GD location even if relocation is disabled.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Peng Fan <peng.fan@oss.nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# 55dabcc8 18-Aug-2021 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY

First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig. Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL. Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support. Convert all of the existing users to
one or more symbols.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 69d9eda4 10-Jul-2021 Simon Glass <sjg@chromium.org>

i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@konsulko.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.masahiro@socionext.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 7f3b79af 12-Jan-2022 Simon Glass <sjg@chromium.org>

bloblist: Rename the SPL tag

Add a U_BOOT prefix to this tag since it is specific to the U-Boot
project.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d5b6e91b 03-Nov-2021 Simon Glass <sjg@chromium.org>

bloblist: Support allocating the bloblist

Typically the bloblist is positioned at a fixed address in memory until
relocation. This is convenient when it is set up in SPL or before
relocation.

But for EFI we want to set it up only when U-Boot proper is running. Add
a way to allocate it using malloc() and update the documentation to cover
this aspect of bloblist.

Note there are no tests of this feature at present, nor any direct testing
of bloblist_init().

This can be added, e.g. by making this option controllable at runtime.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 47d7d036 13-Nov-2021 Marek Vasut <marek.vasut+renesas@gmail.com>

board_f: Copy GD to new GD even if relocation disabled

Even if U-Boot has relocation disabled via GD_FLG_SKIP_RELOC , the
relocated stage of U-Boot still picks GD from new_gd location. The
U-Boot itself is not relocated, but GD might be, so copy the GD to
new GD location even if relocation is disabled.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Peng Fan <peng.fan@oss.nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# 55dabcc8 18-Aug-2021 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY

First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig. Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL. Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support. Convert all of the existing users to
one or more symbols.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 69d9eda4 10-Jul-2021 Simon Glass <sjg@chromium.org>

i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <masahiroy@kernel.org>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@ti.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@ti.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# d5b6e91b 03-Nov-2021 Simon Glass <sjg@chromium.org>

bloblist: Support allocating the bloblist

Typically the bloblist is positioned at a fixed address in memory until
relocation. This is convenient when it is set up in SPL or before
relocation.

But for EFI we want to set it up only when U-Boot proper is running. Add
a way to allocate it using malloc() and update the documentation to cover
this aspect of bloblist.

Note there are no tests of this feature at present, nor any direct testing
of bloblist_init().

This can be added, e.g. by making this option controllable at runtime.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 47d7d036 13-Nov-2021 Marek Vasut <marek.vasut+renesas@gmail.com>

board_f: Copy GD to new GD even if relocation disabled

Even if U-Boot has relocation disabled via GD_FLG_SKIP_RELOC , the
relocated stage of U-Boot still picks GD from new_gd location. The
U-Boot itself is not relocated, but GD might be, so copy the GD to
new GD location even if relocation is disabled.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Peng Fan <peng.fan@oss.nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# 55dabcc8 18-Aug-2021 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY

First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig. Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL. Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support. Convert all of the existing users to
one or more symbols.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 69d9eda4 10-Jul-2021 Simon Glass <sjg@chromium.org>

i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <masahiroy@kernel.org>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@ti.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@ti.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 47d7d036 13-Nov-2021 Marek Vasut <marek.vasut+renesas@gmail.com>

board_f: Copy GD to new GD even if relocation disabled

Even if U-Boot has relocation disabled via GD_FLG_SKIP_RELOC , the
relocated stage of U-Boot still picks GD from new_gd location. The
U-Boot itself is not relocated, but GD might be, so copy the GD to
new GD location even if relocation is disabled.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Peng Fan <peng.fan@oss.nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# 55dabcc8 18-Aug-2021 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY

First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig. Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL. Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support. Convert all of the existing users to
one or more symbols.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 69d9eda4 10-Jul-2021 Simon Glass <sjg@chromium.org>

i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <masahiroy@kernel.org>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@ti.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@ti.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 55dabcc8 18-Aug-2021 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_I2C_LEGACY to Kconfig and add CONFIG_[ST]PL_SYS_I2C_LEGACY

First, we convert CONFIG_SYS_I2C_LEGACY to Kconfig. Next, as you cannot
have SYS_I2C_LEGACY and DM_I2C at the same time, introduce
CONFIG_SPL_SYS_I2C_LEGACY so that we can enable the legacy option only
in SPL. Finally, for some PowerPC cases we also need
CONFIG_TPL_SYS_I2C_LEGACY support. Convert all of the existing users to
one or more symbols.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 69d9eda4 10-Jul-2021 Simon Glass <sjg@chromium.org>

i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <masahiroy@kernel.org>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@ti.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@ti.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 69d9eda4 10-Jul-2021 Simon Glass <sjg@chromium.org>

i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <masahiroy@kernel.org>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@ti.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@ti.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 3c9fc23c 18-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

sandbox: don't refer to symbol _init

GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <masahiroy@kernel.org>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@ti.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@ti.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 83064c27 09-Apr-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f: cosmetic: change the debug trace to KB in reserve_video

Update the debug trace for the reserved video memory to KB as indicated
in the message with "%luk"; before the patch the computed size
gd->relocaddr - addr is in bytes.

This patch aligns the debug trace in reserve_video() with others
functions, for example on stm32mp157c-dk2:

- Reserving 3080192k for video at: dfd00000
+ Reserving 3008k for video at: dfd00000
Reserving 873k for U-Boot at: dfc25000
Reserving 32776k for malloc() at: ddc23000
Reserving 72 Bytes for Board Info at: ddc22fb0
Reserving 280 Bytes for Global Data at: ddc22e90
Reserving 119072 Bytes for FDT at: ddc05d70
Reserving 0x278 Bytes for bootstage at: ddc05af0

Fixes: 5630d2fbc50f3035 ("board: Show memory for frame buffers")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-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>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <masahiroy@kernel.org>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@ti.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@ti.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 401d1c4f 30-Oct-2020 Simon Glass <sjg@chromium.org>

common: Drop asm/global_data.h from common header

Move this out of the common header and include it only where needed. In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly. Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <masahiroy@kernel.org>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@ti.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@ti.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 9fe06464 13-Jan-2021 Simon Glass <sjg@chromium.org>

bloblist: Support relocating to a larger space

Typically in TPL/SPL the bloblist is quite small. But U-Boot proper may
want to add a lot more to it, such as ACPI tables.

Add a way to expand the bloblist by relocating it in U-Boot proper, along
with the other relocation activities.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <masahiroy@kernel.org>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@ti.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@ti.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 19b18daa 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 36716686 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b9a121f 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8e8d45ee 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4e81920b 28-Nov-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <masahiroy@kernel.org>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@foss.st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@foss.st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@ti.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@ti.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 5630d2fb 27-Sep-2020 Simon Glass <sjg@chromium.org>

board: Show memory for frame buffers

When debugging is enabled, show the memory allocated to video frame
buffers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 4a08fae1 27-Sep-2020 Simon Glass <sjg@chromium.org>

bloblist: Place on a 4KB boundary

It is much easier to read the bloblist addresses if it starts on a 4KB
boundary. Update it to align it accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f120aa75 12-Aug-2020 Stefan Roese <sr@denx.de>

board_f: Add default values for bi_dram[] in dram_init_banksize()

Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# dfaf6a57 12-Aug-2020 Stefan Roese <sr@denx.de>

CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"),
CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default).
It makes no sense to still carry code that is guarded with
"#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes
all these unreferenced code paths.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <masahiroy@kernel.org>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@ti.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@ti.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 78237828 17-Aug-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove dead code from init_func_i2c

Since commit 69153988a6f4 ("i2c: Finish dropping use of CONFIG_I2C_HARD")
init_func_i2c is wrapped only by "#if defined(CONFIG_SYS_I2C)". Because
of this, the second ifdef within becomes pointless:

#if defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
<snip>
#ifdef CONFIG_SYS_I2C
...
#else
...
#endif
<snip>
}
#endif

Remove the dead #else preprocessor code.

Fixes: 69153988a6f ("i2c: Finish dropping use of CONFIG_I2C_HARD")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <masahiroy@kernel.org>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@ti.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@ti.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 313981c2 12-Aug-2020 Pragnesh Patel <pragnesh.patel@sifive.com>

common/board_f: make sure to call fix_fdt() before reserve_fdt()

There may be a chance that board specific fix_fdt() will change the
size of FDT blob so it's safe to call reserve_fdt() after fix_fdt()
otherwise global data (gd) will overwrite with FDT blob values.

Fixes: a8492e25ac71 ("riscv: Expand the DT size before copy reserved memory node")

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <masahiroy@kernel.org>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@ti.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@ti.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 1532885c 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Remove setup_board_part1

Now that all arch specific code was converted to setup_bdinfo, we can
remove setup_board_part1.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# f1e504a3 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: ppc: Factor out ppc-specific bdinfo setup

Factor out ppc-specific bdinfo setup from generic init sequence to
arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ee9c3adc 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: m68k: Factor out m68k-specific bdinfo setup

Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in
arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where
possible.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 49122242 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Move sram bdinfo assignments to generic code

Move sram related bdinfo from arch-specific setup_board_part1 to generic
code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))"
instead of "#ifdef CONFIG_SYS_SRAM_BASE".

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# a4aa1889 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

Move all assignments to gd->bd->bi_mem{start,size} to generic code in
setup_bdinfo.

Xtensa architecture is special in this regard as it defines its own
handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.

For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
not needed anymore.

Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 81e7cb1e 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce arch_setup_bdinfo initcall

Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and
setup_board_part2 calls during pre-relocation init to populate gd->bd
boardinfo fields. This makes the generic init sequence cluttered with
arch-specific ifdefs.

In order to clean these arch-specific sequences from generic init,
introduce arch_setup_bdinfo weak initcall so that everyone can define their
own bdinfo setup routines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# ba743103 24-Jul-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

board_f: Introduce setup_bdinfo initcall

Introduce setup_bdinfo initcall as a generic routine to populate bdinfo
fields.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <masahiroy@kernel.org>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@ti.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@ti.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# b75d8dc5 26-Jun-2020 Masahiro Yamada <masahiroy@kernel.org>

treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

#include <asm/u-boot.h>
void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

struct bd_info;
void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

<smpl>
@@
typedef bd_t;
@@
-bd_t
+struct bd_info
</smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@ti.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@ti.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 53007fc1 19-Jun-2020 Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

common/board_f: Respect original FDT size while relocating

While relocating FDT we reserve some memory for the new FDT and
set the size of the FDT with that respect. But FDT may be placed
at the end of the RAM leading to memory access beyond it.
Fix this by copying exact FDT size bytes, not the reserved size.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# b8fd54d6 06-Apr-2020 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

common: fdt: Remove additional 4k space for fdt allocation

There is no technical reason to add additional 4k space for FDT. This space
is completely unused and just increase memory requirements. This is
problematic on systems with limited memory resources as Xilinx Zynq
CSE/ZynqMP mini and Versal mini configurations.

The patch is removing additional 4k space.

EFI code is using copy_fdt() which copy FDT to different location.
And all boot commands in case of using U-Boot's FDT pointed by
$fdtcontroladdr are copying FDT to different locations by
image_setup_libfdt().
That's why in proper flow none should modified DTB used by U-Boot that's
why there is no need for additional space.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@ti.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@ti.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 52f24238 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop bootstage.h from common header

Move this fairly uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b67eefdb 10-May-2020 Simon Glass <sjg@chromium.org>

bootstage: Use BOOTSTAGE instead of BOOTSTATE

Some of the enum members are wrong. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@ti.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@ti.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 54280962 09-May-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common/board_f: avoid -Wtype-limits warning

CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with
-Wtype-limits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@ti.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@ti.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# f5b66af2 03-May-2020 Ye Li <ye.li@nxp.com>

common: board_f: Use cpu_get_current_dev in print_cpuinfo

Current print_cpuinfo gets the first udevice in CPU class to return
the cpu info. This has problem if the boot CPU is not fixed.

Changing to use new API cpu_get_current_dev to fix the issue.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@ti.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@ti.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 79926e4f 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 586b15bc 29-Mar-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@ti.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@ti.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 65c141eb 10-Mar-2020 Patrick Delaunay <patrick.delaunay@st.com>

board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>

# a6651086 10-Mar-2020 Patrice Chotard <patrice.chotard@st.com>

board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@ti.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@ti.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# fbf9c154 04-Feb-2020 Ovidiu Panait <ovpanait@gmail.com>

board_f: Make clear_bss generic

clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic
and provide a weak nop stub for it. This also removes arch-specific ifdef
duplications around clear_bss.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@ti.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@ti.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 016e4ae7 22-Jan-2020 Ovidiu Panait <ovpanait@gmail.com>

common/board_f.c: Remove arch-specific checks for cpucheck

This removes the arch-specific checks for "checkcpu" function from the init
sequence. Make "checkcpu" generic and provide a weak nop stub instead.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@ti.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@ti.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# d96c2604 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move clock functions into a new file

These three clock functions don't use driver model and should be migrated.
In the meantime, create a new file to hold them.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@mips.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@mips.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@ti.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@ti.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@mips.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 67c4e9f8 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move board_get_usable_ram_top() out of common.h

Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 30c7c434 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move checkcpu() out of common.h

This function belongs in cpu_func.h so move it over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@imgtec.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@imgtec.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@ti.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@ti.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@imgtec.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@imgtec.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# ac9cd480 21-Oct-2019 Simon Glass <sjg@chromium.org>

bootstage: Correct relocation algorithm

At present bootstage relocation assumes that it is possible to point back
to memory available before relocation, so it does not relocate the
strings. However this is not the case on some platforms, such as x86 which
uses the cache as RAM and loses access to this when the cache is enabled.

Move the relocation step to before U-Boot relocates, expand the allocated
region to include space for the strings and relocate the strings at the
same time as the bootstage records.

This ensures that bootstage data can remain accessible from TPL through
SPL to U-Boot before/after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5074a8a3 21-Oct-2019 Simon Glass <sjg@chromium.org>

bloblist: Reserve an aligned base

Make sure that the bloblist starts on an aligned boundary. This protects
against one of the early allocating causing the alignment to be lost.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@imgtec.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@imgtec.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@ti.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@ti.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@imgtec.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@imgtec.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 5e0404ff 27-Aug-2019 Stephen Warren <swarren@nvidia.com>

board_f: fix noncached reservation calculation

The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>

# 5f7adb5b 16-Aug-2019 Vikas Manocha <vikas.manocha@st.com>

board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>

# f3998fdc 02-Aug-2019 Simon Glass <sjg@chromium.org>

env: Rename environment.h to env_internal.h

This file contains lots of internal details about the environment. Most
code can include env.h instead, calling the functions there as needed.

Rename this file and add a comment at the top to indicate its internal
nature.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fixup apalis-tk1.c]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 9fe657da 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Remove video_setmem()

This function is no-longer defined in U-Boot. Drop the declaration from
common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3c1ecde4 01-Aug-2019 Simon Glass <sjg@chromium.org>

common: Move lcd_setmem() to lcd.h

This function relates to lcd.h and is about to become obsolete with the
driver-model conversion. Move it out of common.h

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7ea33579 14-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: trace buffer may exceed 2GiB

Correct the debug output for the trace buffer size to accommodate trace
buffers exceeding 2GiB.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 7ef8e9b0 01-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: undefined reference to `trace_early_init'

Compiling with TRACE but without TRACE_EARLY results in an error
aarch64-linux-gnu-ld.bfd:
common/built-in.o:(.rodata.init_sequence_f+0x10):
undefined reference to `trace_early_init'

trace_early_init() should not be called if CONFIG_TRACE_EARLY is not
defined.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 10015025 03-May-2019 Trevor Woerner <trevor@toganlabs.com>

CONFIG_SPL_SYS_[DI]CACHE_OFF: add

While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 001d1885 08-Apr-2019 Simon Glass <sjg@chromium.org>

sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

$ grep 0000000000048134 u-boot.map
stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

$ gdb u-boot
...
(gdb) br initcall.h:41
Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

(gdb) r
Starting program: /tmp/b/sandbox/u-boot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

DRAM: 128 MiB
MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
(gdb) print *init_fnc_ptr
$1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
(gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>

# 9450ab2b 05-Dec-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-spi

- Various MTD fixes from Boris
- Zap various unused / legacy paths.
- pxa3xx NAND update from Miquel

Signed-off-by: Tom Rini <trini@konsulko.com>


# 35f9d9bd 24-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Zap CONFIG_HARD_SPI

In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.

So remove the dead instances of CONFIG_HARD_SPI, and related
code.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# fe82ca8f 20-Nov-2018 Jagan Teki <jagan@amarulasolutions.com>

spi: Remove used spi_init

spi_init used in some areas in tree, but the respective
drivers will remove in future patches.

So remove the same instances.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

# b0edea3c 15-Nov-2018 Simon Glass <sjg@chromium.org>

spl: Add support for passing handoff info to U-Boot proper

There is some basic informaton that SPL normally wants to pass through to
U-Boot, such as the SDRAM size and bank information.

Mkae use of the new bloblist structure for this. Add a new 'handoff' blob
which is set up in SPL and passed to U-Boot proper. Also adda test for
sandbox_spl that checks that this works correctly and a new 'sb' command
to show the information passed from SPL.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0293d33 15-Nov-2018 Simon Glass <sjg@chromium.org>

bloblist: Locate bloblist in U-Boot

Add support for locating a bloblist in U-Boot that has been set up by SPL.
It is copied into RAM during relocation.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>

# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>

# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# 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>

# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>

# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>

# a3f77c81 24-Jan-2018 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-coldfire


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list

# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@imgtec.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>

# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)

# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>

# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>

# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# cb33bda4 15-May-2017 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>

# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>

# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>

# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>

# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>

# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>

# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>

# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@imgtec.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 66669fcf 19-Jul-2016 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-fsl-qoriq

Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
arch/arm/cpu/armv8/Makefile
arch/arm/lib/bootm-fdt.c


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>

# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>

# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>

# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>

# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>

# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>

# 4ca0c3c9 06-Nov-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-nios


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>

# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>

# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>

# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>

# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>

# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>

# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

# a538ae99 18-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>

# b79dadf8 10-Mar-2015 Tom Rini <trini@konsulko.com>

Merge branch 'master' of git://git.denx.de/u-boot-tegra

Conflicts:
README

Signed-off-by: Tom Rini <trini@konsulko.com>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>

# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>

# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>

# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c956662c 10-Feb-2015 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-atmel


# e945f6dc 08-May-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>

# 94092e36 24-Nov-2014 Tom Rini <trini@ti.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>

# 746667f1 23-Nov-2014 Tom Rini <trini@ti.com>

Merge git://git.denx.de/u-boot-x86

Conflicts:
arch/x86/cpu/Makefile

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>

# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>

# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 5a1095a8 29-Aug-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://www.denx.de/git/u-boot-imx


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>

# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>

# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>

# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>

# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>

# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)

# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@imgtec.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@imgtec.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>

# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>

# eeb72e67 26-Feb-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Conflicts:
arch/arm/cpu/armv7/config.mk
board/ti/am43xx/mux.c
include/configs/am43xx_evm.h

Signed-off-by: Tom Rini <trini@ti.com>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 7f673c99 10-Jan-2014 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-arm

Bringing in the MMC tree means that CONFIG_BOUNCE_BUFFER needed to be
added to include/configs/exynos5-dt.h now.

Conflicts:
include/configs/exynos5250-dt.h

Signed-off-by: Tom Rini <trini@ti.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>

# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>

# c2120fbf 24-Jul-2013 Tom Rini <trini@ti.com>

Merge branch 'master' of git://git.denx.de/u-boot-i2c

The sandburst-specific i2c drivers have been deleted, conflict was just
over the SPDX conversion.

Conflicts:
board/sandburst/common/ppc440gx_i2c.c
board/sandburst/common/ppc440gx_i2c.h

Signed-off-by: Tom Rini <trini@ti.com>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>

# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>

# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>

# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>

# a0ba279a 26-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>

# b8521b74 21-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>

# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>

# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>

# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>

# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>

# 1473f6ac 09-Oct-2018 Prasanthi Chellakumar <Prasanthi.Chellakumar@microchip.com>

arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>


# ecfe6633 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: cpu: Fix print_cpuinfo() output

It was observed that current output of print_cpuinfo() on QEMU
x86 targets does not have an ending '\n', neither have a leading
'CPU:' any more. However it used to have these before.

It turns out commit c0434407b595 introduced a unified DM version
of print_cpuinfo() that exposed such issue on QEMU x86.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>


# 5d6c61ac 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>


# 5764ea2d 07-Nov-2018 Bin Meng <bmeng.cn@gmail.com>

Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"

This reverts commit c0434407b595f785fc7401237896c48c791b45fd.

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes are already sent to ML and in u-boot-dm/next, however since
we are getting close to the v2018.11 release, it's safer we revert
the original commit.

This commit should be reverted after v2018.11 release.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>


# c0434407 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Use static print_cpuinfo if CONFIG_CPU is active

When the DM CPU drivers are active, printing information about a CPU
should be delegated to a matching driver.

Hence, add a static print_cpuinfo that implements this delegation when
DM CPU drivers are active.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Changed condition to CONFIG_IS_ENABLED(CPU):
Signed-off-by: Simon Glass <sjg@chromium.org>


# 138181a5 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Sort includes

Includes should be sorted.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>


# 23471aed 06-Aug-2018 Mario Six <mario.six@gdsys.cc>

board_f: Add reset status printing

To print the reset status during boot, add a method print_resetinfo to
board_f, which is called in init_sequence_f[], that gets the reset
information from the sysreset driver (assuming there is only one seems
reasonable), and prints it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>


# 1473b12a 16-Jul-2018 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

lib: fdtdec: Update ram_base to store ram start adddress

This patch updates the ram_base to store the start address of
the first bank DRAM and the use this ram_base to calculate ram_top
properly. This patch fixes the erroneous calculation of ram_top
incase of non zero ram start address.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>


# ff2b2ba8 25-May-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: Only reserve memory for U-Boot if we're going to relocate

In case of no relocation we'll just waste some space at the very end
of usable memory area. If target device has very limited amount of memory
(for example 256 kB) this loss will be pretty inconvenient.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>


# 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>


# 264d298f 16-Dec-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

arc: Introduce a possibility to not relocate U-boot

Disabling relocation might be useful on ARC for 2 reasons:
a) For advanced debugging with Synopsys proprietary MetaWare debugger
which is capable of accessing much more specific hardware resources
compared to gdb. For example it may show contents of L1 and L2 caches,
internal states of some hardware blocks etc.

But on the downside MetaWare debugger still cannot work with PIE.
Even though that limitation could be work-arounded with change of ELF's
header and stripping down all debug info but with it we won't have
debug info for source-level debugging which is quite inconvenient.

b) Some platforms which might benefit from usage of U-Boot basically
don't have enough RAM to accommodate relocation of U-Boot so we
keep code in flash and use as much of RAM as possible for more
interesting things.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: York Sun <york.sun@nxp.com>
Cc: Stefan Roese <sr@denx.de>


# b8aa55cb 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move init_helpers.h prototypes in init.h

Merge init_helpers.h in the new file init.h
with only prototypes for init_cache_f_r
used in common/board_f.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# d6f87712 13-Mar-2018 Patrick Delaunay <patrick.delaunay@st.com>

common: move board_f.c prototypes in init.h

Move prototypes for function used in common/board_f.c
from common.h to init.h
Remove weak for arch_reserve_stacks in prototype
(checkpatch issue)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 16ef1474 15-Jan-2018 Mario Six <mario.six@gdsys.cc>

common: board_f: Fix style violations

Fix some style violations in the board_f file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>


# b9153fe3 19-Aug-2017 Angelo Dureghello <angelo@sysam.it>

common/board_f.c: align m68k arch to use CONFIG_DISPLAY_CPUINFO

Change all coldfire arch files to use CONFIG_DISPLAY_CPUINFO.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Changes for v2:
- update common/Kconfig to add M68K to the default y list


# 1fab98fb 17-Jan-2018 Rajesh Bhagat <rajesh.bhagat@nxp.com>

common: board_f: vid: Add VID specific API to adjust core voltage

Adds a VID specific API in init_sequence_f and spl code flow
namely init_func_vid which is required to adjust core voltage.

VID specific code is required in spl, hence moving flag CONFIG_VID
out of spl flags.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>


# 068feb9b 25-Dec-2017 Rick Chen <rick@andestech.com>

riscv: Modify generic codes to support RISC-V

Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>


# af1bc0cf 04-Dec-2017 Simon Glass <sjg@chromium.org>

log: Plumb logging into the init sequence

Set up logging both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>


# c5404b64 04-Dec-2017 Simon Glass <sjg@chromium.org>

Drop the log buffer

This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>


# 5ee94b4f 05-Sep-2017 Simon Glass <sjg@chromium.org>

board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>


# c1ee8936 15-Aug-2017 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

common/board_f.c: remove CONFIG_SYS_GENERIC_GLOBAL_DATA

CONFIG_SYS_GENERIC_GLOBAL_DATA is no longer used by any board or
platform, so support for it can be dropped.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>


# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>


# 60873f73 13-Jul-2017 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board_f: Make reserve_mmu a weak function

Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>


# f1896c45 24-Jul-2017 Andy Yan <andy.yan@rock-chips.com>

spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN

Some platforms have very limited SRAM to run SPL code, so there may
not be the same amount space for a malloc pool before relocation in
the SPL stage as the normal U-Boot stage.

Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN,
so the size of pre-relocation malloc pool can be configured memory
space independently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[fixed up commit-message:]
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>


# 703ec9dd 19-Jun-2017 Paul Burton <paul.burton@imgtec.com>

MIPS: Stop building position independent code

U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.

Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:

8f998064 lw t9,-32668(gp)
0320f809 jalr t9

Without -fpic the call is simply:

0f803f01 jal be00fc04 <puts>

This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.

Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:

3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9

Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.

This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.

Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>


# af9e6ad4 16-Jun-2017 Cooper Jr., Franklin <fcooper@ti.com>

board_f: Add new function to allow runtime DTB selection

Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>


# 98f705c9 27-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc: remove 4xx support

There was for long time no activity in the 4xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 4xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>


# 064b55cf 13-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xxx, 512x: remove support for mpc5xxx and mpc512x

There was for long time no activity in the mpx5xxx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in mpc5xxx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>


# 53207bfd 08-Jun-2017 Lothar Waßmann <LW@KARO-electronics.de>

board_f: fix calculation of reloc_off

relocate_code() calculates the relocation offset wrt. the symbol
__image_copy_start which happens to have the same value as
CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is
convenient to have CONFIG_TEXT_BASE point to the start of the IVT
that is prepended to the actual code. Thus CONFIG_TEXT_BASE will
differ from __image_copy_start, while the calculation
'gd->relocaddr - __image_copy_start' still gives the right relocation
offset.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>


# baa7d345 07-Jun-2017 Simon Glass <sjg@chromium.org>

board_f: Use IS_ENABLED instead of #ifdef in initf_bootstage()

The current implementation makes it look like the 'if (from_spl)' part is
dead code because these features are not enabled for sandbox. We could
enable it for sandbox_spl, but this is not done yet (it requires sharing
memory between SPL and U-Boot proper which is in fact supported).

It is probably nicer to avoid #ifdef anyway. Change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 163244)
Fixes: 824bb1b (bootstage: Support SPL)


# 50258977 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 5xx: remove support for 5xx

There was for long time no activity in the 5xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 5xx,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>


# 2eb48ff7 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8260: remove support for mpc8260

There was for long time no activity in the 8260 area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8260,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>


# 5b8e76c3 07-Jun-2017 Heiko Schocher <hs@denx.de>

powerpc, 8xx: remove support for 8xx

There was for long time no activity in the 8xx area.
We need to go further and convert to Kconfig, but it
turned out, nobody is interested anymore in 8xx,
so remove it (with a heavy heart, knowing that I remove
here the root of U-Boot).

Signed-off-by: Heiko Schocher <hs@denx.de>


# 824bb1b4 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support SPL

At present bootstage only supports U-Boot proper. But SPL can also consume
boot time so it is useful to have the record start there.

Add bootstage support to SPL. Also support stashing the timing information
when SPL finishes so that it can be picked up and reported by U-Boot
proper. This provides a full boot time record, excluding only the time
taken by the boot ROM.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 63c5bf48 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Record the time taken to set up driver model

Driver model is set up ones before relocation and once after. Record the
time taken in each case.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 5ac44a55 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Init as early as possible

At present we don't allow use of bootstage before driver model is running.
This means we cannot time the init of driver model itself.

Now that bootstage requires its own board-specific timer, we can move its
init to earlier in the sequence, both before and after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 25e7dc6a 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Support relocating boostage data

Some boards cannot access pre-relocation data after relocation. Reserve
space for this and copy it during preparation for relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>


# b383d6c0 22-May-2017 Simon Glass <sjg@chromium.org>

bootstage: Convert to use malloc()

At present bootstage uses the data section of the image to store its
information. There are a few problems with this:

- It does not work on all boards (e.g. those which run from flash before
relocation)
- Allocated strings still point back to the pre-relocation data after
relocation

Now that U-Boot has a pre-relocation malloc() we can use this instead,
with a pointer to the data in global_data. Update bootstage to do this and
set up an init routine to allocate the memory.

Now that we have a real init function, we can drop the fake 'reset' record
and add a normal one instead.

Note that part of the problem with allocated strings remains. They are
reallocated but this will only work where pre-relocation memory is
accessible after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>


# b885d02e 17-May-2017 Simon Glass <sjg@chromium.org>

arm: Remove include files from common.h

With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>


# 0ce45287 10-May-2017 Angelo Dureghello <angelo@sysam.it>

board_f: skip timer_init() on Coldfire archs

Coldfire arch is not happy with timer_init since interrupt handlers
are still not set at that stage, and the boot hangs silently.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>


# 69153988 12-May-2017 Simon Glass <sjg@chromium.org>

i2c: Finish dropping use of CONFIG_I2C_HARD

Drop use of this long-deprecated option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>


# f1683aa7 06-Apr-2017 Simon Glass <sjg@chromium.org>

board_f: Rename initdram() to dram_init()

This allows us to use the same DRAM init function on all archs. Add a
dummy function for arc, which does not use DRAM init here.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Dummy function on nios2]
Signed-off-by: Tom Rini <trini@konsulko.com>


# 01abae4d 06-Apr-2017 Tom Rini <trini@konsulko.com>

Remove various unused interrupt related code

With d53ecad92f06 some unused interrupt related code was removed.
However all of these options are currently unused. Rather than migrate
some of these options to Kconfig we just remove the code in question.

The only related code changes here are that in some cases we use
CONFIG_STACKSIZE in non-IRQ related context. In these cases we rename
and move the value local to the code in question.

Fixes: d53ecad92f06 ("Merge branch 'master' of git://git.denx.de/u-boot-sunxi")
Signed-off-by: Tom Rini <trini@konsulko.com>


# 1fbf97dc 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Drop unused headers

These includes don't seem to be needed now. Drop them. Reserve the
mp.h header for PowerPC for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>


# e47b2d67 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make relocation functions generic

This header file is used by three archs. It could be used by all of them
since relocation is a common function. Move it into a generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 96d4b75c 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Make init_helpers generic

This header file is used by two archs. It could be used by all of them
since it allows the cache to be on during relocation. Move it into a
generic file.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e5fb573f 31-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: Move setup_board_extra() into a PPC file

We don't need this PPC-specific function in generic code. Move it to
the powerpc directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>


# 056285fd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move errno.h down to the bottom

This is to keep the header file order consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>


# 47931223 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop unused headers

Drop headers which are not used or needed in this file. The compiler.h
header is included by common.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>


# 76b00aca 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop setup_dram_config() wrapper

By making dram_init_banksize() return an error code we can drop the
wrapper. Adjust this and clean up all implementations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>


# abf7f4c7 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop CONFIG_SPL_BUILD check

This is never defined when building this file, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>


# 0f079eb5 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Put video memory reservation in one function

Move the ugly #ifdefs inside the reserve_video() function so we can
collect all this init into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 80d4bcd3 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Move the extra #ifdef condition into reserve_mmu()

The arch-specific details of the cache being off are best handled inside
the reserve_mmu(). This cleans up the init sequence a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>


# b56db486 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use a single condition for reserve_logbuffer()

CONFIG_ALT_LB_ADDR is really a detail of how this logbuffer is allocated
rather than whether to do it at all. So move the #ifdef into the function.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c67f432e 31-Mar-2017 Simon Glass <sjg@chromium.org>

xtensa: Place relocated U-Boot in the normal place

All archs put U-Boot at the bottom of the relocated region. Xtensa does
not, but perhaps not for any good reason. Adjust it to see if things
still work OK.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 088454cd 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop return value from initdram()

At present we cannot use this function as an init sequence call without a
wrapper, since it returns the RAM size. Adjust it to set the RAM size in
global_data instead, and return 0 on success.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>


# 52c41180 31-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Drop board_type parameter from initdram()

It looks like only cm5200 and tqm8xx use this feature, so we don't really
need it in generic code. Drop it and have the users access gd->board_type
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>


# 76d1d02f 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Use checkcpu() for CPU init

At present we misuse print_cpuinfo() do so CPU init on x86. This is done
because it is the next available call after the console is enabled. But
several arches use checkcpu() instead. Despite the horrible name (which
we can fix), it seems a better choice.

Adjust the various x86 CPU implementations to move their init code into
checkcpu() and use print_cpuinfo() only for printing CPU info.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>


# 8749fa6a 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Make prt_8260_rsr(), prt_8260_clks() private

Move these two function calls into checkcpu(), which is called on this
arch immediately after these two.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>


# 68969778 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()

We don't need a special hook for sandbox as one of the later ones will do
just as well. We can print error messages about bad options after we
print the banner. In fact, it seems better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>


# d891ab95 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Move prt_83xx_rsr() to private code

This function is called just before checkcpu() on MPX83xx. Move it to the
code for that arch.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 727e94a4 28-Mar-2017 Simon Glass <sjg@chromium.org>

powerpc: freescale: Unify the two get_clocks() calls

Combine the conditions so this appears in the init list only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>


# 11b33e64 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Use timer_init() on all archs

More than half of the architectures use this function so let's make them
all use it.

For those which don't actually define it, we can rely on the weak function
in lib/time.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>


# 70e2aaf3 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Use timer_init() instead of init_timebase()

There is no good reason to use a different name on PowerPC. Change it to
timer_init() like the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>


# 1793e782 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Unified get_clocks() portion of init sequence

Now that both branches of the #if do the same thing, we can unify them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>


# 75efc34b 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove adjust_sdram_tbs_8xx() from the init sequence

We can just call this from the only place that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>


# 26345552 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: Remove sdram_adjust_866() from the init sequence

We can just call this from the only function that needs it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>


# d593c616 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Rename get_clocks_866() to get_clocks()

We really don't need to have a name like this in the generic init
sequence. Use the generic get_clocks() name so that we can merge these
two at some point.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>


# c252c068 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: powerpc: Join the two CONFIG_8xx_CPUCLK_DEFAULT sections

We have two chunks of code which depend on this CONFIG options. There is
likely no need to keep them apart, so join them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>


# 671549e5 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: x86: Rename x86_fsp_init() to arch_fsp_init()

While x86 is the only user and this could in principle be moved to
arch_cpu_init() there is some justification for this being a separate
call. It provides a way to handle init which is not CPU-specific, but
must happen before the CPU can be set up.

Rename the function to be more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>


# bb967240 28-Mar-2017 Simon Glass <sjg@chromium.org>

board_f: sandbox: Move setup_ram_buf() to private code

There is no need to have this call in the generic init sequence and no
other architecture has needed it in the time it has been there. Move it
into sandbox's private code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>


# 936478e7 14-Mar-2017 Tom Rini <trini@konsulko.com>

SPARC: Remove

The SPARC architecture is currently unmaintained, remove.

Cc: Francois Retief <fgretief@spaceteq.co.za>
Signed-off-by: Tom Rini <trini@konsulko.com>


# ea3310e8 14-Mar-2017 Tom Rini <trini@konsulko.com>

Blackfin: Remove

The architecture is currently unmaintained, remove.

Cc: Benjamin Matthews <mben12@gmail.com>
Cc: Chong Huang <chuang@ucrobotics.com>
Cc: Dimitar Penev <dpn@switchfin.org>
Cc: Haitao Zhang <hzhang@ucrobotics.com>
Cc: I-SYST Micromodule <support@i-syst.com>
Cc: M.Hasewinkel (MHA) <info@ssv-embedded.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Martin Strubel <strubel@section5.ch>
Cc: Peter Meerwald <devel@bct-electronic.com>
Cc: Sonic Zhang <sonic.adi@gmail.com>
Cc: Valentin Yakovenkov <yakovenkov@niistt.ru>
Cc: Wojtek Skulski <info@skutek.com>
Cc: Wojtek Skulski <skulski@pas.rochester.edu>
Signed-off-by: Tom Rini <trini@konsulko.com>


# 0db4cd25 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>


# 2a792753 22-Feb-2017 mario.six@gdsys.cc <mario.six@gdsys.cc>

dm: Add callback to modify the device tree

Certain boards come in different variations by way of utilizing daughter
boards, for example. These boards might contain additional chips, which
are added to the main board's busses, e.g. I2C.

The device tree support for such boards would either, quite naturally,
employ the overlay mechanism to add such chips to the tree, or would use
one large default device tree, and delete the devices that are actually
not present.

Regardless of approach, even on the U-Boot level, a modification of the
device tree is a prerequisite to have such modular families of boards
supported properly.

Therefore, we add an option to make the U-Boot device tree (the actual
copy later used by the driver model) writeable, and add a callback
method that allows boards to modify the device tree at an early stage,
at which, hopefully, also the application of device tree overlays will
be possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Stefan Roese <sr@denx.de>


# 36cc0de0 06-Mar-2017 York Sun <york.sun@nxp.com>

armv8: layerscape: Rewrite memory reservation

For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved
at the end of DDR. DDR is spit into two or three banks. This patch
reverts commit aabd7ddb and simplifies the calculation of reserved
memory, and moves the code into common SoC file. Secure memory is
carved out first. DDR bank size is reduced. Reserved memory is then
allocated on the top of available memory. U-Boot still has access
to reserved memory as data transferring is needed. Device tree is
fixed with reduced memory size to hide the reserved memory from OS.
The same region is reserved for efi_loader.

Signed-off-by: York Sun <york.sun@nxp.com>


# 6bda55a3 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: Do relocation before clearing BSS

The BSS region may overlap with relocations. If we clear BSS we will
overwrite the start of the relocation area. This doesn't matter when running
from SPI flash, since it is read-only. But when relocating 64-bit U-Boot
from one place in RAM to another, relocation will fail because some of its
relocations have been zeroed.

To fix this, put the ELF fixup call before the BSS clearing call.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>


# 4acff452 16-Jan-2017 Simon Glass <sjg@chromium.org>

board_f/r: Use static const for the init sequences

These tables should be declared static const. Unfortunately the table in
board_r is updated on machines with manual relocation.

Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>


# 530f27ea 16-Jan-2017 Simon Glass <sjg@chromium.org>

x86: board_f: Update init sequence for 64-bit startup

Adjust the code so that 64-bit startup works. Since we don't need to do CAR
changes in U-Boot proper anymore (they are done in SPL) we can simplify the
flow and return normally from board_init_f().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>


# a009f36c 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop prt_mpc5xxx_clks() in favour of print_cpuinfo()

Rather than having an arch-specific function, use the existing generic
one.

Signed-off-by: Simon Glass <sjg@chromium.org>


# cc664000 23-Jan-2017 Simon Glass <sjg@chromium.org>

Drop the static inline print_cpuinfo()

This is only called from one place and the function cannot be inlined.
Convert it to a normal function.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 8f3086aa 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop CONFIG_SYS_ALLOC_DPRAM

This is not defined anywhere in U-Boot. Drop this dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>


# cbcbf71b 23-Jan-2017 Simon Glass <sjg@chromium.org>

powerpc: Drop probecpu() in favour of arch_cpu_init()

To avoid an unnecessary arch-specific call in board_init_f(), rename this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e2099d78 27-Nov-2016 Vladimir Zapolskiy <vz@mleia.com>

common: sh: add necessary define bits to board_f

Since a platform conversion to generic board support has not been
accomplished some architecture specific bits are missing from board_f
init sequence, the change adds a number of basic expected callbacks
into early init sequence.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>


# 006bccbd 25-Sep-2016 Simon Glass <sjg@chromium.org>

board_f: Drop the extra fdtdec_prepare_fdt()

This is already called earlier, from fdtdec_setup(), so drop this unnecessary
call from the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>


# fc0b5948 07-Sep-2016 Robert P. J. Day <rpjday@crashcourse.ca>

Various, accumulated typos collected from around the tree.

Fix various misspellings of:

* deprecated
* partition
* preceding,preceded
* preparation
* its versus it's
* export
* existing
* scenario
* redundant
* remaining
* value
* architecture

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Reviewed-by: Stefan Roese <sr@denx.de>


# 1221ce45 20-Sep-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

treewide: replace #include <asm/errno.h> with <linux/errno.h>

Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content. (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>


# 8ebf5069 21-Sep-2016 Paul Burton <paul.burton@imgtec.com>

board_f: Add a mach_cpu_init callback

Currently we have a mismash of architectures which use arch_cpu_init
from architecture-wide code (arc, avr32, blackfin, mips, nios2, xtensa)
and architectures which use arch_cpu_init from machine/SoC level code
(arm, x86).

In order to clean this mess up & allow for both use cases, introduce a
new mach_cpu_init callback which is run immediately after arch_cpu_init.
This will allow for architectures to have arch-wide code without needing
individual machines to all implement their own arch_cpu_init with a call
to some common function.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Simon Glass <sjg@chromium.org>


# de5e5cea 10-Aug-2016 Chris Zankel <chris@zankel.net>

xtensa: add support for the xtensa processor architecture [1/2]

The Xtensa processor architecture is a configurable, extensible,
and synthesizable 32-bit RISC processor core provided by Cadence.

This is the first part of the basic architecture port with changes to
common files. The 'arch/xtensa' directory, and boards and additional
drivers will be in separate commits.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>


# 50e93b95 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Add tlb_allocated to arch global data

When secure ram is used, MMU tables have to be put into secure ram.
To use common MMU code, gd->arch.tlb_addr will be used to host TLB
entry pointer. To save allocated memory for later use, tlb_allocated
variable is added to global data structure.

Signed-off-by: York Sun <york.sun@nxp.com>


# e61a7534 24-Jun-2016 York Sun <york.sun@nxp.com>

armv8: Move secure_ram variable out of generic global data

Secure_ram variable was put in generic global data. But only ARMv8
uses this variable. Move it to ARM specific data structure.

Signed-off-by: York Sun <york.sun@nxp.com>


# ba169d98 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>


# 46d7a3b3 13-Jun-2016 Anatolij Gustschin <agust@denx.de>

board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>


# b0b35953 14-May-2016 Simon Glass <sjg@chromium.org>

board_f: Don't require CONFIG_SYS_MONITOR_BASE

Allow this to be unset, such that gd->mon_len is invalid. This seems to be
what the sh architecture does.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e4d6ab0c 11-Mar-2016 Simon Glass <sjg@chromium.org>

x86: Allow use of serial soon after relocation

At present on x86 machines with use cache-as-RAM, the memory goes away just
before board_init_r() is called. This means that serial drivers are
no-longer unavailable, until initr_dm() it called, etc.

Any attempt to use printf() within this period will cause a hang.

To fix this, mark the serial devices as 'unavailable' when it is no-longer
available. Bring it back when serial_initialize() is called. This means that
the debug UART will be used instead for this period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>


# 1057e6cf 24-Feb-2016 Simon Glass <sjg@chromium.org>

timer: Set up the real timer after driver model is available

When using the early timer, we need to manually trigger setting up the
real timer. This will not happen automatically. Do this immediately after
starting driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>


# 928f6054 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_MODEM_SUPPORT option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>


# 5a541945 18-Jan-2016 Simon Glass <sjg@chromium.org>

dm: common: Add memory reservation for the video uclass

Before relocation we need to reserve memory for the video driver frame
buffers so that they can use this memory when they start up (after
relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that
it can be checked post-relocation to ensure enough memory is available. No
video device should be probed before relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>


# 8703ef3f 18-Jan-2016 Simon Glass <sjg@chromium.org>

common: Move LCD and video memory reservation together

These two functions are conceptually the same. Move them together in the
pre-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>


# aabd7ddb 07-Dec-2015 York Sun <yorksun@freescale.com>

common: Rewrite hiding the end of memory

As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves
some memory from the end of ram, tracked by gd->ram_size. It is not
always the top of u-boot visible memory. Rewrite the macro with a
weak function to provide flexibility for complex calcuation. Legacy
use of this macro is still supported.

Signed-off-by: York Sun <yorksun@freescale.com>
Reviewed-by: Simon Glass <sjg@chromium.org>


# e8149522 04-Dec-2015 York Sun <yorksun@freescale.com>

Reserve secure memory

Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.

"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.

Signed-off-by: York Sun <yorksun@freescale.com>


# 2317cf09 08-Dec-2015 Bin Meng <bmeng.cn@gmail.com>

common: Remove timer_init() call for x86

With driver model timer support, there should not be an explict
call to timer_init(). Remove this call for x86.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>


# e9acb9ea 03-Dec-2015 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

common: board: Dont relocate FDT incase of CONFIG_OF_EMBED

Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is
already embedded with u-boot image.
Update fdt_blob after relocation as the fdt will be copied
during u-boot relocation.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com> (QEMU x86)
Tested-by: Thomas Chou <thomas@wytron.com.tw> (Nios2)
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Simon Glass <sjg@chromium.org>


# 1e85ccec 23-Nov-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update PROM initialization code for generic board

Fixed the prom_relocate() function in start.S file by reserving memory in
the board_init_f sequence and saving the offset to the __prom_start_reloc
variable. This value is used as the destination when relocating the PROM.

Add the prom_init() function to the end of the board_init_r sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>


# c97088c3 28-Oct-2015 Francois Retief <fgretief@spaceteq.co.za>

sparc: Update cpu_init.c to use generic timer infrastructure

Introduce the CONFIG_SYS_TIMER_* macros in include/asm/config.h to make use
of the generic timer infrastructure in lib/time.c.

Created a timer_init() function to initialize the timer hardware and update
the #ifdef in board_init_f to allow this function to be called during the
start-up sequence.

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>


# 9854a874 08-Nov-2015 Simon Glass <sjg@chromium.org>

console: Add a console buffer

It is useful to be able to record console output and provide console input
via a buffer. This provides sandbox with the ability to run a command and
check its output. If the console is set to silent then no visible output
is generated.

This also provides a means to fix the problem where tests produce unwanted
output, such as errors or warnings. This can be confusing. We can instead
set the console to silent and record this output. It can be checked later
in the test if required.

It is possible that this may prove useful for non-test situations. For
example the console output may be suppressed for normal operations, but
recorded and stored for access by the OS. That feature is not implemented
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 24b852a7 08-Nov-2015 Simon Glass <sjg@chromium.org>

Move console definitions into a new console.h file

The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 67521957 30-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

common/board_f.c: move mark_bootstage after arch_cpu_init_dm

As mark_bootstage() uses timer, it should go after driver model
is initialized.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>


# 643b0f75 22-Oct-2015 Bin Meng <bmeng.cn@gmail.com>

x86: Move timer_init() call a bit earlier

Currently timer_init() is called in board_r.c which is quite late.
Some vgabios execution requires we set up the i8254 timer correctly,
but video initialization comes before timer_init(). Move the call
to board_f.c.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>


# 7664846b 30-Oct-2015 Peng Fan <Peng.Fan@freescale.com>

common: Simplify get_clocks() #ifdef

get_clocks is wrapped by CONFIG_FSL_CLK and CONFIG_M68K in seperate
piece code. They can be merged into one snippet.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: "angelo@sysam.it" <angelo@sysam.it>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: "Andreas Bießmann" <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@sysam.it>


# fb3db635 01-Nov-2015 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: enable setup_board_part1() for MIPS

The variables bd_t:bi_memstart and bd_t:bi_memsize have to be
initialized also on MIPS. Otherwise LMB and cmd_bdinfo do not
correctly work. This currently breaks the booting of FIT images
on MIPS. Enable the board_init_f hook setup_board_part1()
for MIPS to fix this.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>


# bbfdff31 26-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: use common sequence for reserve_uboot

Use common sequence for reserve_uboot, as the result is
the same.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>


# 18fb0e3c 26-Oct-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: change the macro name and remove it for PPC platforms

For most PPC platforms, they will call the first get_clocks() in
init_sequence_f[] as they define CONFIG_PPC. CONFIG_SYS_FSL_CLK is
then defined to call the second get_clocks(), which should be
redundant for PPC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>


# 677f970b 09-Sep-2015 Gong Qianyu <Qianyu.Gong@freescale.com>

common/board_f.c: modify the macro to use get_clocks() more common

get_clocks() should not be limited by ESDHC.

Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>


# af6bbd4d 19-Oct-2015 Simon Glass <sjg@chromium.org>

Move board_init_f_mem() into a common location

This function will be used by both SPL and U-Boot proper. So move it into
a common place. Also change the #ifdef so that the early malloc() area is
not set up in SPL if CONFIG_SYS_SPL_MALLOC_START is defined. In that case
it would never actually be used, and just chews up stack space.

Signed-off-by: Simon Glass <sjg@chromium.org>


# a54915d8 22-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: convert altera timer to driver model

Convert altera timer to driver model.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Chin Liang See <clsee@altera.com>


# fea7f3aa 08-Oct-2015 Thomas Chou <thomas@wytron.com.tw>

nios2: Switch to generic timer

Zap almost all of the ad-hoc timer code from interrupts.c and
use the code in lib/time.c instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>


# 2e88bb28 24-Aug-2015 Kun-Hua Huang <kunhua@andestech.com>

NDS32: Generic Board Support and Unsupport

Add nds32 ag101p generic board support.

Signed-off-by: Kun-Hua Huang <kunhua@andestech.com>


# a52a068e 20-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Delay x86_fsp_init() call a little bit

Move x86_fsp_init() call after initf_malloc() so that we can fix up
the gd->malloc_limit later.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>


# 2212e69b 17-Aug-2015 Simon Glass <sjg@chromium.org>

Revert "Align global_data to a 16-byte boundary"

This causes widespread breakage due to the operation of the low-level code
in crt0.S and cro0_64.S for ARM at least.

The fix is not complicated but it seems safer to revert this for now.

This reverts commit 2afddae07523f23f77acd066ad1719f53d289f98.
Signed-off-by: Simon Glass <sjg@chromium.org>


# f0c7d9c7 10-Aug-2015 Simon Glass <sjg@chromium.org>

x86: Switch to using generic global_data setup

There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.

Drop the unneeded code and adjust the hooks in board_f.c to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>


# 1fed87db 10-Aug-2015 Simon Glass <sjg@chromium.org>

Allow arch-specific setting of global_data in board_init_f_mem()

At present we have a simple assignment to gd. With some archs this is
implemented as a register or through some other means; a simple assignment
does not suit in all cases.

Change this to a function and add documentation to describe how this all
works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>


# 2afddae0 10-Aug-2015 Simon Glass <sjg@chromium.org>

Align global_data to a 16-byte boundary

Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>


# 715f599f 06-Aug-2015 Bin Meng <bmeng.cn@gmail.com>

common: Display >=4GiB memory bank size

bd->bi_dram[] has both start address and size defined as 32-bit,
which is not the case on some platforms where >=4GiB memory bank
is used. Change them to support such memory banks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>


# f05ad9ba 04-Aug-2015 Simon Glass <sjg@chromium.org>

Add a way to skip relocation

When running U-Boot as an EFI application we cannot relocate since we do not
have relocation information. U-Boot has already been relocated to a suitable
address.

Add a global_data flag to control skipping relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>


# 9b217498 31-Jul-2015 Ben Stoltz <stoltz@google.com>

efi: Avoid using non-existent text base

When U-Boot runs as an EFI application is does not have a definition of
CONFIG_SYS_TEXT_BASE. U-Boot is a relocatable application and the relocation
is done by EFI. U-Boot can be loaded at any address.

This is similar to how sandbox works. Adjust the early board init to deal
with this.

Signed-off-by: Ben Stoltz <stoltz@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>


# aefaff8e 06-Jun-2015 Bin Meng <bmeng.cn@gmail.com>

x86: fsp: Move FspInitEntry call to board_init_f()

The call to FspInitEntry is done in arch/x86/lib/fsp/fsp_car.S so far.
It worked pretty well but looks not that good. Apart from doing too
much work than just enabling CAR, it cannot read the configuration
data from device tree at that time. Now we want to move it a little
bit later as part of init_sequence_f[] being called by board_init_f().
This way it looks and works better in the U-Boot initialization path.

Due to FSP's design, after calling FspInitEntry it will not return to
its caller, instead it jumps to a continuation function which is given
by bootloader with a new stack in system memory. The original stack in
the CAR is gone, but its content is perserved by FSP and described by
a bootloader temporary memory HOB. Technically we can recover anything
we had before in the previous stack, but that is way too complicated.
To make life much easier, in the FSP continuation routine we just
simply call fsp_init_done() and jump back to car_init_ret() to redo
the whole board_init_f() initialization, but this time with a non-zero
HOB list pointer saved in U-Boot's global data so that we can bypass
the FspInitEntry for the second time.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Andrew Bradford <andrew.bradford@kodakalaris.com>
Tested-by: Simon Glass <sjg@chromium.org>


# 4c509343 28-Apr-2015 Simon Glass <sjg@chromium.org>

Fix comment nits in board_f.c

Try to make it a little clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>


# fb5cf7f1 27-Feb-2015 Simon Glass <sjg@chromium.org>

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 0879361f 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: Rename setup_fdt() and make it prepare also

There is little reason to split these two functions. Bring them together
which simplifies the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>


# b45122fd 27-Feb-2015 Simon Glass <sjg@chromium.org>

fdt: sandbox: Move setup code from board_f to fdtdec

We want to be able to set up the device tree in SPL, so move this code
to a common place.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 0eb25b61 22-Mar-2015 Joe Hershberger <joe.hershberger@ni.com>

common: Make sure arch-specific map_sysmem() is defined

In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>


# d4c671cc 05-Mar-2015 Simon Glass <sjg@chromium.org>

dm: Add a new CPU init function which can use driver model

Since driver model is set up after arch_cpu_init(), that function cannot
use drivers. Add a new arch_cpu_init_dm() function which is called
immediately after driver model is ready, and can reference devices.

This can be used to probe essential devices for the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>


# 3fb80163 24-Feb-2015 Alexey Brodkin <abrodkin@synopsys.com>

arc: clean-up init procedure

Intention behind this work was elimination of as much assembly-written
code as it is possible.

In case of ARC we already have relocation fix-up implemented in C so why
don't we use C for U-Boot copying, .bss zeroing etc.

It turned out x86 uses pretty similar approach so we re-used parts of
code in "board_f.c" initially implemented for x86.

Now assembly usage during init is limited to stack- and frame-pointer
setup before and after relocation.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>


# 944ab340 28-Mar-2015 angelo@sysam.it <angelo@sysam.it>

m68k: fix 3 broken boards

Fix eb_cpu5282 and eb_cpu5282_internal unresolved external error.
These boards have video but don't need any ppc related
video_setmem().

Fix M53017EVB moving away embedded env to a different offset,
as in M52277EVB.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>


# 5bcd19aa 24-Mar-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: move board_init_f_mem() from #else CONFIG_X86

Purpose of this change is to make it possible to re-use code currently
used on X86 solely for other architectures. For example:
* init_sequence_f_r
* board_init_f_r

Even though board_init_f_mem() has nothing to do with any particular
architecture it won't work (at least in current implementation) for X86.

This is because on X86 "gd" is an alias to function get_fs_gd_ptr(),
thus we cannot assign anything to it.

So this change separates selection of board_init_f_mem() from X86 while
keeping it disabled for X86 still.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>


# 14a380a8 10-Mar-2015 Stefan Roese <sr@denx.de>

common/board_f.c: Enable IMX watchdog in init_func_watchdog_init()

Without this patch, the IMX watchdog will not be initialized. And therefor
not active. This patch fixes this by calling hw_watchdog_init() also when
CONFIG_IMX_WATCHDOG is defined.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>


# 7bf9f20d 25-Feb-2015 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

common/board_f: implement type casting for gd structure

In case of global data structure defined as "register volatile" compiler
throws an warning about incorrect type used:
--->8---
common/board_f.c: In function "board_init_f_r":
common/board_f.c:1073:2: warning: passing argument 1 of "&board_init_r
+(sizetype)gd->reloc_off" discards "volatile" qualifier from pointer
target type [enabled by default]
(board_init_r + gd->reloc_off)(gd, gd->relocaddr);
^
common/board_f.c:1073:2: note: expected "struct gd_t *" but argument is
of type "volatile struct gd_t *"
--->8---

An obvious fix is manual casting to "gd_t *".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>


# 1313db48 12-Feb-2015 Alison Wang <b18965@freescale.com>

m68k: Add generic board support for MCF547X/8X and MCF5445X

This patch adds generic board support for MCF547X/8X and MCF5445X.
It is based on the patch about common generic board support for
M68K architecture sent by Angelo.

Signed-off-by: Alison Wang <alison.wang@freescale.com>


# e310b93e 11-Feb-2015 angelo@sysam.it <angelo@sysam.it>

m68k: add generic-board support

Add generic-board support for the m68k architecture.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>


# 1e4d11a5 23-Dec-2014 Stephen Warren <swarren@nvidia.com>

common: board: support systems with where RAM ends beyond 4GB

Some systems have so much RAM that the end of RAM is beyond 4GB. An
example would be a Tegra124 system (where RAM starts at 2GB physical)
that has more than 2GB of RAM.

In this case, we can gd->ram_size to represent the actual RAM size, so
that the actual RAM size is passed to the OS. This is useful if the OS
implements LPAE, and can actually use the "extra" RAM.

However, U-Boot does not implement LPAE and so must deal with 32-bit
physical addresses. To this end, we enhance board_get_usable_ram_top() to
detect the "over-sized" case, and limit the relocation addres so that it
fits into 32-bits of physical address space.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>


# a752a8b4 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

avr32: add generic board support

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>


# 68145d4c 06-Feb-2015 Andreas Bießmann <andreas.devel@googlemail.com>

common/board_f: factor out reserve_stacks

Introduce arch_reserve_stacks() to tailor gd->start_addr_sp and gd->irq_sp to
the architecture needs.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>


# 74d01867 07-Feb-2015 Simon Glass <sjg@chromium.org>

Introduce board_init_f_mem() to handle early memory layout

At present on some architectures we set up the following before calling
board_init_f():

- global_data
- stack
- early malloc memory

Adding the code to support early malloc and global data setup to every
arch's assembler start-up is a pain. Also this code is not actually
architecture-specific. We can use common code for all architectures and
with a bit of care we can write this code in C.

Add a new function to deal with this. It should be called after memory
is available, with a pointer to the top of the area that should be used
before relocation. The function will set things up and return the lowest
memory address that it allocated/used. That can then be set as the top
of the stack.

Note that on some archs this function will use the stack, so the stack
pointer should be set to same value as is pased to board_init_f_mem().
A margin of 128 bytes will be left for this stack, so that it is not
overwritten. This means that 64 bytes is wasted by this early call.
This is not strictly necessary on several more modern archs, so we could
remove this at the cost of some arch-dependent code.

With this function there is no-longer any need for the assembler code to
zero global_data or set up the early malloc pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e945f6dc 08-May-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Move architecture to use generic board init

Compile code with -fPIC to get GOT. Do not build SPL
with fPIC because it increasing SPL size for nothing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# 2b8b38ea 21-Jan-2015 Heiko Schocher <hs@denx.de>

common/board_f: add at91 wdt

call hw_watchdog_init() also if CONFIG_AT91SAM9_WATCHDOG
is used.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>


# 0365ffcc 14-Jan-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic-board: show model name in board_init_f() too

The common/board_r.c has show_model_r() to display the model name
if the DTB has a "model" property. It sounds useful to have a similar
function in common/board_f.c too because most of the boards show
their board name before relocation.

Instead of implementing the same function in both common/board_f.c
and common/board_r.c, let's split it up into common/show_board_info.c.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>


# 146251f8 19-Jan-2015 Simon Glass <sjg@chromium.org>

Allow architecture-specific memory reservation

All memory to be reserved for use after relocation by adding a new call
to perform this reservation.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 313aef37 01-Jan-2015 Simon Glass <sjg@chromium.org>

x86: board_f: Adjust x86 boot order for performance

For bare platforms we turn off ROM-caching before calling board_init_f_r()
It is then very slow to copy U-Boot from ROM to RAM. So adjust the order so
that the copying happens before we turn off ROM-caching.

Signed-off-by: Simon Glass <sjg@chromium.org>


# d210718d 09-Dec-2014 Kevin Hilman <khilman@linaro.org>

common/board_f.c: fix compile error when tracing disabled

When CONFIG_TRACE is disabled, linking fails with:

common/built-in.o:(.data.init_sequence_f+0x8): undefined reference to `trace_early_init'

To fix, wrap the call to trace_early_init() with #ifdef CONFIG_TRACE.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>


# 94092e36 24-Nov-2014 Tom Rini <trini@ti.com>

Revert "common/board_f: add setup of initial stack frame for MIPS"

Daniel discovered a better solution to the problem this was solving, so
don't do what this patch was doing anymore.

This reverts commit 666ba8444e81c3785a427ae6922e2feededab9a3.

Signed-off-by: Tom Rini <trini@ti.com>


# 96b1046d 17-Nov-2014 Suriyan Ramasami <suriyan.r@gmail.com>

sandbox: Prepare API change for files greater than 2GB

Change the internal sandbox functions to use loff_t for file offsets.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>


# 9fdee7d7 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: fix gcc warning on MIPS64

This fixes following warning when compiled with MIPS64

common/board_f.c: In function 'display_text_info':
common/board_f.c:150:2: warning: format '%X' expects argument i
of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>


# 666ba844 15-Nov-2014 Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

common/board_f: add setup of initial stack frame for MIPS

The MIPS specific setup of the initial stack frame was not
ported to generic board_f.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>


# 003504b6 10-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Remove unnecessary find_fdt(), prepare_fdt() functions

These are no-longer needed so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>


# 768e0f52 10-Nov-2014 Simon Glass <sjg@chromium.org>

Move early malloc() to before arch_cpu_init()

For some CPUs, having malloc() available very early is useful. There is no
reason to delay this since early malloc is allocated before board_init_f()
is called.

Move early malloc() init nearer to the start of the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 8b37c769 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard arch_cpu_init() function

Instead of an x86-specific cpu_init_f() function, use the normal U-Boot one
for this purpose. Also remove a useless/misleading comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>


# 07387d17 06-Nov-2014 Simon Glass <sjg@chromium.org>

x86: Use the standard dram_init() function

Instead of having an x86-specific DRAM init function, adjust things so we
can use the normal one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>


# dd2a6cd0 08-Oct-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board: use __weak

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>


# c970dffe 06-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: do not set gd->fdt_blob unless CONFIG_OF_CONTROL=y

gd->fdt_blob is used for FDT control of U-Boot.
If CONFIG_OF_CONTROL is not defined, it is useless.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>


# ec3b4820 03-Sep-2014 Gabriel Huau <leirbag2311@gmail.com>

common: fix include guards for CONFIG_MP

This was breaking the build for some boards:
MPC8536DS MPC8536DS_36BIT MPC8536DS_SDCARD MPC8536DS_SPIFLASH qemu-ppce500

Include only these features for some PPC boards if the configuration for MultiProcessor
is enabled.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Cc: Tom Rini <trini@ti.com>
Cc: York Sun <yorksun@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>


# 3ea0953d 03-Sep-2014 Simon Glass <sjg@chromium.org>

dm: Move pre-reloc init earlier to cope with board_early_init_f()

In order to support GPIO access in board_early_init_f() we must set up
driver model before this function is called. In any case, earlier is
better since driver model is (or will become) a key function for most
init.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 5ff10aa7 21-Aug-2014 Thomas Chou <thomas@wytron.com.tw>

nios2: add generic board support

This patch implements the generic board init as described in
doc/README.generic-board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Scott McNutt <smcnutt@psyent.com>
Reviewed-by: Stefan Roese <sr@denx.de>


# a76df709 26-Jul-2014 Gabriel Huau <contact@huau-gabriel.fr>

mx6: add support of multi-processor command

This allows u-boot to load different OS or Bare Metal application on
different cores of the i.MX6 SoC.
For example: running Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.

Signed-off-by: Gabriel Huau <contact@huau-gabriel.fr>
Acked-by: Stefano Babic <sbabic@denx.de>


# d54d7eb9 17-Jul-2014 Sonic Zhang <sonic.zhang@analog.com>

support blackfin board initialization in generic board_f

- init hardware watchdog if applicable
- use CONFIG_SYS_MONITOR_LEN as the gd monitor len for Blackfin
- reserve u-boot memory at the top field of the RAM for Blackfin
- avoid refer to CONFIG_SYS_MONITOR_LEN, which is not defined by Blackfin

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>


# ab7cd627 23-Jul-2014 Simon Glass <sjg@chromium.org>

dm: Support driver model prior to relocation

Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass <sjg@chromium.org>


# d59476b6 10-Jul-2014 Simon Glass <sjg@chromium.org>

Add a simple malloc() implementation for pre-relocation

If we are to have driver model before relocation we need to support some
way of calling memory allocation routines.

The standard malloc() is pretty complicated:

1. It uses some BSS memory for its state, and BSS is not available before
relocation

2. It supports algorithms for reducing memory fragmentation and improving
performace of free(). Before relocation we could happily just not support
free().

3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since
this has been loaded anyway this is not really a problem.

The simplest way to support pre-relocation malloc() is to reserve an area
of memory and allocate it in increasing blocks as needed. This
implementation does this.

To enable it, you need to define the size of the malloc() pool as described
in the README. It will be located above the pre-relocation stack on
supported architectures.

Note that this implementation is only useful on machines which have some
memory available before dram_init() is called - this includes those that
do no DRAM init (like tegra) and those that do it in SPL (quite a few
boards). Enabling driver model preior to relocation for the rest of the
boards is left for a later exercise.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c5d4001a 23-Jun-2014 Jeroen Hofstee <jeroen@myspectrum.nl>

common: board_f: cosmetic use __weak for leds

First of all this looks a lot better, but it also
prevents a gcc warning (W=1), that the weak function
has no previous prototype.

cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>


# fa39ffe5 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Fix size variable

DRAM size should use 64-bit variable when the size could be more than 4GB.
Caught and verified on P4080DS with 4GB DDR.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>


# 2a1680e3 02-May-2014 York Sun <yorksun@freescale.com>

common/board_f: Initialized global data for generic board

Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>


# 8e261575 04-Apr-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

bd_info: remove bi_barudrate member from struct bd_info

gd->bd->bi_baudrate is a copy of gd->baudrate.

Since baudrate is a common feature for all architectures,
keep gd->baudrate only.

It is true that bi_baudrate was passed to the kernel in that structure
but it was a long time ago.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu> (For microblaze)


# 6dc9bace 07-Apr-2014 Paul Burton <paul.burton@imgtec.com>

board_f: call timer_init on MIPS

MIPS needs a call to timer_init to preserve its current behaviour
ensuring that the cop0 compare register is initialised appropriately.

Reported-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>


# 3da7e5a5 07-Apr-2014 Paul Burton <paul.burton@imgtec.com>

board_f: call init_func_ram on MIPS

Assigning gd->ram_size the return value of initdram matches the existing
MIPS board behaviour.

Suggested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>


# 95fac6ab 27-Feb-2014 Simon Glass <sjg@chromium.org>

sandbox: Use os functions to read host device tree

At present we use U-Boot's filesystem layer to read the sandbox device tree,
but this is problematic since it relies on a temporary feauture added
there. Since we plan to implement proper block layer support for sandbox,
change this code to use the os layer functions instead. Also use the new
fdt_create_empty_tree() instead of our own code.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 58dac327 05-Mar-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

powerpc: mpc8260: consolidate CONFIG_MPC8260 and CONFIG_8260

Before this commit, CONFIG_MPC8260 and CONFIG_8260
were used mixed-up.

All boards with mpc8260 cpu defined both of them:
- CONFIG_MPC8260 was defined in board config headers
and include/common.h
- CONFIG_8260 was defined arch/powerpc/cpu/mpc8260/config.mk

We do not need to have both of them.
This commit keeps only CONFIG_MPC8260.

This commit does:
- Delete CONFIG_8260 and CONFIG_MPC8260 definition
in config headers and include/common.h
- Rename CONFIG_8260 to CONFIG_MPC8260
in arch/powerpc/cpu/mpc8260/config.mk.
- Rename #ifdef CONFIG_8260 to #ifdef CONFIG_MPC8260

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Wolfgang Denk <wd@denx.de>


# b60eff31 22-Feb-2014 Albert ARIBAUD <albert.u.boot@aribaud.net>

arm: remove unneeded symbol offsets and _TEXT_BASE

Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>


# e3866163 11-Feb-2014 York Sun <yorksun@freescale.com>

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.

Signed-off-by: York Sun <yorksun@freescale.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>


# 365475e6 13-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee

- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h

- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c

- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h

- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>


# 6ab6b2af 04-Feb-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

dts: re-write dts/Makefile more simply with Kbuild

Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.

We do not need to parse a linker script to get output format and arch.

This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>


# cce6be7f 13-Dec-2013 David Feng <fenghua@phytium.com.cn>

arm64: generic board support

Signed-off-by: David Feng <fenghua@phytium.com.cn>


# 5c2859cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow reading/writing of RAM buffer

It is useful to be able to save and restore the RAM contents of sandbox
U-Boot either for setting up tests, for later analysys, or for chaining
together multiple tests which need to keep the same memory contents.

Add a function to provide a memory file for U-Boot. This is read on
start-up and written when shutting down. If the file does not exist
on start-up, it will be created when shutting down.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>


# 808434cd 10-Nov-2013 Simon Glass <sjg@chromium.org>

sandbox: Allow return from board_init_f()

The execution flow becomes easier if we can return from board_init_f()
as ARM does. We can control things from start.c instead of having to
call back into that file from other places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>


# 9aed5a27 27-Nov-2013 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

board_f: explicitly disable console on early boot

If U-Boot build with DEBUG enabled/defined the first call of "debug"
function (that dumps data to any available console) will happen before
zeroing of initial "gd" in init call "zero_global_data" in
"init_sequence_f".

And if stack was not filled with zeros chances are high that
"gd->have_console" won't be 0. In its turn it will cause attempt to
output things to non-initialized yet serial console.

So for safety and predictability we set "gd->have_console = 0".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>


# 815a76f2 21-Sep-2013 trem <tremyfr@yahoo.fr>

i2c: fix init on generic board

On generic board, the i2c init initialize only
one bus. But the new i2c subsystem allow to
manage severals i2c bus. So in the case, instead
of initializing a bus, we just set the current
i2c bus. The initialization will be done in
the i2c command.

Signed-off-by: Philippe Reynes <tremyfr@yahoo.fr>


# 1a459660 08-Jul-2013 Wolfgang Denk <wd@denx.de>

Add GPL-2.0+ SPDX-License-Identifier to source files

Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>


# ea818dbb 29-Jan-2013 Heiko Schocher <hs@denx.de>

i2c, soft-i2c: switch to new multibus/multiadapter support

- added to soft_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>


# 3f4978c7 16-Jan-2012 Heiko Schocher <hs@denx.de>

i2c: common changes for multibus/multiadapter support

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
Cc: Henrik Nordström <henrik@henriknordstrom.net>


# 71c52dba 11-Jun-2013 Simon Glass <sjg@chromium.org>

Add trace support to generic board

Add hooks for tracing to generic board, including:

- allow early tracing to start early as possible in U-Boot
- reserve memory for trace buffer
- copy early trace buffer to main trace buffer after relocation
- setup full tracing support after relocation

Signed-off-by: Simon Glass <sjg@chromium.org>


# a0ba279a 26-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

generic_board: reduce the redundancy of gd_t struct members

This commit refactors common/board_f.c and common/board_r.c
in order to delete the dest_addr and dest_addr_sp from
gd_t struct.

As mentioned as follows in include/asm-generic/global_data.h,

/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */

dest_addr is the same as relocaddr.
Likewise, dest_addr_sp is the same as start_addr_sp.

It seemed dest_addr/dest_addr_sp was used only as a scratch variable
to calculate relocaddr/start_addr_sp, respectively.

With a little refactoring, we can delete dest_addr and dest_addr_sp.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Simon Glass <sjg@chromium.org>


# b8521b74 21-May-2013 Masahiro Yamada <yamada.m@jp.panasonic.com>

common: board_f: Do not call board_postclk_init twice

The generic-board board_init_f function called board_postclk_init twice.

The first one came from arch/arm/lib/board.c, while the second one
from arch/powerpc/lib/board.c.

This commit deletes the first occurrence.
In addition, the second get_clocks call is moved after
board_postclk_init in order to keep the function call order
both for ARM and PowerPC.
ARM board calles get_clocks function after board_postclk_init.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>


# d6ed3222 10-May-2013 Wolfgang Denk <wd@denx.de>

Power: remove support for Freescale MPC8220

The Freescale MPC8220 Power Architecture processors have long reached
EOL; Freescale does not even list these any more on their web site.

Remove the code to avoid wasting maitaining efforts on dead stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andy Fleming <afleming@gmail.com>


# d2eae43b 18-Apr-2013 Andreas Bießmann <andreas.devel@googlemail.com>

lib: consolidate hang()

Delete all occurrences of hang() and provide a generic function.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Modify check around puts() in hang.c slightly]
Signed-off-by: Tom Rini <trini@ti.com>


# f828bf25 20-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass <sjg@chromium.org>


# a733b06b 25-Apr-2013 Simon Glass <sjg@chromium.org>

sandbox: Switch over to generic board

Add generic board support for sandbox. and remove the old board init code.

Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>


# 7525c2da 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Allow setup code to manage its own global data

Currently x86 has its own means of managing the global data and board data
(bd_t), and this code resides in start.S. With generic board, we need to
ensure that we leave this alone - i.e. don't clear it as we do on other
archs.

This fixes a problem where the memory init data is cleared which causes
the video driver to operate very slowly.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 8b42dfc3 15-Apr-2013 Simon Glass <sjg@chromium.org>

x86: Fix DRAM bank size init with generic board

The intention of the memory init code is that it should work the same with
CONFIG_SYS_GENERIC_BOARD and without. This is tricky because dram_init()
is called prior to relocation with generic board (matching other archs)
and after relocation without generic board.

Adjust the init sequence so that dram_init() is not called in the generic
board case, which seems like the easiest fix for now. Also ensure that
relocation addresses are still calculated.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 3d389101 09-Apr-2013 Vadim Bendebury <vbendeb@chromium.org>

Do not call board_early_init_f() twice

Apparently due to a missed rebase conflict resolution
board_early_init_f() is included twice in the list of initialization
functions.

Leave only the first occurrence.
. built and boot an Exynos 5250 target

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>


# 48a33806 05-Mar-2013 Simon Glass <sjg@chromium.org>

x86: Adjust board_f.c for x86

For x86, things have adjusted somewhat since this series was originally
written. It has its own way of running through initcalls which is actually
nicer than others archs.

Unfortunately this does introduce exceptions. We will soon require use of
generic board on x86, but until then we need to fit in with what is there,
and treat x86 as a special case.

Signed-off-by: Simon Glass <sjg@chromium.org>


# e4fef6cf 11-Mar-2013 Simon Glass <sjg@chromium.org>

Adjust board_f.c for ppc

This adds ppc features to the generic pre-relocation board init.

This is a separate commit so that these features are clearly shown.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 632efa74 11-Mar-2013 Simon Glass <sjg@chromium.org>

Add CONFIG_SYS_SYM_OFFSETS to support offset symbols

Link symbols as created by the link script can either be absolute or
relative to the text start. This option switches between the two options
so that we can support both.

As we convert architectures over to generic board, we can see if this
option is actually needed, or whether it is possible to unify this feature
also.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 8cae8a68 05-Mar-2013 Simon Glass <sjg@chromium.org>

Add spl load feature

This adds secondary program loader support to the generic board.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 1938f4a5 11-Mar-2013 Simon Glass <sjg@chromium.org>

Introduce generic pre-relocation board_f.c

This file handles common pre-relocation init for boards which use
the generic framework.

It starts up the console, DRAM, performs relocation and then jumps
to post-relocation init.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>