History log of /u-boot/arch/microblaze/cpu/start.S
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 7ac50f88 11-Mar-2023 Ovidiu Panait <ovpanait@gmail.com>

microblaze: drop remnants of manual reloc

Runtime relocation has been made the default for microblaze, so do the
following cleanups:
- drop all manual reloc codepaths in start.S
- drop all STATIC_RELA ifdefs, as it is now enabled unconditionally in
Kconfig

Reviewed-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Link: https://lore.kernel.org/r/20230311173838.521804-5-ovpanait@gmail.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

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

# c316ee67 27-Jun-2022 Tom Rini <trini@konsulko.com>

Merge tag 'xilinx-for-v2022.10' of https://source.denx.de/u-boot/custodians/u-boot-microblaze into next

Xilinx changes for v2022.10

cpu:
- Add driver for microblaze cpu

net:
- Add support for DM_ETH_PHY to AXI emac and emaclite

xilinx:
- Switch platforms to DM_ETH_PHY
- DT chagnes in ZynqMP and Zynq
- Enable support for SquashFS

zynqmp:
- Add support for KR260 boards
- Move BSS from address 0
- Move platform identification from board code to soc driver
- Improve zynqmp_psu_init_minimize

versal:
- Enable loading app at EL1

serial:
- Setup default address and clock rates for DEBUG uarts

pinctrl:
- Add support for tri state and output enable properties

relocate-rela:
- Clean relocate-rela implementation for ARM64
- Add support for Microblaze

microblaze:
- Add support for runtime relocation
- Rework cache handling (wiring, Kconfig) based on cpuinfo
- Remove interrupt support

timer:
- Extract axi timer driver from Microblaze to generic location


# 95b7a8fd 31-May-2022 Ovidiu Panait <ovpanait@gmail.com>

microblaze: cache: introduce cpuinfo structure

Introduce a minimal cpuinfo structure to hold cache related info. The
instruction/data cache size and cache line size are initialized early in
the boot to default Kconfig values. They will be overwritten with data
from PVR/dtb if the microblaze UCLASS_CPU driver is enabled.

The cpuinfo struct was placed in global_data to allow the microblaze
UCLASS_CPU driver to also run before relocation (initialized global data
should be read-only before relocation).

gd_cpuinfo() helper macro was added to avoid volatile
"-Wdiscarded-qualifiers" warnings when using the pointer directly.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Link: https://lore.kernel.org/r/20220531181435.3473549-10-ovpanait@gmail.com
Signed-off-by: Michal Simek <michal.simek@amd.com> (s/bralid/brlid/)

# b1951349 31-May-2022 Ovidiu Panait <ovpanait@gmail.com>

microblaze: cache: introduce flush_cache_all()

All flush_cache() calls in microblaze code are supposed to flush the
entire instruction and data caches, so introduce flush_cache_all()
helper to handle this.

Also, provide implementations for flush_dcache_all() and
invalidate_icache_all() so that icache and dcache u-boot commands can
work.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Link: https://lore.kernel.org/r/20220531181435.3473549-9-ovpanait@gmail.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 84488fc6 31-May-2022 Ovidiu Panait <ovpanait@gmail.com>

microblaze: cache: introduce Kconfig options for icache/dcache sizes

Replace XILINX_DCACHE_BYTE_SIZE macro with two Kconfig symbols for
instruction and data caches sizes, respectively:
CONFIG_XILINX_MICROBLAZE0_ICACHE_SIZE
CONFIG_XILINX_MICROBLAZE0_DCACHE_SIZE

Also, get rid of the hardcoded value in icache_disable().

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Link: https://lore.kernel.org/r/20220531181435.3473549-8-ovpanait@gmail.com
Signed-off-by: Michal Simek <michal.simek@amd.com> (s/bralid/brlid/g)

# 130fae2d 31-May-2022 Ovidiu Panait <ovpanait@gmail.com>

microblaze: start.S: remove unused code

in16/out16 routines seem to not be used anywhere in microblaze code, so
remove them.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Link: https://lore.kernel.org/r/20220531181435.3473549-3-ovpanait@gmail.com
Signed-off-by: Michal Simek <michal.simek@amd.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

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

microblaze: Create SYM_ADDR macro to deal with symbols

Symbol handling depends on compilation flags. Right now manual relocation
is used that's why symbols can be referenced just by name and there is no
need to find them out. But when position independent code (PIC) is used
symbols need to be described differently. That's why having one macro
change is easier than changing the whole code.

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

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

microblaze: Add comment about reset location

Better to add comment to explain why reset vector points all the time to
origin U-Boot location.
If reset happens U-Boot should start from it's origin location.

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

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

microblaze: Remove _start symbol handling at U-Boot start

Right now U-Boot runs all the time from the same address where it is loaded
but going to full relocation code starting address doesn't need to be fixed
and can be simply discovered from reading PC register. That's why use r20
to get PC address and subtract offset from the beginning to get starting
address.

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

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

microblaze: Remove code around r20 in relocate_code()

r20 is not used that's why remove logic around it.

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

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

microblaze: Optimize register usage in relocate_code

There are additional operations which can be done simpler that's why
improve logic around relocation address r7 handling and _start symbol.

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

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

microblaze: Change stack protection address to new stack address

SLR low address is still setup to 0 that's why only high limit should be
updated. STACK_SIZE macro is present and could be possible used for
low address alignment but it is not done by this patch.

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

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

microblaze: Separate code end substraction

Follow up patch will convert symbol handling that's why it is necessary to
separate logic around symbols to special instruction. It adds 4B for new
instruction but it is worth to do it to have code ready for for full
relocation.

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

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

microblaze: Remove CONFIG_TEXT_BASE from code

Use symbol instead macro to find where U-Boot starts.

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

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

microblaze: Fix early stack allocation

CONFIG_SYS_INIT_SP_OFFSET macro place stack to TEXT_BASE - SYS_MALLOC_F_LEN
but there is no reason to do it now because board_init_f_alloc_reserve()
returns exact location where stack should be. That's why stack location is
calculated at run time and there is no need to hardcode it via macro. This
change will help with placing U-Boot to any address.

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

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

microblaze: Fix stack protection behavior

When U-Boot starts stack protection can be already enabled that's why setup
the lowest possible SLR value which is address 0. And the highest possible
stack in front of U-Boot. That's why you should never load U-Boot to the
beginning of DDR. There must be some space reserved. Code is using this
location for early malloc space, early global data and stack.

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

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

microblaze: Switch absolute branches to relative

There is no reason to use absolute branches and use just relative. This
change helps with moving binary to different location and start it from
there.

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

# f113d7d3 26-May-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SPL_STACK to Kconfig

This converts the following to Kconfig:
CONFIG_SPL_STACK

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

# f149ee4c 30-Nov-2021 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: start.S: add support for configurable vector base address

Current code assumes that the vector base address is always at 0x0.
However, this value is configurable for MicroBlaze, so update the
__setup_exceptions routine to work with any vector base address.

The r4 register is reserved for the vector base address inside
__setup_exceptions and the function prologe/epilogue are also updated to
save and restore r4.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Link: https://lore.kernel.org/r/20211130163358.2531677-9-ovidiu.panait@windriver.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 83b175be 30-Nov-2021 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: migrate CONFIG_SYS_USR_EXCEP to Kconfig

Migrate CONFIG_SYS_USR_EXCEP to Kconfig. Also, rename it to
XILINX_MICROBLAZE0_USR_EXCEP in order to match the naming convention of
microblaze-generic Kconfig options.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Link: https://lore.kernel.org/r/20211130163358.2531677-7-ovidiu.panait@windriver.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 70c68712 30-Nov-2021 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: drop CONFIG_SYS_RESET_ADDRESS macro

Microblaze is one the last two users of the CONFIG_SYS_RESET_ADDRESS
macro (the other is arch/powerpc/cpu/mpc8xx/cpu.c, but the macro is not
defined anywhere in powerpc code, so it should be removed there too).

Replace CONFIG_SYS_RESET_ADDRESS usage in start.S with
CONFIG_SYS_TEXT_BASE. If the reset address should really be
user-configurable, a new Kconfig option could be added.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Link: https://lore.kernel.org/r/20211130163358.2531677-6-ovidiu.panait@windriver.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 48039c33 30-Nov-2021 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: start.S: use stack space as scratch memory for endian offset

To simpify the code, use stack space as scratch memory for endian offset
calculation, rather than saving/restoring the first unused MB vector.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Link: https://lore.kernel.org/r/20211130163358.2531677-5-ovidiu.panait@windriver.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# edf0f9b1 30-Nov-2021 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: u-boot.lds: replace __end symbol with _end

board_fdt_blob_setup() uses the _end symbol to find the dtb in the non-spl
case. In order to allow microblaze builds to compile successfully with
CONFIG_OF_SEPARATE, the _end symbol must be defined. Align microblaze with
the other architectures and use _end symbol rather than __end to mark the
end of the u-boot binary.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Link: https://lore.kernel.org/r/20211130163358.2531677-2-ovidiu.panait@windriver.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# f5d8b1a1 24-Sep-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: start.S: Use board_init_f_alloc/init in early init

Implement early init by calling generic board_init_f_alloc_reserve and
board_init_f_init_reserve functions:
* drop SYS_MALLOC_F_LEN related code, as allocation and gd->malloc_base
assignment are taken care of by the generic functions
* drop _gd logic

Cc: Michal Simek <monstr@monstr.eu>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 627085ea 24-Sep-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: start.S: Factor out exception setup code to __setup_exceptions

Currently, the exceptions setup code is duplicated in pre-relocation and
post-relocation init. Factor out this code to __setup_exceptions asm
routine to get rid of the duplication.

__setup_exceptions is called with a relocation offset parameter (r5)
which is set to zero for pre-reloc init and gd->reloc_off for post-reloc
exception setup.

Cc: Michal Simek <monstr@monstr.eu>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 3ad95ed6 20-Oct-2019 Michal Simek <michal.simek@amd.com>

microblaze: Fix tab indentation in start.S

Use tab instead of spaces.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

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

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

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

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

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

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

microblaze: spl: configure SYS_MALLOC_F_LEN independently for SPL and full U-Boot

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

# 1d82e2c1 29-Jan-2017 Michal Simek <michal.simek@amd.com>

microblaze: Fix endif macro command

Use correct name in endif comment.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 48470b7a 09-Dec-2015 Michal Simek <michal.simek@amd.com>

microblaze: Wire-up debug_uart in asm

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# ecc30663 25-Nov-2015 Albert ARIBAUD <albert.u.boot@aribaud.net>

Fix board init code to respect the C runtime environment

board_init_f_mem() alters the C runtime environment's
stack it is actually already using. This is not a valid
behaviour within a C runtime environment.

Split board_init_f_mem into C functions which do not alter
their own stack and always behave properly with respect to
their C runtime environment.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Thomas Chou <thomas@wytron.com.tw>

# cd2bee35 19-Oct-2015 Simon Glass <sjg@chromium.org>

microblaze: Add a TODO to call board_init_f_mem()

This C function should be used to do the early memory layout and init. This
is beyond my powers, so just add a TODO for the maintainer.

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

# ca7d2266 03-Feb-2015 Michal Simek <michal.simek@amd.com>

microblaze: spl: Do not call mem_malloc_init and use early alloc

This patch has some parts connected together:
- Use _gd in bss section which is automatically cleared
Location at SPL_MALLOC_END wasn't cleared at all
- Use MALLOC_F_LEN(early alloc) instead of FULL MALLOC
(mem_malloc_init is not called at all)
- Simplify malloc and stack init.
At the end of SPL addr is malloc area and below is stack

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 405e651d 30-Jan-2015 Michal Simek <michal.simek@amd.com>

microblaze: Add support for CONFIG_SYS_MALLOC_F_LEN

Create space for dm_init where calloc is called
and malloc_base has to be initialized.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 0510b14b 30-Jan-2015 Michal Simek <michal.simek@amd.com>

microblaze: Do not use CONFIG_SYS_GENERIC_GLOBAL_DATA

Because it is not compatible with DM where
malloc_base has to be available early and init
has to be done in ASM.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c4dd542 27-Jan-2015 Michal Simek <michal.simek@amd.com>

microblaze: Speedup code copy

Remove one instruction in the loop which speedup
code copying.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

# 9cef20b1 27-Jan-2015 Michal Simek <michal.simek@amd.com>

microblaze: Fix gd_t address which is placed at the end of BRAM

Setup gd from ASM to be availalbe for board_init_r.
Setting it up in spl_board_init is too late when
MALLOC is used.
Space for gd is located behind MALLOC area at the end of BRAM.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# e4a4743e 26-Jan-2015 Michal Simek <michal.simek@amd.com>

microblaze: Remove unused asm label

It is not used at all that's why remove it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# da931af1 04-Nov-2014 Michal Simek <michal.simek@amd.com>

microblaze: Support stack protection feature

Ensure that stack didn't rewrite important part
of u-boot.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 822d43a6 04-Nov-2014 Michal Simek <michal.simek@amd.com>

microblaze: Enable hardware exception by default

Enable hardware exception by default to be able to
handle it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 9d242745 20-Jan-2014 Michal Simek <michal.simek@amd.com>

microblaze: Add SPL support

Add support for U-BOOT SPL. NOR and RAM mode are supported.
There are 3 images in NOR flash. u-boot.img, dtb and kernel.

Signed-off-by: Michal Simek <michal.simek@xilinx.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>

# 5811830f 25-Sep-2012 Michal Simek <michal.simek@xilinx.com>

microblaze: Flush caches before enabling them

Flushing caches is necessary because of soft reset
which doesn't clear caches.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Reviewed-by: Marek Vasut <marex@denx.de>

# 2380b8f5 04-Jul-2012 Michal Simek <michal.simek@xilinx.com>

microblaze: Clean microblaze initialization

Move board specific function to board_init function in board/ folder
Remove externs from generic board.c
Use board_init_f function in board.c file.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Acked-by: Stephan Linz <linz@li-pro.net>

# 575a3d21 10-Jul-2012 Michal Simek <michal.simek@xilinx.com>

microblaze: intc: Clear interrupt code

Clear and prepare for device-tree driven configuration.
Remove CONFIG_SYS_INTC_0 definition
Use dynamic allocation instead of static.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Acked-by: Simon Glass <sjg@chromium.org>

# 5562bcc2 30-Aug-2011 Michal Simek <michal.simek@xilinx.com>

microblaze: Clean up reset asm code

- Remove code copying
- Reset address is setup from first stage bootloader
- Support reset vector setup on little endian

Signed-off-by: Michal Simek <monstr@monstr.eu>

# f3090fce 15-Nov-2010 Michal Simek <michal.simek@xilinx.com>

microblaze: Save and restore first unused vector

Use one memory space to detect little/big endian platforms.
The first unused address(0x28) is used instead 0x0 address (reset vectors).
Detection rewrited reset vector setup from first stage bootloader.

Workflow:
1. Store 0x28 to r7
2. Do little/big endian test
3. Restore r7 to 0x28

Signed-off-by: Michal Simek <monstr@monstr.eu>

# 86c1b2a8 21-Jul-2011 Michal Simek <michal.simek@xilinx.com>

microblaze: Setup MB vectors if feature is enable for u-boot

For example: Setup reset vectors if reset address is setup.
Setup user exception vector if user exception is enabled

Signed-off-by: Michal Simek <monstr@monstr.eu>

# dfc10703 21-Jul-2011 Michal Simek <michal.simek@xilinx.com>

microblaze: Remove debug saving value

Forget to remove debug code.

Signed-off-by: Michal Simek <monstr@monstr.eu>

# 071bc923 27-Oct-2010 Wolfgang Denk <wd@denx.de>

Coding Style cleanup

Signed-off-by: Wolfgang Denk <wd@denx.de>

# 25ddd1fb 26-Oct-2010 Wolfgang Denk <wd@denx.de>

Replace CONFIG_SYS_GBL_DATA_SIZE by auto-generated value

CONFIG_SYS_GBL_DATA_SIZE has always been just a bad workarond for not
being able to use "sizeof(struct global_data)" in assembler files.
Recent experience has shown that manual synchronization is not
reliable enough. This patch renames CONFIG_SYS_GBL_DATA_SIZE into
GENERATED_GBL_DATA_SIZE which gets automatically generated by the
asm-offsets tool. In the result, all definitions of this value can be
deleted from the board config files. We have to make sure that all
files that reference such data include the new <asm-offsets.h> file.

No other changes have been done yet, but it is obvious that similar
changes / simplifications can be done for other, related macro
definitions as well.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Acked-by: Kumar Gala <galak@kernel.crashing.org>

# 14d0a02a 07-Oct-2010 Wolfgang Denk <wd@denx.de>

Rename TEXT_BASE into CONFIG_SYS_TEXT_BASE

The change is currently needed to be able to remove the board
configuration scripting from the top level Makefile and replace it by
a simple, table driven script.

Moving this configuration setting into the "CONFIG_*" name space is
also desirable because it is needed if we ever should move forward to
a Kconfig driven configuration system.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# b98cba09 12-Aug-2010 Michal Simek <michal.simek@xilinx.com>

microblaze: Support little-endian microblaze target

Microblaze little-endian toolchain should export
__MICROBLAZEEL__.

Signed-off-by: Michal Simek <monstr@monstr.eu>

# 6260fb04 12-Apr-2010 Peter Tyser <ptyser@xes-inc.com>

microblaze: Move cpu/microblaze/* to arch/microblaze/cpu/*

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

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

# c316ee67 27-Jun-2022 Tom Rini <trini@konsulko.com>

Merge tag 'xilinx-for-v2022.10' of https://source.denx.de/u-boot/custodians/u-boot-microblaze into next

Xilinx changes for v2022.10

cpu:
- Add driver for microblaze cpu

net:
- Add support for DM_ETH_PHY to AXI emac and emaclite

xilinx:
- Switch platforms to DM_ETH_PHY
- DT chagnes in ZynqMP and Zynq
- Enable support for SquashFS

zynqmp:
- Add support for KR260 boards
- Move BSS from address 0
- Move platform identification from board code to soc driver
- Improve zynqmp_psu_init_minimize

versal:
- Enable loading app at EL1

serial:
- Setup default address and clock rates for DEBUG uarts

pinctrl:
- Add support for tri state and output enable properties

relocate-rela:
- Clean relocate-rela implementation for ARM64
- Add support for Microblaze

microblaze:
- Add support for runtime relocation
- Rework cache handling (wiring, Kconfig) based on cpuinfo
- Remove interrupt support

timer:
- Extract axi timer driver from Microblaze to generic location


# 95b7a8fd 31-May-2022 Ovidiu Panait <ovpanait@gmail.com>

microblaze: cache: introduce cpuinfo structure

Introduce a minimal cpuinfo structure to hold cache related info. The
instruction/data cache size and cache line size are initialized early in
the boot to default Kconfig values. They will be overwritten with data
from PVR/dtb if the microblaze UCLASS_CPU driver is enabled.

The cpuinfo struct was placed in global_data to allow the microblaze
UCLASS_CPU driver to also run before relocation (initialized global data
should be read-only before relocation).

gd_cpuinfo() helper macro was added to avoid volatile
"-Wdiscarded-qualifiers" warnings when using the pointer directly.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Link: https://lore.kernel.org/r/20220531181435.3473549-10-ovpanait@gmail.com
Signed-off-by: Michal Simek <michal.simek@amd.com> (s/bralid/brlid/)

# b1951349 31-May-2022 Ovidiu Panait <ovpanait@gmail.com>

microblaze: cache: introduce flush_cache_all()

All flush_cache() calls in microblaze code are supposed to flush the
entire instruction and data caches, so introduce flush_cache_all()
helper to handle this.

Also, provide implementations for flush_dcache_all() and
invalidate_icache_all() so that icache and dcache u-boot commands can
work.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Link: https://lore.kernel.org/r/20220531181435.3473549-9-ovpanait@gmail.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 84488fc6 31-May-2022 Ovidiu Panait <ovpanait@gmail.com>

microblaze: cache: introduce Kconfig options for icache/dcache sizes

Replace XILINX_DCACHE_BYTE_SIZE macro with two Kconfig symbols for
instruction and data caches sizes, respectively:
CONFIG_XILINX_MICROBLAZE0_ICACHE_SIZE
CONFIG_XILINX_MICROBLAZE0_DCACHE_SIZE

Also, get rid of the hardcoded value in icache_disable().

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Link: https://lore.kernel.org/r/20220531181435.3473549-8-ovpanait@gmail.com
Signed-off-by: Michal Simek <michal.simek@amd.com> (s/bralid/brlid/g)

# 130fae2d 31-May-2022 Ovidiu Panait <ovpanait@gmail.com>

microblaze: start.S: remove unused code

in16/out16 routines seem to not be used anywhere in microblaze code, so
remove them.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Link: https://lore.kernel.org/r/20220531181435.3473549-3-ovpanait@gmail.com
Signed-off-by: Michal Simek <michal.simek@amd.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

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

microblaze: Create SYM_ADDR macro to deal with symbols

Symbol handling depends on compilation flags. Right now manual relocation
is used that's why symbols can be referenced just by name and there is no
need to find them out. But when position independent code (PIC) is used
symbols need to be described differently. That's why having one macro
change is easier than changing the whole code.

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

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

microblaze: Add comment about reset location

Better to add comment to explain why reset vector points all the time to
origin U-Boot location.
If reset happens U-Boot should start from it's origin location.

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

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

microblaze: Remove _start symbol handling at U-Boot start

Right now U-Boot runs all the time from the same address where it is loaded
but going to full relocation code starting address doesn't need to be fixed
and can be simply discovered from reading PC register. That's why use r20
to get PC address and subtract offset from the beginning to get starting
address.

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

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

microblaze: Remove code around r20 in relocate_code()

r20 is not used that's why remove logic around it.

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

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

microblaze: Optimize register usage in relocate_code

There are additional operations which can be done simpler that's why
improve logic around relocation address r7 handling and _start symbol.

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

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

microblaze: Change stack protection address to new stack address

SLR low address is still setup to 0 that's why only high limit should be
updated. STACK_SIZE macro is present and could be possible used for
low address alignment but it is not done by this patch.

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

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

microblaze: Separate code end substraction

Follow up patch will convert symbol handling that's why it is necessary to
separate logic around symbols to special instruction. It adds 4B for new
instruction but it is worth to do it to have code ready for for full
relocation.

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

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

microblaze: Remove CONFIG_TEXT_BASE from code

Use symbol instead macro to find where U-Boot starts.

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

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

microblaze: Fix early stack allocation

CONFIG_SYS_INIT_SP_OFFSET macro place stack to TEXT_BASE - SYS_MALLOC_F_LEN
but there is no reason to do it now because board_init_f_alloc_reserve()
returns exact location where stack should be. That's why stack location is
calculated at run time and there is no need to hardcode it via macro. This
change will help with placing U-Boot to any address.

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

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

microblaze: Fix stack protection behavior

When U-Boot starts stack protection can be already enabled that's why setup
the lowest possible SLR value which is address 0. And the highest possible
stack in front of U-Boot. That's why you should never load U-Boot to the
beginning of DDR. There must be some space reserved. Code is using this
location for early malloc space, early global data and stack.

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

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

microblaze: Switch absolute branches to relative

There is no reason to use absolute branches and use just relative. This
change helps with moving binary to different location and start it from
there.

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

# f113d7d3 26-May-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SPL_STACK to Kconfig

This converts the following to Kconfig:
CONFIG_SPL_STACK

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

# f149ee4c 30-Nov-2021 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: start.S: add support for configurable vector base address

Current code assumes that the vector base address is always at 0x0.
However, this value is configurable for MicroBlaze, so update the
__setup_exceptions routine to work with any vector base address.

The r4 register is reserved for the vector base address inside
__setup_exceptions and the function prologe/epilogue are also updated to
save and restore r4.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Link: https://lore.kernel.org/r/20211130163358.2531677-9-ovidiu.panait@windriver.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 83b175be 30-Nov-2021 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: migrate CONFIG_SYS_USR_EXCEP to Kconfig

Migrate CONFIG_SYS_USR_EXCEP to Kconfig. Also, rename it to
XILINX_MICROBLAZE0_USR_EXCEP in order to match the naming convention of
microblaze-generic Kconfig options.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Link: https://lore.kernel.org/r/20211130163358.2531677-7-ovidiu.panait@windriver.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 70c68712 30-Nov-2021 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: drop CONFIG_SYS_RESET_ADDRESS macro

Microblaze is one the last two users of the CONFIG_SYS_RESET_ADDRESS
macro (the other is arch/powerpc/cpu/mpc8xx/cpu.c, but the macro is not
defined anywhere in powerpc code, so it should be removed there too).

Replace CONFIG_SYS_RESET_ADDRESS usage in start.S with
CONFIG_SYS_TEXT_BASE. If the reset address should really be
user-configurable, a new Kconfig option could be added.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Link: https://lore.kernel.org/r/20211130163358.2531677-6-ovidiu.panait@windriver.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 48039c33 30-Nov-2021 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: start.S: use stack space as scratch memory for endian offset

To simpify the code, use stack space as scratch memory for endian offset
calculation, rather than saving/restoring the first unused MB vector.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Link: https://lore.kernel.org/r/20211130163358.2531677-5-ovidiu.panait@windriver.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# edf0f9b1 30-Nov-2021 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: u-boot.lds: replace __end symbol with _end

board_fdt_blob_setup() uses the _end symbol to find the dtb in the non-spl
case. In order to allow microblaze builds to compile successfully with
CONFIG_OF_SEPARATE, the _end symbol must be defined. Align microblaze with
the other architectures and use _end symbol rather than __end to mark the
end of the u-boot binary.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Link: https://lore.kernel.org/r/20211130163358.2531677-2-ovidiu.panait@windriver.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# f5d8b1a1 24-Sep-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: start.S: Use board_init_f_alloc/init in early init

Implement early init by calling generic board_init_f_alloc_reserve and
board_init_f_init_reserve functions:
* drop SYS_MALLOC_F_LEN related code, as allocation and gd->malloc_base
assignment are taken care of by the generic functions
* drop _gd logic

Cc: Michal Simek <monstr@monstr.eu>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 627085ea 24-Sep-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: start.S: Factor out exception setup code to __setup_exceptions

Currently, the exceptions setup code is duplicated in pre-relocation and
post-relocation init. Factor out this code to __setup_exceptions asm
routine to get rid of the duplication.

__setup_exceptions is called with a relocation offset parameter (r5)
which is set to zero for pre-reloc init and gd->reloc_off for post-reloc
exception setup.

Cc: Michal Simek <monstr@monstr.eu>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 3ad95ed6 20-Oct-2019 Michal Simek <michal.simek@amd.com>

microblaze: Fix tab indentation in start.S

Use tab instead of spaces.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

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

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

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

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

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

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

microblaze: spl: configure SYS_MALLOC_F_LEN independently for SPL and full U-Boot

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

# 1d82e2c1 29-Jan-2017 Michal Simek <michal.simek@amd.com>

microblaze: Fix endif macro command

Use correct name in endif comment.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 48470b7a 09-Dec-2015 Michal Simek <michal.simek@amd.com>

microblaze: Wire-up debug_uart in asm

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# ecc30663 25-Nov-2015 Albert ARIBAUD <albert.u.boot@aribaud.net>

Fix board init code to respect the C runtime environment

board_init_f_mem() alters the C runtime environment's
stack it is actually already using. This is not a valid
behaviour within a C runtime environment.

Split board_init_f_mem into C functions which do not alter
their own stack and always behave properly with respect to
their C runtime environment.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Thomas Chou <thomas@wytron.com.tw>

# cd2bee35 19-Oct-2015 Simon Glass <sjg@chromium.org>

microblaze: Add a TODO to call board_init_f_mem()

This C function should be used to do the early memory layout and init. This
is beyond my powers, so just add a TODO for the maintainer.

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

# ca7d2266 03-Feb-2015 Michal Simek <michal.simek@amd.com>

microblaze: spl: Do not call mem_malloc_init and use early alloc

This patch has some parts connected together:
- Use _gd in bss section which is automatically cleared
Location at SPL_MALLOC_END wasn't cleared at all
- Use MALLOC_F_LEN(early alloc) instead of FULL MALLOC
(mem_malloc_init is not called at all)
- Simplify malloc and stack init.
At the end of SPL addr is malloc area and below is stack

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 405e651d 30-Jan-2015 Michal Simek <michal.simek@amd.com>

microblaze: Add support for CONFIG_SYS_MALLOC_F_LEN

Create space for dm_init where calloc is called
and malloc_base has to be initialized.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 0510b14b 30-Jan-2015 Michal Simek <michal.simek@amd.com>

microblaze: Do not use CONFIG_SYS_GENERIC_GLOBAL_DATA

Because it is not compatible with DM where
malloc_base has to be available early and init
has to be done in ASM.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c4dd542 27-Jan-2015 Michal Simek <michal.simek@amd.com>

microblaze: Speedup code copy

Remove one instruction in the loop which speedup
code copying.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

# 9cef20b1 27-Jan-2015 Michal Simek <michal.simek@amd.com>

microblaze: Fix gd_t address which is placed at the end of BRAM

Setup gd from ASM to be availalbe for board_init_r.
Setting it up in spl_board_init is too late when
MALLOC is used.
Space for gd is located behind MALLOC area at the end of BRAM.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# e4a4743e 26-Jan-2015 Michal Simek <michal.simek@amd.com>

microblaze: Remove unused asm label

It is not used at all that's why remove it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# da931af1 04-Nov-2014 Michal Simek <michal.simek@amd.com>

microblaze: Support stack protection feature

Ensure that stack didn't rewrite important part
of u-boot.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 822d43a6 04-Nov-2014 Michal Simek <michal.simek@amd.com>

microblaze: Enable hardware exception by default

Enable hardware exception by default to be able to
handle it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 9d242745 20-Jan-2014 Michal Simek <michal.simek@amd.com>

microblaze: Add SPL support

Add support for U-BOOT SPL. NOR and RAM mode are supported.
There are 3 images in NOR flash. u-boot.img, dtb and kernel.

Signed-off-by: Michal Simek <michal.simek@xilinx.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>

# 5811830f 25-Sep-2012 Michal Simek <michal.simek@xilinx.com>

microblaze: Flush caches before enabling them

Flushing caches is necessary because of soft reset
which doesn't clear caches.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Reviewed-by: Marek Vasut <marex@denx.de>

# 2380b8f5 04-Jul-2012 Michal Simek <michal.simek@xilinx.com>

microblaze: Clean microblaze initialization

Move board specific function to board_init function in board/ folder
Remove externs from generic board.c
Use board_init_f function in board.c file.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Acked-by: Stephan Linz <linz@li-pro.net>

# 575a3d21 10-Jul-2012 Michal Simek <michal.simek@xilinx.com>

microblaze: intc: Clear interrupt code

Clear and prepare for device-tree driven configuration.
Remove CONFIG_SYS_INTC_0 definition
Use dynamic allocation instead of static.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Acked-by: Simon Glass <sjg@chromium.org>

# 5562bcc2 30-Aug-2011 Michal Simek <michal.simek@xilinx.com>

microblaze: Clean up reset asm code

- Remove code copying
- Reset address is setup from first stage bootloader
- Support reset vector setup on little endian

Signed-off-by: Michal Simek <monstr@monstr.eu>

# f3090fce 15-Nov-2010 Michal Simek <michal.simek@xilinx.com>

microblaze: Save and restore first unused vector

Use one memory space to detect little/big endian platforms.
The first unused address(0x28) is used instead 0x0 address (reset vectors).
Detection rewrited reset vector setup from first stage bootloader.

Workflow:
1. Store 0x28 to r7
2. Do little/big endian test
3. Restore r7 to 0x28

Signed-off-by: Michal Simek <monstr@monstr.eu>

# 86c1b2a8 21-Jul-2011 Michal Simek <michal.simek@xilinx.com>

microblaze: Setup MB vectors if feature is enable for u-boot

For example: Setup reset vectors if reset address is setup.
Setup user exception vector if user exception is enabled

Signed-off-by: Michal Simek <monstr@monstr.eu>

# dfc10703 21-Jul-2011 Michal Simek <michal.simek@xilinx.com>

microblaze: Remove debug saving value

Forget to remove debug code.

Signed-off-by: Michal Simek <monstr@monstr.eu>

# 071bc923 27-Oct-2010 Wolfgang Denk <wd@denx.de>

Coding Style cleanup

Signed-off-by: Wolfgang Denk <wd@denx.de>

# 25ddd1fb 26-Oct-2010 Wolfgang Denk <wd@denx.de>

Replace CONFIG_SYS_GBL_DATA_SIZE by auto-generated value

CONFIG_SYS_GBL_DATA_SIZE has always been just a bad workarond for not
being able to use "sizeof(struct global_data)" in assembler files.
Recent experience has shown that manual synchronization is not
reliable enough. This patch renames CONFIG_SYS_GBL_DATA_SIZE into
GENERATED_GBL_DATA_SIZE which gets automatically generated by the
asm-offsets tool. In the result, all definitions of this value can be
deleted from the board config files. We have to make sure that all
files that reference such data include the new <asm-offsets.h> file.

No other changes have been done yet, but it is obvious that similar
changes / simplifications can be done for other, related macro
definitions as well.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Acked-by: Kumar Gala <galak@kernel.crashing.org>

# 14d0a02a 07-Oct-2010 Wolfgang Denk <wd@denx.de>

Rename TEXT_BASE into CONFIG_SYS_TEXT_BASE

The change is currently needed to be able to remove the board
configuration scripting from the top level Makefile and replace it by
a simple, table driven script.

Moving this configuration setting into the "CONFIG_*" name space is
also desirable because it is needed if we ever should move forward to
a Kconfig driven configuration system.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# b98cba09 12-Aug-2010 Michal Simek <michal.simek@xilinx.com>

microblaze: Support little-endian microblaze target

Microblaze little-endian toolchain should export
__MICROBLAZEEL__.

Signed-off-by: Michal Simek <monstr@monstr.eu>

# 6260fb04 12-Apr-2010 Peter Tyser <ptyser@xes-inc.com>

microblaze: Move cpu/microblaze/* to arch/microblaze/cpu/*

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

# c316ee67 27-Jun-2022 Tom Rini <trini@konsulko.com>

Merge tag 'xilinx-for-v2022.10' of https://source.denx.de/u-boot/custodians/u-boot-microblaze into next

Xilinx changes for v2022.10

cpu:
- Add driver for microblaze cpu

net:
- Add support for DM_ETH_PHY to AXI emac and emaclite

xilinx:
- Switch platforms to DM_ETH_PHY
- DT chagnes in ZynqMP and Zynq
- Enable support for SquashFS

zynqmp:
- Add support for KR260 boards
- Move BSS from address 0
- Move platform identification from board code to soc driver
- Improve zynqmp_psu_init_minimize

versal:
- Enable loading app at EL1

serial:
- Setup default address and clock rates for DEBUG uarts

pinctrl:
- Add support for tri state and output enable properties

relocate-rela:
- Clean relocate-rela implementation for ARM64
- Add support for Microblaze

microblaze:
- Add support for runtime relocation
- Rework cache handling (wiring, Kconfig) based on cpuinfo
- Remove interrupt support

timer:
- Extract axi timer driver from Microblaze to generic location


# 95b7a8fd 31-May-2022 Ovidiu Panait <ovpanait@gmail.com>

microblaze: cache: introduce cpuinfo structure

Introduce a minimal cpuinfo structure to hold cache related info. The
instruction/data cache size and cache line size are initialized early in
the boot to default Kconfig values. They will be overwritten with data
from PVR/dtb if the microblaze UCLASS_CPU driver is enabled.

The cpuinfo struct was placed in global_data to allow the microblaze
UCLASS_CPU driver to also run before relocation (initialized global data
should be read-only before relocation).

gd_cpuinfo() helper macro was added to avoid volatile
"-Wdiscarded-qualifiers" warnings when using the pointer directly.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Link: https://lore.kernel.org/r/20220531181435.3473549-10-ovpanait@gmail.com
Signed-off-by: Michal Simek <michal.simek@amd.com> (s/bralid/brlid/)

# b1951349 31-May-2022 Ovidiu Panait <ovpanait@gmail.com>

microblaze: cache: introduce flush_cache_all()

All flush_cache() calls in microblaze code are supposed to flush the
entire instruction and data caches, so introduce flush_cache_all()
helper to handle this.

Also, provide implementations for flush_dcache_all() and
invalidate_icache_all() so that icache and dcache u-boot commands can
work.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Link: https://lore.kernel.org/r/20220531181435.3473549-9-ovpanait@gmail.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 84488fc6 31-May-2022 Ovidiu Panait <ovpanait@gmail.com>

microblaze: cache: introduce Kconfig options for icache/dcache sizes

Replace XILINX_DCACHE_BYTE_SIZE macro with two Kconfig symbols for
instruction and data caches sizes, respectively:
CONFIG_XILINX_MICROBLAZE0_ICACHE_SIZE
CONFIG_XILINX_MICROBLAZE0_DCACHE_SIZE

Also, get rid of the hardcoded value in icache_disable().

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Link: https://lore.kernel.org/r/20220531181435.3473549-8-ovpanait@gmail.com
Signed-off-by: Michal Simek <michal.simek@amd.com> (s/bralid/brlid/g)

# 130fae2d 31-May-2022 Ovidiu Panait <ovpanait@gmail.com>

microblaze: start.S: remove unused code

in16/out16 routines seem to not be used anywhere in microblaze code, so
remove them.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Link: https://lore.kernel.org/r/20220531181435.3473549-3-ovpanait@gmail.com
Signed-off-by: Michal Simek <michal.simek@amd.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

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

microblaze: Create SYM_ADDR macro to deal with symbols

Symbol handling depends on compilation flags. Right now manual relocation
is used that's why symbols can be referenced just by name and there is no
need to find them out. But when position independent code (PIC) is used
symbols need to be described differently. That's why having one macro
change is easier than changing the whole code.

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

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

microblaze: Add comment about reset location

Better to add comment to explain why reset vector points all the time to
origin U-Boot location.
If reset happens U-Boot should start from it's origin location.

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

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

microblaze: Remove _start symbol handling at U-Boot start

Right now U-Boot runs all the time from the same address where it is loaded
but going to full relocation code starting address doesn't need to be fixed
and can be simply discovered from reading PC register. That's why use r20
to get PC address and subtract offset from the beginning to get starting
address.

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

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

microblaze: Remove code around r20 in relocate_code()

r20 is not used that's why remove logic around it.

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

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

microblaze: Optimize register usage in relocate_code

There are additional operations which can be done simpler that's why
improve logic around relocation address r7 handling and _start symbol.

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

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

microblaze: Change stack protection address to new stack address

SLR low address is still setup to 0 that's why only high limit should be
updated. STACK_SIZE macro is present and could be possible used for
low address alignment but it is not done by this patch.

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

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

microblaze: Separate code end substraction

Follow up patch will convert symbol handling that's why it is necessary to
separate logic around symbols to special instruction. It adds 4B for new
instruction but it is worth to do it to have code ready for for full
relocation.

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

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

microblaze: Remove CONFIG_TEXT_BASE from code

Use symbol instead macro to find where U-Boot starts.

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

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

microblaze: Fix early stack allocation

CONFIG_SYS_INIT_SP_OFFSET macro place stack to TEXT_BASE - SYS_MALLOC_F_LEN
but there is no reason to do it now because board_init_f_alloc_reserve()
returns exact location where stack should be. That's why stack location is
calculated at run time and there is no need to hardcode it via macro. This
change will help with placing U-Boot to any address.

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

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

microblaze: Fix stack protection behavior

When U-Boot starts stack protection can be already enabled that's why setup
the lowest possible SLR value which is address 0. And the highest possible
stack in front of U-Boot. That's why you should never load U-Boot to the
beginning of DDR. There must be some space reserved. Code is using this
location for early malloc space, early global data and stack.

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

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

microblaze: Switch absolute branches to relative

There is no reason to use absolute branches and use just relative. This
change helps with moving binary to different location and start it from
there.

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

# f113d7d3 26-May-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SPL_STACK to Kconfig

This converts the following to Kconfig:
CONFIG_SPL_STACK

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

# f149ee4c 30-Nov-2021 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: start.S: add support for configurable vector base address

Current code assumes that the vector base address is always at 0x0.
However, this value is configurable for MicroBlaze, so update the
__setup_exceptions routine to work with any vector base address.

The r4 register is reserved for the vector base address inside
__setup_exceptions and the function prologe/epilogue are also updated to
save and restore r4.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Link: https://lore.kernel.org/r/20211130163358.2531677-9-ovidiu.panait@windriver.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 83b175be 30-Nov-2021 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: migrate CONFIG_SYS_USR_EXCEP to Kconfig

Migrate CONFIG_SYS_USR_EXCEP to Kconfig. Also, rename it to
XILINX_MICROBLAZE0_USR_EXCEP in order to match the naming convention of
microblaze-generic Kconfig options.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Link: https://lore.kernel.org/r/20211130163358.2531677-7-ovidiu.panait@windriver.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 70c68712 30-Nov-2021 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: drop CONFIG_SYS_RESET_ADDRESS macro

Microblaze is one the last two users of the CONFIG_SYS_RESET_ADDRESS
macro (the other is arch/powerpc/cpu/mpc8xx/cpu.c, but the macro is not
defined anywhere in powerpc code, so it should be removed there too).

Replace CONFIG_SYS_RESET_ADDRESS usage in start.S with
CONFIG_SYS_TEXT_BASE. If the reset address should really be
user-configurable, a new Kconfig option could be added.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Link: https://lore.kernel.org/r/20211130163358.2531677-6-ovidiu.panait@windriver.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 48039c33 30-Nov-2021 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: start.S: use stack space as scratch memory for endian offset

To simpify the code, use stack space as scratch memory for endian offset
calculation, rather than saving/restoring the first unused MB vector.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Link: https://lore.kernel.org/r/20211130163358.2531677-5-ovidiu.panait@windriver.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# edf0f9b1 30-Nov-2021 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: u-boot.lds: replace __end symbol with _end

board_fdt_blob_setup() uses the _end symbol to find the dtb in the non-spl
case. In order to allow microblaze builds to compile successfully with
CONFIG_OF_SEPARATE, the _end symbol must be defined. Align microblaze with
the other architectures and use _end symbol rather than __end to mark the
end of the u-boot binary.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Link: https://lore.kernel.org/r/20211130163358.2531677-2-ovidiu.panait@windriver.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# f5d8b1a1 24-Sep-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: start.S: Use board_init_f_alloc/init in early init

Implement early init by calling generic board_init_f_alloc_reserve and
board_init_f_init_reserve functions:
* drop SYS_MALLOC_F_LEN related code, as allocation and gd->malloc_base
assignment are taken care of by the generic functions
* drop _gd logic

Cc: Michal Simek <monstr@monstr.eu>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 627085ea 24-Sep-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: start.S: Factor out exception setup code to __setup_exceptions

Currently, the exceptions setup code is duplicated in pre-relocation and
post-relocation init. Factor out this code to __setup_exceptions asm
routine to get rid of the duplication.

__setup_exceptions is called with a relocation offset parameter (r5)
which is set to zero for pre-reloc init and gd->reloc_off for post-reloc
exception setup.

Cc: Michal Simek <monstr@monstr.eu>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 3ad95ed6 20-Oct-2019 Michal Simek <michal.simek@amd.com>

microblaze: Fix tab indentation in start.S

Use tab instead of spaces.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

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

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

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

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

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

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

microblaze: spl: configure SYS_MALLOC_F_LEN independently for SPL and full U-Boot

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

# 1d82e2c1 29-Jan-2017 Michal Simek <michal.simek@amd.com>

microblaze: Fix endif macro command

Use correct name in endif comment.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 48470b7a 09-Dec-2015 Michal Simek <michal.simek@amd.com>

microblaze: Wire-up debug_uart in asm

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# ecc30663 25-Nov-2015 Albert ARIBAUD <albert.u.boot@aribaud.net>

Fix board init code to respect the C runtime environment

board_init_f_mem() alters the C runtime environment's
stack it is actually already using. This is not a valid
behaviour within a C runtime environment.

Split board_init_f_mem into C functions which do not alter
their own stack and always behave properly with respect to
their C runtime environment.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Thomas Chou <thomas@wytron.com.tw>

# cd2bee35 19-Oct-2015 Simon Glass <sjg@chromium.org>

microblaze: Add a TODO to call board_init_f_mem()

This C function should be used to do the early memory layout and init. This
is beyond my powers, so just add a TODO for the maintainer.

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

# ca7d2266 03-Feb-2015 Michal Simek <michal.simek@amd.com>

microblaze: spl: Do not call mem_malloc_init and use early alloc

This patch has some parts connected together:
- Use _gd in bss section which is automatically cleared
Location at SPL_MALLOC_END wasn't cleared at all
- Use MALLOC_F_LEN(early alloc) instead of FULL MALLOC
(mem_malloc_init is not called at all)
- Simplify malloc and stack init.
At the end of SPL addr is malloc area and below is stack

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 405e651d 30-Jan-2015 Michal Simek <michal.simek@amd.com>

microblaze: Add support for CONFIG_SYS_MALLOC_F_LEN

Create space for dm_init where calloc is called
and malloc_base has to be initialized.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 0510b14b 30-Jan-2015 Michal Simek <michal.simek@amd.com>

microblaze: Do not use CONFIG_SYS_GENERIC_GLOBAL_DATA

Because it is not compatible with DM where
malloc_base has to be available early and init
has to be done in ASM.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c4dd542 27-Jan-2015 Michal Simek <michal.simek@amd.com>

microblaze: Speedup code copy

Remove one instruction in the loop which speedup
code copying.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

# 9cef20b1 27-Jan-2015 Michal Simek <michal.simek@amd.com>

microblaze: Fix gd_t address which is placed at the end of BRAM

Setup gd from ASM to be availalbe for board_init_r.
Setting it up in spl_board_init is too late when
MALLOC is used.
Space for gd is located behind MALLOC area at the end of BRAM.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# e4a4743e 26-Jan-2015 Michal Simek <michal.simek@amd.com>

microblaze: Remove unused asm label

It is not used at all that's why remove it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# da931af1 04-Nov-2014 Michal Simek <michal.simek@amd.com>

microblaze: Support stack protection feature

Ensure that stack didn't rewrite important part
of u-boot.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 822d43a6 04-Nov-2014 Michal Simek <michal.simek@amd.com>

microblaze: Enable hardware exception by default

Enable hardware exception by default to be able to
handle it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 9d242745 20-Jan-2014 Michal Simek <michal.simek@amd.com>

microblaze: Add SPL support

Add support for U-BOOT SPL. NOR and RAM mode are supported.
There are 3 images in NOR flash. u-boot.img, dtb and kernel.

Signed-off-by: Michal Simek <michal.simek@xilinx.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>

# 5811830f 25-Sep-2012 Michal Simek <michal.simek@xilinx.com>

microblaze: Flush caches before enabling them

Flushing caches is necessary because of soft reset
which doesn't clear caches.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Reviewed-by: Marek Vasut <marex@denx.de>

# 2380b8f5 04-Jul-2012 Michal Simek <michal.simek@xilinx.com>

microblaze: Clean microblaze initialization

Move board specific function to board_init function in board/ folder
Remove externs from generic board.c
Use board_init_f function in board.c file.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Acked-by: Stephan Linz <linz@li-pro.net>

# 575a3d21 10-Jul-2012 Michal Simek <michal.simek@xilinx.com>

microblaze: intc: Clear interrupt code

Clear and prepare for device-tree driven configuration.
Remove CONFIG_SYS_INTC_0 definition
Use dynamic allocation instead of static.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Acked-by: Simon Glass <sjg@chromium.org>

# 5562bcc2 30-Aug-2011 Michal Simek <michal.simek@xilinx.com>

microblaze: Clean up reset asm code

- Remove code copying
- Reset address is setup from first stage bootloader
- Support reset vector setup on little endian

Signed-off-by: Michal Simek <monstr@monstr.eu>

# f3090fce 15-Nov-2010 Michal Simek <michal.simek@xilinx.com>

microblaze: Save and restore first unused vector

Use one memory space to detect little/big endian platforms.
The first unused address(0x28) is used instead 0x0 address (reset vectors).
Detection rewrited reset vector setup from first stage bootloader.

Workflow:
1. Store 0x28 to r7
2. Do little/big endian test
3. Restore r7 to 0x28

Signed-off-by: Michal Simek <monstr@monstr.eu>

# 86c1b2a8 21-Jul-2011 Michal Simek <michal.simek@xilinx.com>

microblaze: Setup MB vectors if feature is enable for u-boot

For example: Setup reset vectors if reset address is setup.
Setup user exception vector if user exception is enabled

Signed-off-by: Michal Simek <monstr@monstr.eu>

# dfc10703 21-Jul-2011 Michal Simek <michal.simek@xilinx.com>

microblaze: Remove debug saving value

Forget to remove debug code.

Signed-off-by: Michal Simek <monstr@monstr.eu>

# 071bc923 27-Oct-2010 Wolfgang Denk <wd@denx.de>

Coding Style cleanup

Signed-off-by: Wolfgang Denk <wd@denx.de>

# 25ddd1fb 26-Oct-2010 Wolfgang Denk <wd@denx.de>

Replace CONFIG_SYS_GBL_DATA_SIZE by auto-generated value

CONFIG_SYS_GBL_DATA_SIZE has always been just a bad workarond for not
being able to use "sizeof(struct global_data)" in assembler files.
Recent experience has shown that manual synchronization is not
reliable enough. This patch renames CONFIG_SYS_GBL_DATA_SIZE into
GENERATED_GBL_DATA_SIZE which gets automatically generated by the
asm-offsets tool. In the result, all definitions of this value can be
deleted from the board config files. We have to make sure that all
files that reference such data include the new <asm-offsets.h> file.

No other changes have been done yet, but it is obvious that similar
changes / simplifications can be done for other, related macro
definitions as well.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Acked-by: Kumar Gala <galak@kernel.crashing.org>

# 14d0a02a 07-Oct-2010 Wolfgang Denk <wd@denx.de>

Rename TEXT_BASE into CONFIG_SYS_TEXT_BASE

The change is currently needed to be able to remove the board
configuration scripting from the top level Makefile and replace it by
a simple, table driven script.

Moving this configuration setting into the "CONFIG_*" name space is
also desirable because it is needed if we ever should move forward to
a Kconfig driven configuration system.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# b98cba09 12-Aug-2010 Michal Simek <michal.simek@xilinx.com>

microblaze: Support little-endian microblaze target

Microblaze little-endian toolchain should export
__MICROBLAZEEL__.

Signed-off-by: Michal Simek <monstr@monstr.eu>

# 6260fb04 12-Apr-2010 Peter Tyser <ptyser@xes-inc.com>

microblaze: Move cpu/microblaze/* to arch/microblaze/cpu/*

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

# f149ee4c 30-Nov-2021 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: start.S: add support for configurable vector base address

Current code assumes that the vector base address is always at 0x0.
However, this value is configurable for MicroBlaze, so update the
__setup_exceptions routine to work with any vector base address.

The r4 register is reserved for the vector base address inside
__setup_exceptions and the function prologe/epilogue are also updated to
save and restore r4.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Link: https://lore.kernel.org/r/20211130163358.2531677-9-ovidiu.panait@windriver.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 83b175be 30-Nov-2021 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: migrate CONFIG_SYS_USR_EXCEP to Kconfig

Migrate CONFIG_SYS_USR_EXCEP to Kconfig. Also, rename it to
XILINX_MICROBLAZE0_USR_EXCEP in order to match the naming convention of
microblaze-generic Kconfig options.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Link: https://lore.kernel.org/r/20211130163358.2531677-7-ovidiu.panait@windriver.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 70c68712 30-Nov-2021 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: drop CONFIG_SYS_RESET_ADDRESS macro

Microblaze is one the last two users of the CONFIG_SYS_RESET_ADDRESS
macro (the other is arch/powerpc/cpu/mpc8xx/cpu.c, but the macro is not
defined anywhere in powerpc code, so it should be removed there too).

Replace CONFIG_SYS_RESET_ADDRESS usage in start.S with
CONFIG_SYS_TEXT_BASE. If the reset address should really be
user-configurable, a new Kconfig option could be added.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Link: https://lore.kernel.org/r/20211130163358.2531677-6-ovidiu.panait@windriver.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 48039c33 30-Nov-2021 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: start.S: use stack space as scratch memory for endian offset

To simpify the code, use stack space as scratch memory for endian offset
calculation, rather than saving/restoring the first unused MB vector.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Link: https://lore.kernel.org/r/20211130163358.2531677-5-ovidiu.panait@windriver.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# edf0f9b1 30-Nov-2021 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: u-boot.lds: replace __end symbol with _end

board_fdt_blob_setup() uses the _end symbol to find the dtb in the non-spl
case. In order to allow microblaze builds to compile successfully with
CONFIG_OF_SEPARATE, the _end symbol must be defined. Align microblaze with
the other architectures and use _end symbol rather than __end to mark the
end of the u-boot binary.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Link: https://lore.kernel.org/r/20211130163358.2531677-2-ovidiu.panait@windriver.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# f5d8b1a1 24-Sep-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: start.S: Use board_init_f_alloc/init in early init

Implement early init by calling generic board_init_f_alloc_reserve and
board_init_f_init_reserve functions:
* drop SYS_MALLOC_F_LEN related code, as allocation and gd->malloc_base
assignment are taken care of by the generic functions
* drop _gd logic

Cc: Michal Simek <monstr@monstr.eu>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 627085ea 24-Sep-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: start.S: Factor out exception setup code to __setup_exceptions

Currently, the exceptions setup code is duplicated in pre-relocation and
post-relocation init. Factor out this code to __setup_exceptions asm
routine to get rid of the duplication.

__setup_exceptions is called with a relocation offset parameter (r5)
which is set to zero for pre-reloc init and gd->reloc_off for post-reloc
exception setup.

Cc: Michal Simek <monstr@monstr.eu>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 3ad95ed6 20-Oct-2019 Michal Simek <michal.simek@xilinx.com>

microblaze: Fix tab indentation in start.S

Use tab instead of spaces.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

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

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

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

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

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

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

microblaze: spl: configure SYS_MALLOC_F_LEN independently for SPL and full U-Boot

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

# 1d82e2c1 29-Jan-2017 Michal Simek <michal.simek@xilinx.com>

microblaze: Fix endif macro command

Use correct name in endif comment.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 48470b7a 09-Dec-2015 Michal Simek <michal.simek@xilinx.com>

microblaze: Wire-up debug_uart in asm

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# ecc30663 25-Nov-2015 Albert ARIBAUD <albert.u.boot@aribaud.net>

Fix board init code to respect the C runtime environment

board_init_f_mem() alters the C runtime environment's
stack it is actually already using. This is not a valid
behaviour within a C runtime environment.

Split board_init_f_mem into C functions which do not alter
their own stack and always behave properly with respect to
their C runtime environment.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Thomas Chou <thomas@wytron.com.tw>

# cd2bee35 19-Oct-2015 Simon Glass <sjg@chromium.org>

microblaze: Add a TODO to call board_init_f_mem()

This C function should be used to do the early memory layout and init. This
is beyond my powers, so just add a TODO for the maintainer.

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

# ca7d2266 03-Feb-2015 Michal Simek <michal.simek@xilinx.com>

microblaze: spl: Do not call mem_malloc_init and use early alloc

This patch has some parts connected together:
- Use _gd in bss section which is automatically cleared
Location at SPL_MALLOC_END wasn't cleared at all
- Use MALLOC_F_LEN(early alloc) instead of FULL MALLOC
(mem_malloc_init is not called at all)
- Simplify malloc and stack init.
At the end of SPL addr is malloc area and below is stack

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 405e651d 30-Jan-2015 Michal Simek <michal.simek@xilinx.com>

microblaze: Add support for CONFIG_SYS_MALLOC_F_LEN

Create space for dm_init where calloc is called
and malloc_base has to be initialized.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 0510b14b 30-Jan-2015 Michal Simek <michal.simek@xilinx.com>

microblaze: Do not use CONFIG_SYS_GENERIC_GLOBAL_DATA

Because it is not compatible with DM where
malloc_base has to be available early and init
has to be done in ASM.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c4dd542 27-Jan-2015 Michal Simek <michal.simek@xilinx.com>

microblaze: Speedup code copy

Remove one instruction in the loop which speedup
code copying.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

# 9cef20b1 27-Jan-2015 Michal Simek <michal.simek@xilinx.com>

microblaze: Fix gd_t address which is placed at the end of BRAM

Setup gd from ASM to be availalbe for board_init_r.
Setting it up in spl_board_init is too late when
MALLOC is used.
Space for gd is located behind MALLOC area at the end of BRAM.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# e4a4743e 26-Jan-2015 Michal Simek <michal.simek@xilinx.com>

microblaze: Remove unused asm label

It is not used at all that's why remove it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# da931af1 04-Nov-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Support stack protection feature

Ensure that stack didn't rewrite important part
of u-boot.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 822d43a6 04-Nov-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Enable hardware exception by default

Enable hardware exception by default to be able to
handle it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 9d242745 20-Jan-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Add SPL support

Add support for U-BOOT SPL. NOR and RAM mode are supported.
There are 3 images in NOR flash. u-boot.img, dtb and kernel.

Signed-off-by: Michal Simek <michal.simek@xilinx.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>

# 5811830f 25-Sep-2012 Michal Simek <monstr@monstr.eu>

microblaze: Flush caches before enabling them

Flushing caches is necessary because of soft reset
which doesn't clear caches.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Reviewed-by: Marek Vasut <marex@denx.de>

# 2380b8f5 04-Jul-2012 Michal Simek <monstr@monstr.eu>

microblaze: Clean microblaze initialization

Move board specific function to board_init function in board/ folder
Remove externs from generic board.c
Use board_init_f function in board.c file.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Acked-by: Stephan Linz <linz@li-pro.net>

# 575a3d21 10-Jul-2012 Michal Simek <monstr@monstr.eu>

microblaze: intc: Clear interrupt code

Clear and prepare for device-tree driven configuration.
Remove CONFIG_SYS_INTC_0 definition
Use dynamic allocation instead of static.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Acked-by: Simon Glass <sjg@chromium.org>

# 5562bcc2 30-Aug-2011 Michal Simek <monstr@monstr.eu>

microblaze: Clean up reset asm code

- Remove code copying
- Reset address is setup from first stage bootloader
- Support reset vector setup on little endian

Signed-off-by: Michal Simek <monstr@monstr.eu>

# f3090fce 15-Nov-2010 Michal Simek <monstr@monstr.eu>

microblaze: Save and restore first unused vector

Use one memory space to detect little/big endian platforms.
The first unused address(0x28) is used instead 0x0 address (reset vectors).
Detection rewrited reset vector setup from first stage bootloader.

Workflow:
1. Store 0x28 to r7
2. Do little/big endian test
3. Restore r7 to 0x28

Signed-off-by: Michal Simek <monstr@monstr.eu>

# 86c1b2a8 21-Jul-2011 Michal Simek <monstr@monstr.eu>

microblaze: Setup MB vectors if feature is enable for u-boot

For example: Setup reset vectors if reset address is setup.
Setup user exception vector if user exception is enabled

Signed-off-by: Michal Simek <monstr@monstr.eu>

# dfc10703 21-Jul-2011 Michal Simek <monstr@monstr.eu>

microblaze: Remove debug saving value

Forget to remove debug code.

Signed-off-by: Michal Simek <monstr@monstr.eu>

# 071bc923 27-Oct-2010 Wolfgang Denk <wd@denx.de>

Coding Style cleanup

Signed-off-by: Wolfgang Denk <wd@denx.de>

# 25ddd1fb 26-Oct-2010 Wolfgang Denk <wd@denx.de>

Replace CONFIG_SYS_GBL_DATA_SIZE by auto-generated value

CONFIG_SYS_GBL_DATA_SIZE has always been just a bad workarond for not
being able to use "sizeof(struct global_data)" in assembler files.
Recent experience has shown that manual synchronization is not
reliable enough. This patch renames CONFIG_SYS_GBL_DATA_SIZE into
GENERATED_GBL_DATA_SIZE which gets automatically generated by the
asm-offsets tool. In the result, all definitions of this value can be
deleted from the board config files. We have to make sure that all
files that reference such data include the new <asm-offsets.h> file.

No other changes have been done yet, but it is obvious that similar
changes / simplifications can be done for other, related macro
definitions as well.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Acked-by: Kumar Gala <galak@kernel.crashing.org>

# 14d0a02a 07-Oct-2010 Wolfgang Denk <wd@denx.de>

Rename TEXT_BASE into CONFIG_SYS_TEXT_BASE

The change is currently needed to be able to remove the board
configuration scripting from the top level Makefile and replace it by
a simple, table driven script.

Moving this configuration setting into the "CONFIG_*" name space is
also desirable because it is needed if we ever should move forward to
a Kconfig driven configuration system.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# b98cba09 12-Aug-2010 Michal Simek <monstr@monstr.eu>

microblaze: Support little-endian microblaze target

Microblaze little-endian toolchain should export
__MICROBLAZEEL__.

Signed-off-by: Michal Simek <monstr@monstr.eu>

# 6260fb04 12-Apr-2010 Peter Tyser <ptyser@xes-inc.com>

microblaze: Move cpu/microblaze/* to arch/microblaze/cpu/*

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

# f5d8b1a1 24-Sep-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: start.S: Use board_init_f_alloc/init in early init

Implement early init by calling generic board_init_f_alloc_reserve and
board_init_f_init_reserve functions:
* drop SYS_MALLOC_F_LEN related code, as allocation and gd->malloc_base
assignment are taken care of by the generic functions
* drop _gd logic

Cc: Michal Simek <monstr@monstr.eu>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

# 627085ea 24-Sep-2020 Ovidiu Panait <ovidiu.panait@windriver.com>

microblaze: start.S: Factor out exception setup code to __setup_exceptions

Currently, the exceptions setup code is duplicated in pre-relocation and
post-relocation init. Factor out this code to __setup_exceptions asm
routine to get rid of the duplication.

__setup_exceptions is called with a relocation offset parameter (r5)
which is set to zero for pre-reloc init and gd->reloc_off for post-reloc
exception setup.

Cc: Michal Simek <monstr@monstr.eu>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 3ad95ed6 20-Oct-2019 Michal Simek <michal.simek@xilinx.com>

microblaze: Fix tab indentation in start.S

Use tab instead of spaces.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

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

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

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

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

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

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

microblaze: spl: configure SYS_MALLOC_F_LEN independently for SPL and full U-Boot

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

# 1d82e2c1 29-Jan-2017 Michal Simek <michal.simek@xilinx.com>

microblaze: Fix endif macro command

Use correct name in endif comment.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 48470b7a 09-Dec-2015 Michal Simek <michal.simek@xilinx.com>

microblaze: Wire-up debug_uart in asm

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# ecc30663 25-Nov-2015 Albert ARIBAUD <albert.u.boot@aribaud.net>

Fix board init code to respect the C runtime environment

board_init_f_mem() alters the C runtime environment's
stack it is actually already using. This is not a valid
behaviour within a C runtime environment.

Split board_init_f_mem into C functions which do not alter
their own stack and always behave properly with respect to
their C runtime environment.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Thomas Chou <thomas@wytron.com.tw>

# cd2bee35 19-Oct-2015 Simon Glass <sjg@chromium.org>

microblaze: Add a TODO to call board_init_f_mem()

This C function should be used to do the early memory layout and init. This
is beyond my powers, so just add a TODO for the maintainer.

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

# ca7d2266 03-Feb-2015 Michal Simek <michal.simek@xilinx.com>

microblaze: spl: Do not call mem_malloc_init and use early alloc

This patch has some parts connected together:
- Use _gd in bss section which is automatically cleared
Location at SPL_MALLOC_END wasn't cleared at all
- Use MALLOC_F_LEN(early alloc) instead of FULL MALLOC
(mem_malloc_init is not called at all)
- Simplify malloc and stack init.
At the end of SPL addr is malloc area and below is stack

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 405e651d 30-Jan-2015 Michal Simek <michal.simek@xilinx.com>

microblaze: Add support for CONFIG_SYS_MALLOC_F_LEN

Create space for dm_init where calloc is called
and malloc_base has to be initialized.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 0510b14b 30-Jan-2015 Michal Simek <michal.simek@xilinx.com>

microblaze: Do not use CONFIG_SYS_GENERIC_GLOBAL_DATA

Because it is not compatible with DM where
malloc_base has to be available early and init
has to be done in ASM.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c4dd542 27-Jan-2015 Michal Simek <michal.simek@xilinx.com>

microblaze: Speedup code copy

Remove one instruction in the loop which speedup
code copying.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

# 9cef20b1 27-Jan-2015 Michal Simek <michal.simek@xilinx.com>

microblaze: Fix gd_t address which is placed at the end of BRAM

Setup gd from ASM to be availalbe for board_init_r.
Setting it up in spl_board_init is too late when
MALLOC is used.
Space for gd is located behind MALLOC area at the end of BRAM.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# e4a4743e 26-Jan-2015 Michal Simek <michal.simek@xilinx.com>

microblaze: Remove unused asm label

It is not used at all that's why remove it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# da931af1 04-Nov-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Support stack protection feature

Ensure that stack didn't rewrite important part
of u-boot.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 822d43a6 04-Nov-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Enable hardware exception by default

Enable hardware exception by default to be able to
handle it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 9d242745 20-Jan-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Add SPL support

Add support for U-BOOT SPL. NOR and RAM mode are supported.
There are 3 images in NOR flash. u-boot.img, dtb and kernel.

Signed-off-by: Michal Simek <michal.simek@xilinx.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>

# 5811830f 25-Sep-2012 Michal Simek <monstr@monstr.eu>

microblaze: Flush caches before enabling them

Flushing caches is necessary because of soft reset
which doesn't clear caches.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Reviewed-by: Marek Vasut <marex@denx.de>

# 2380b8f5 04-Jul-2012 Michal Simek <monstr@monstr.eu>

microblaze: Clean microblaze initialization

Move board specific function to board_init function in board/ folder
Remove externs from generic board.c
Use board_init_f function in board.c file.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Acked-by: Stephan Linz <linz@li-pro.net>

# 575a3d21 10-Jul-2012 Michal Simek <monstr@monstr.eu>

microblaze: intc: Clear interrupt code

Clear and prepare for device-tree driven configuration.
Remove CONFIG_SYS_INTC_0 definition
Use dynamic allocation instead of static.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Acked-by: Simon Glass <sjg@chromium.org>

# 5562bcc2 30-Aug-2011 Michal Simek <monstr@monstr.eu>

microblaze: Clean up reset asm code

- Remove code copying
- Reset address is setup from first stage bootloader
- Support reset vector setup on little endian

Signed-off-by: Michal Simek <monstr@monstr.eu>

# f3090fce 15-Nov-2010 Michal Simek <monstr@monstr.eu>

microblaze: Save and restore first unused vector

Use one memory space to detect little/big endian platforms.
The first unused address(0x28) is used instead 0x0 address (reset vectors).
Detection rewrited reset vector setup from first stage bootloader.

Workflow:
1. Store 0x28 to r7
2. Do little/big endian test
3. Restore r7 to 0x28

Signed-off-by: Michal Simek <monstr@monstr.eu>

# 86c1b2a8 21-Jul-2011 Michal Simek <monstr@monstr.eu>

microblaze: Setup MB vectors if feature is enable for u-boot

For example: Setup reset vectors if reset address is setup.
Setup user exception vector if user exception is enabled

Signed-off-by: Michal Simek <monstr@monstr.eu>

# dfc10703 21-Jul-2011 Michal Simek <monstr@monstr.eu>

microblaze: Remove debug saving value

Forget to remove debug code.

Signed-off-by: Michal Simek <monstr@monstr.eu>

# 071bc923 27-Oct-2010 Wolfgang Denk <wd@denx.de>

Coding Style cleanup

Signed-off-by: Wolfgang Denk <wd@denx.de>

# 25ddd1fb 26-Oct-2010 Wolfgang Denk <wd@denx.de>

Replace CONFIG_SYS_GBL_DATA_SIZE by auto-generated value

CONFIG_SYS_GBL_DATA_SIZE has always been just a bad workarond for not
being able to use "sizeof(struct global_data)" in assembler files.
Recent experience has shown that manual synchronization is not
reliable enough. This patch renames CONFIG_SYS_GBL_DATA_SIZE into
GENERATED_GBL_DATA_SIZE which gets automatically generated by the
asm-offsets tool. In the result, all definitions of this value can be
deleted from the board config files. We have to make sure that all
files that reference such data include the new <asm-offsets.h> file.

No other changes have been done yet, but it is obvious that similar
changes / simplifications can be done for other, related macro
definitions as well.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Acked-by: Kumar Gala <galak@kernel.crashing.org>

# 14d0a02a 07-Oct-2010 Wolfgang Denk <wd@denx.de>

Rename TEXT_BASE into CONFIG_SYS_TEXT_BASE

The change is currently needed to be able to remove the board
configuration scripting from the top level Makefile and replace it by
a simple, table driven script.

Moving this configuration setting into the "CONFIG_*" name space is
also desirable because it is needed if we ever should move forward to
a Kconfig driven configuration system.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# b98cba09 12-Aug-2010 Michal Simek <monstr@monstr.eu>

microblaze: Support little-endian microblaze target

Microblaze little-endian toolchain should export
__MICROBLAZEEL__.

Signed-off-by: Michal Simek <monstr@monstr.eu>

# 6260fb04 12-Apr-2010 Peter Tyser <ptyser@xes-inc.com>

microblaze: Move cpu/microblaze/* to arch/microblaze/cpu/*

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

# 3ad95ed6 20-Oct-2019 Michal Simek <michal.simek@xilinx.com>

microblaze: Fix tab indentation in start.S

Use tab instead of spaces.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

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

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

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

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

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

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

microblaze: spl: configure SYS_MALLOC_F_LEN independently for SPL and full U-Boot

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

# 1d82e2c1 29-Jan-2017 Michal Simek <michal.simek@xilinx.com>

microblaze: Fix endif macro command

Use correct name in endif comment.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 48470b7a 09-Dec-2015 Michal Simek <michal.simek@xilinx.com>

microblaze: Wire-up debug_uart in asm

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# ecc30663 25-Nov-2015 Albert ARIBAUD <albert.u.boot@aribaud.net>

Fix board init code to respect the C runtime environment

board_init_f_mem() alters the C runtime environment's
stack it is actually already using. This is not a valid
behaviour within a C runtime environment.

Split board_init_f_mem into C functions which do not alter
their own stack and always behave properly with respect to
their C runtime environment.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Thomas Chou <thomas@wytron.com.tw>

# cd2bee35 19-Oct-2015 Simon Glass <sjg@chromium.org>

microblaze: Add a TODO to call board_init_f_mem()

This C function should be used to do the early memory layout and init. This
is beyond my powers, so just add a TODO for the maintainer.

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

# ca7d2266 03-Feb-2015 Michal Simek <michal.simek@xilinx.com>

microblaze: spl: Do not call mem_malloc_init and use early alloc

This patch has some parts connected together:
- Use _gd in bss section which is automatically cleared
Location at SPL_MALLOC_END wasn't cleared at all
- Use MALLOC_F_LEN(early alloc) instead of FULL MALLOC
(mem_malloc_init is not called at all)
- Simplify malloc and stack init.
At the end of SPL addr is malloc area and below is stack

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 405e651d 30-Jan-2015 Michal Simek <michal.simek@xilinx.com>

microblaze: Add support for CONFIG_SYS_MALLOC_F_LEN

Create space for dm_init where calloc is called
and malloc_base has to be initialized.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 0510b14b 30-Jan-2015 Michal Simek <michal.simek@xilinx.com>

microblaze: Do not use CONFIG_SYS_GENERIC_GLOBAL_DATA

Because it is not compatible with DM where
malloc_base has to be available early and init
has to be done in ASM.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c4dd542 27-Jan-2015 Michal Simek <michal.simek@xilinx.com>

microblaze: Speedup code copy

Remove one instruction in the loop which speedup
code copying.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

# 9cef20b1 27-Jan-2015 Michal Simek <michal.simek@xilinx.com>

microblaze: Fix gd_t address which is placed at the end of BRAM

Setup gd from ASM to be availalbe for board_init_r.
Setting it up in spl_board_init is too late when
MALLOC is used.
Space for gd is located behind MALLOC area at the end of BRAM.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# e4a4743e 26-Jan-2015 Michal Simek <michal.simek@xilinx.com>

microblaze: Remove unused asm label

It is not used at all that's why remove it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# da931af1 04-Nov-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Support stack protection feature

Ensure that stack didn't rewrite important part
of u-boot.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 822d43a6 04-Nov-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Enable hardware exception by default

Enable hardware exception by default to be able to
handle it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 9d242745 20-Jan-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Add SPL support

Add support for U-BOOT SPL. NOR and RAM mode are supported.
There are 3 images in NOR flash. u-boot.img, dtb and kernel.

Signed-off-by: Michal Simek <michal.simek@xilinx.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>

# 5811830f 25-Sep-2012 Michal Simek <monstr@monstr.eu>

microblaze: Flush caches before enabling them

Flushing caches is necessary because of soft reset
which doesn't clear caches.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Reviewed-by: Marek Vasut <marex@denx.de>

# 2380b8f5 04-Jul-2012 Michal Simek <monstr@monstr.eu>

microblaze: Clean microblaze initialization

Move board specific function to board_init function in board/ folder
Remove externs from generic board.c
Use board_init_f function in board.c file.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Acked-by: Stephan Linz <linz@li-pro.net>

# 575a3d21 10-Jul-2012 Michal Simek <monstr@monstr.eu>

microblaze: intc: Clear interrupt code

Clear and prepare for device-tree driven configuration.
Remove CONFIG_SYS_INTC_0 definition
Use dynamic allocation instead of static.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Acked-by: Simon Glass <sjg@chromium.org>

# 5562bcc2 30-Aug-2011 Michal Simek <monstr@monstr.eu>

microblaze: Clean up reset asm code

- Remove code copying
- Reset address is setup from first stage bootloader
- Support reset vector setup on little endian

Signed-off-by: Michal Simek <monstr@monstr.eu>

# f3090fce 15-Nov-2010 Michal Simek <monstr@monstr.eu>

microblaze: Save and restore first unused vector

Use one memory space to detect little/big endian platforms.
The first unused address(0x28) is used instead 0x0 address (reset vectors).
Detection rewrited reset vector setup from first stage bootloader.

Workflow:
1. Store 0x28 to r7
2. Do little/big endian test
3. Restore r7 to 0x28

Signed-off-by: Michal Simek <monstr@monstr.eu>

# 86c1b2a8 21-Jul-2011 Michal Simek <monstr@monstr.eu>

microblaze: Setup MB vectors if feature is enable for u-boot

For example: Setup reset vectors if reset address is setup.
Setup user exception vector if user exception is enabled

Signed-off-by: Michal Simek <monstr@monstr.eu>

# dfc10703 21-Jul-2011 Michal Simek <monstr@monstr.eu>

microblaze: Remove debug saving value

Forget to remove debug code.

Signed-off-by: Michal Simek <monstr@monstr.eu>

# 071bc923 27-Oct-2010 Wolfgang Denk <wd@denx.de>

Coding Style cleanup

Signed-off-by: Wolfgang Denk <wd@denx.de>

# 25ddd1fb 26-Oct-2010 Wolfgang Denk <wd@denx.de>

Replace CONFIG_SYS_GBL_DATA_SIZE by auto-generated value

CONFIG_SYS_GBL_DATA_SIZE has always been just a bad workarond for not
being able to use "sizeof(struct global_data)" in assembler files.
Recent experience has shown that manual synchronization is not
reliable enough. This patch renames CONFIG_SYS_GBL_DATA_SIZE into
GENERATED_GBL_DATA_SIZE which gets automatically generated by the
asm-offsets tool. In the result, all definitions of this value can be
deleted from the board config files. We have to make sure that all
files that reference such data include the new <asm-offsets.h> file.

No other changes have been done yet, but it is obvious that similar
changes / simplifications can be done for other, related macro
definitions as well.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Acked-by: Kumar Gala <galak@kernel.crashing.org>

# 14d0a02a 07-Oct-2010 Wolfgang Denk <wd@denx.de>

Rename TEXT_BASE into CONFIG_SYS_TEXT_BASE

The change is currently needed to be able to remove the board
configuration scripting from the top level Makefile and replace it by
a simple, table driven script.

Moving this configuration setting into the "CONFIG_*" name space is
also desirable because it is needed if we ever should move forward to
a Kconfig driven configuration system.

Signed-off-by: Wolfgang Denk <wd@denx.de>

# b98cba09 12-Aug-2010 Michal Simek <monstr@monstr.eu>

microblaze: Support little-endian microblaze target

Microblaze little-endian toolchain should export
__MICROBLAZEEL__.

Signed-off-by: Michal Simek <monstr@monstr.eu>

# 6260fb04 12-Apr-2010 Peter Tyser <ptyser@xes-inc.com>

microblaze: Move cpu/microblaze/* to arch/microblaze/cpu/*

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>

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

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

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

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

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

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


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

microblaze: spl: configure SYS_MALLOC_F_LEN independently for SPL and full U-Boot

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


# 1d82e2c1 29-Jan-2017 Michal Simek <michal.simek@xilinx.com>

microblaze: Fix endif macro command

Use correct name in endif comment.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# 48470b7a 09-Dec-2015 Michal Simek <michal.simek@xilinx.com>

microblaze: Wire-up debug_uart in asm

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# ecc30663 25-Nov-2015 Albert ARIBAUD <albert.u.boot@aribaud.net>

Fix board init code to respect the C runtime environment

board_init_f_mem() alters the C runtime environment's
stack it is actually already using. This is not a valid
behaviour within a C runtime environment.

Split board_init_f_mem into C functions which do not alter
their own stack and always behave properly with respect to
their C runtime environment.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Thomas Chou <thomas@wytron.com.tw>


# cd2bee35 19-Oct-2015 Simon Glass <sjg@chromium.org>

microblaze: Add a TODO to call board_init_f_mem()

This C function should be used to do the early memory layout and init. This
is beyond my powers, so just add a TODO for the maintainer.

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


# ca7d2266 03-Feb-2015 Michal Simek <michal.simek@xilinx.com>

microblaze: spl: Do not call mem_malloc_init and use early alloc

This patch has some parts connected together:
- Use _gd in bss section which is automatically cleared
Location at SPL_MALLOC_END wasn't cleared at all
- Use MALLOC_F_LEN(early alloc) instead of FULL MALLOC
(mem_malloc_init is not called at all)
- Simplify malloc and stack init.
At the end of SPL addr is malloc area and below is stack

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# 405e651d 30-Jan-2015 Michal Simek <michal.simek@xilinx.com>

microblaze: Add support for CONFIG_SYS_MALLOC_F_LEN

Create space for dm_init where calloc is called
and malloc_base has to be initialized.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# 0510b14b 30-Jan-2015 Michal Simek <michal.simek@xilinx.com>

microblaze: Do not use CONFIG_SYS_GENERIC_GLOBAL_DATA

Because it is not compatible with DM where
malloc_base has to be available early and init
has to be done in ASM.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# 7c4dd542 27-Jan-2015 Michal Simek <michal.simek@xilinx.com>

microblaze: Speedup code copy

Remove one instruction in the loop which speedup
code copying.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


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


# 9cef20b1 27-Jan-2015 Michal Simek <michal.simek@xilinx.com>

microblaze: Fix gd_t address which is placed at the end of BRAM

Setup gd from ASM to be availalbe for board_init_r.
Setting it up in spl_board_init is too late when
MALLOC is used.
Space for gd is located behind MALLOC area at the end of BRAM.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# e4a4743e 26-Jan-2015 Michal Simek <michal.simek@xilinx.com>

microblaze: Remove unused asm label

It is not used at all that's why remove it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# da931af1 04-Nov-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Support stack protection feature

Ensure that stack didn't rewrite important part
of u-boot.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# 822d43a6 04-Nov-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Enable hardware exception by default

Enable hardware exception by default to be able to
handle it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


# 9d242745 20-Jan-2014 Michal Simek <michal.simek@xilinx.com>

microblaze: Add SPL support

Add support for U-BOOT SPL. NOR and RAM mode are supported.
There are 3 images in NOR flash. u-boot.img, dtb and kernel.

Signed-off-by: Michal Simek <michal.simek@xilinx.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>


# 5811830f 25-Sep-2012 Michal Simek <monstr@monstr.eu>

microblaze: Flush caches before enabling them

Flushing caches is necessary because of soft reset
which doesn't clear caches.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Reviewed-by: Marek Vasut <marex@denx.de>


# 2380b8f5 04-Jul-2012 Michal Simek <monstr@monstr.eu>

microblaze: Clean microblaze initialization

Move board specific function to board_init function in board/ folder
Remove externs from generic board.c
Use board_init_f function in board.c file.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Acked-by: Stephan Linz <linz@li-pro.net>


# 575a3d21 10-Jul-2012 Michal Simek <monstr@monstr.eu>

microblaze: intc: Clear interrupt code

Clear and prepare for device-tree driven configuration.
Remove CONFIG_SYS_INTC_0 definition
Use dynamic allocation instead of static.

Signed-off-by: Michal Simek <monstr@monstr.eu>
Acked-by: Simon Glass <sjg@chromium.org>


# 5562bcc2 30-Aug-2011 Michal Simek <monstr@monstr.eu>

microblaze: Clean up reset asm code

- Remove code copying
- Reset address is setup from first stage bootloader
- Support reset vector setup on little endian

Signed-off-by: Michal Simek <monstr@monstr.eu>


# f3090fce 15-Nov-2010 Michal Simek <monstr@monstr.eu>

microblaze: Save and restore first unused vector

Use one memory space to detect little/big endian platforms.
The first unused address(0x28) is used instead 0x0 address (reset vectors).
Detection rewrited reset vector setup from first stage bootloader.

Workflow:
1. Store 0x28 to r7
2. Do little/big endian test
3. Restore r7 to 0x28

Signed-off-by: Michal Simek <monstr@monstr.eu>


# 86c1b2a8 21-Jul-2011 Michal Simek <monstr@monstr.eu>

microblaze: Setup MB vectors if feature is enable for u-boot

For example: Setup reset vectors if reset address is setup.
Setup user exception vector if user exception is enabled

Signed-off-by: Michal Simek <monstr@monstr.eu>


# dfc10703 21-Jul-2011 Michal Simek <monstr@monstr.eu>

microblaze: Remove debug saving value

Forget to remove debug code.

Signed-off-by: Michal Simek <monstr@monstr.eu>


# 071bc923 27-Oct-2010 Wolfgang Denk <wd@denx.de>

Coding Style cleanup

Signed-off-by: Wolfgang Denk <wd@denx.de>


# 25ddd1fb 26-Oct-2010 Wolfgang Denk <wd@denx.de>

Replace CONFIG_SYS_GBL_DATA_SIZE by auto-generated value

CONFIG_SYS_GBL_DATA_SIZE has always been just a bad workarond for not
being able to use "sizeof(struct global_data)" in assembler files.
Recent experience has shown that manual synchronization is not
reliable enough. This patch renames CONFIG_SYS_GBL_DATA_SIZE into
GENERATED_GBL_DATA_SIZE which gets automatically generated by the
asm-offsets tool. In the result, all definitions of this value can be
deleted from the board config files. We have to make sure that all
files that reference such data include the new <asm-offsets.h> file.

No other changes have been done yet, but it is obvious that similar
changes / simplifications can be done for other, related macro
definitions as well.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Acked-by: Kumar Gala <galak@kernel.crashing.org>


# 14d0a02a 07-Oct-2010 Wolfgang Denk <wd@denx.de>

Rename TEXT_BASE into CONFIG_SYS_TEXT_BASE

The change is currently needed to be able to remove the board
configuration scripting from the top level Makefile and replace it by
a simple, table driven script.

Moving this configuration setting into the "CONFIG_*" name space is
also desirable because it is needed if we ever should move forward to
a Kconfig driven configuration system.

Signed-off-by: Wolfgang Denk <wd@denx.de>


# b98cba09 12-Aug-2010 Michal Simek <monstr@monstr.eu>

microblaze: Support little-endian microblaze target

Microblaze little-endian toolchain should export
__MICROBLAZEEL__.

Signed-off-by: Michal Simek <monstr@monstr.eu>


# 6260fb04 12-Apr-2010 Peter Tyser <ptyser@xes-inc.com>

microblaze: Move cpu/microblaze/* to arch/microblaze/cpu/*

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>