History log of /u-boot/board/xilinx/versal/board.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# d678a59d 18-May-2024 Tom Rini <trini@konsulko.com>

Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""

When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay
Ethernet"' I failed to notice that b4 noticed it was based on next and
so took that as the base commit and merged that part of next to master.

This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing
changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35.

Reported-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 5ef71012 30-Apr-2024 Tom Rini <trini@konsulko.com>

board: xilinx: Remove <common.h> and add needed includes

Remove <common.h> from this board vendor directory and when needed
add missing include files directly.

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

# 097ccdf9 21-Mar-2024 Michal Simek <michal.simek@amd.com>

xilinx: Do not call private env_get_location() when !ENV_IS_NOWHERE

Private function for finding out location of environment is not working
when ENV_IS_NOWHERE is disabled.
The reason is that current fallback is ENVL_UNKNOWN when
CONFIG_ENV_IS_NOWHERE is not enabled. The code could be updated like this

- return ENVL_NOWHERE;
+ if (IS_ENABLED(CONFIG_ENV_IS_NOWHERE))
+ return ENVL_NOWHERE;
+ return ENVL_UNKNOWN;

But then boot is still not working because ENVL_UNKNOWN has no driver and
env_init() returns -ENODEV. That's why it is better not to define board
specific env_get_location() because then weak env_get_location() is used
which is going over env_locations[] and returning locations which are
actually enabled in u-boot instance.

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

# facfa565 08-Oct-2023 Polak, Leszek <LPolak@arri.de>

arm64: versal: Add SelectMAP boot mode identification

The SelectMAP configuration interface provides an 8-bit,
16-bit or 32-bit bidirectional data bus interface to the Versal FPGA
configuration logic that can be used for both configuration and readback.

A connected microcontoller to the SelectMAP interface can load boot
image with bitstream, TF-A (ARM Trusted Firmware) and U-Boot.

This commit adds the missing identification of the SelectMAP mode.

Signed-off-by: Polak, Leszek <LPolak@arri.de>
Reviewed-by: Stefan Roese <sr@denx.de>
Cc: Michal Simek <michal.simek@amd.com>
Cc: Stefan Roese <sr@denx.de>
Link: https://lore.kernel.org/r/DU0PR07MB8419F7765892CDBCE7D559C5C8CFA@DU0PR07MB8419.eurprd07.prod.outlook.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 6ec17a2c 05-Sep-2023 Michal Simek <michal.simek@amd.com>

arm64: xilinx: Guard distro boot variable generation

When distro boot is disabled there is no reason to generate variables for
it. Also do not update boot_targets variable because it would be unused.

It is useful for example when standard boot is enabled and distro boot
is disabled.

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

# b687f5d2 03-Sep-2023 Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>

xilinx: versal: Do not setup boot_targets if driver is not enabled

SOC can boot in the device which is not accessible from APU and running
this is detected as error which ends up in stopping boot process.
Boot mode detection and logic around is present to setup priority on boot
devices that SOC boot device is likely also used for booting OS.
Change logic to detect this case with showing message about it but don't fail
in boot process and don't prioritize boot device in this case.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20230904032035.11926-3-venkatesh.abbarapu@amd.com

# 174d7284 10-Jul-2023 Michal Simek <michal.simek@amd.com>

arm64: zynqmp: Switch to amd.com emails

Update my and DPs email address to match current setup.

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

# b2561c5b 05-Feb-2023 Simon Glass <sjg@chromium.org>

Correct SPL uses of ENV_VARS_UBOOT_RUNTIME_CONFIG

This converts 4 usages of this option to the non-SPL form, since there is
no SPL_ENV_VARS_UBOOT_RUNTIME_CONFIG defined in Kconfig

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

# 1d15612b 19-Jan-2023 Algapally Santosh Sagar <santoshsagar.algapally@amd.com>

xilinx: versal: Add missing header

Add missing prototype to fix the sparse warning, warning: no
previous prototype for 'do_go_exec' [-Wmissing-prototypes].

Signed-off-by: Algapally Santosh Sagar <santoshsagar.algapally@amd.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20230120053617.32463-4-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

# a32c3e9e 25-Aug-2022 Michal Simek <michal.simek@amd.com>

arm64: xilinx: Move board_get_usable_ram_top() to common location

The commit ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory
location") adds functionality for ZynqMP to read reserved memory node and
do not place U-Boot to reserved location. This functionality is generic
across all Xilinx SOCs that's why move it to common location to be used by
all Xilinx SOCs.

On zynq platform this is also fixing issue where U-Boot was placed to
locating which was reserved already which ends up with error message
"ERROR: reserving fdt memory region failed (addr=30000000 size=10000000
flags=4)" which is shown when bdinfo is called.

Tested on vck190, zcu102, zc706 and kc705 to cover all platforms.

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

# d7fcbfc1 22-Jul-2022 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

fpga: xilinx: add bitstream flags to driver desc

Store a set of supported bitstream types in xilinx_desc structure.
It will be used to determine whether an FPGA image is able to be
loaded with a given driver.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Tested-by: Ricardo Salveti <ricardo@foundries.io>
Tested-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
Link: https://lore.kernel.org/r/20220722141614.297383-4-oleksandr.suvorov@foundries.io
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 2eeceb48 05-May-2022 Ashok Reddy Soma <ashok.reddy.soma@amd.com>

arm64: versal: Add support to load an app at EL1

Add support to switch to EL1 and load an EL1 app from U-Boot which is
executing at EL2 or EL3 in aarch64 mode.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Link: https://lore.kernel.org/r/20220506055345.1921-1-ashok.reddy.soma@xilinx.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 9c563e91 29-Apr-2022 Michal Simek <michal.simek@amd.com>

xilinx: Handle board_get_usable_ram_top(0) properly

board_get_usable_ram_top() was designed for getting the top most location
for U-Boot allocation that's why function itself supports via total_size
parameter to find out where the right location for U-Boot is.
But function itself is also reused by different (EFI) which is passing
total_size as 0 to find out where the usable ram top is. For this case
doesn't make sense (a waste time) to call any lmb functions.
That's why simply return gd->ram_top.

And gd->ram_top is filled already based on previous call for U-Boot iself.
The same solution is also used by stm32mp by commit 92b611e8b003 ("stm32mp:
correctly handle board_get_usable_ram_top(0)") and commit c8510e397fad
("stm32mp: Fix board_get_usable_ram_top()").

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

# d8c033a9 13-Apr-2022 Peng Fan <peng.fan@nxp.com>

xilinx: versal: board: use CONFIG_COUNTER_FREQUENCY

Since versal has CONFIG_COUNTER_FREQUENCY, so use it. And
COUNTER_FREQUENCY will be dropped.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>

# f66d0b53 17-Mar-2022 Michal Simek <michal.simek@amd.com>

arm64: versal: Do not place u-boot to reserved memory location

Versal can also have reserved space in DT which u-boot has to avoid to
placing self to that location. The same change was done in ZynqMP by commit
ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory location")
and also for microblaze by commit d7b5cc89d329 ("microblaze: Do not place
u-boot to reserved memory location").

The patch was tested by adding reserved-memory node to DT and check via
bdinfo back.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/15426fa6d64835dd23c5c8c12bbfc97306fb6098.1647527129.git.michal.simek@xilinx.com

# bf97c460 23-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

versal: Return ENVL_NOWHERE instead of ENVL_UNKNOWN

The system fails to boot without any environment location, so return
ENVL_NOWHERE when there's nowhere to store the environment instead
of ENVL_UNKNOWN.

The same change was also done by commit 50918d0df5cb ("xilinx: Return
ENVL_NOWHERE instead of ENVL_UNKNOWN") for zynq and zynqmp.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/e4ed36408f10159677ed8060bfd5289f3e0691fa.1637752614.git.michal.simek@xilinx.com

# 5f4e1ff7 17-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Fix sdhci node name as per DT

Fix the sdhci node name in versal board file as per the name in
device tree and also check for sdhci node as part of backward
compatibility.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/9110ecdabcabcef63fffd4719095acf4326a26e4.1637236638.git.michal.simek@xilinx.com

# 82cb49dc 30-Mar-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Add usb dfu/thor distro boot support

Change "dfu_usb" to "usb_dfu" for better representation and change
required macros. Add 60s timeout of dfu-utils to start transaction.
Add support for usb thor to distro boot. Remove DFU_ALT_INFO_RAM
as we use bootcmd_usb_dfu instead of dfu_ram.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 4fb83c9c 23-Feb-2021 Ashok Reddy Soma <ashok.reddy.soma@amd.com>

xilinx: versal: Add support for saving env based on bootmode

Enable saving variables to MMC(FAT) and SPI based on primary
bootmode. If bootmode is JTAG, dont save env anywhere(NOWHERE).

Enable ENV_FAT_DEVICE_AND_PART="0:auto" for Versal platforms as well.

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

# 35b65dd8 15-Dec-2020 Harald Seiler <hws@denx.de>

reset: Remove addr parameter from reset_cpu()

Historically, the reset_cpu() function had an `addr` parameter which was
meant to pass in an address of the reset vector location, where the CPU
should reset to. This feature is no longer used anywhere in U-Boot as
all reset_cpu() implementations now ignore the passed value. Generic
code has been added which always calls reset_cpu() with `0` which means
this feature can no longer be used easily anyway.

Over time, many implementations seem to have "misunderstood" the
existence of this parameter as a way to customize/parameterize the reset
(e.g. COLD vs WARM resets). As this is not properly supported, the
code will almost always not do what it is intended to (because all
call-sites just call reset_cpu() with 0).

To avoid confusion and to clean up the codebase from unused left-overs
of the past, remove the `addr` parameter entirely. Code which intends
to support different kinds of resets should be rewritten as a sysreset
driver instead.

This transformation was done with the following coccinelle patch:

@@
expression argvalue;
@@
- reset_cpu(argvalue)
+ reset_cpu()

@@
identifier argname;
type argtype;
@@
- reset_cpu(argtype argname)
+ reset_cpu(void)
{ ... }

Signed-off-by: Harald Seiler <hws@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

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

common: Drop asm/global_data.h from common header

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

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

# 8b85dfc6 16-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Avoid accessing seq directly

At present various drivers etc. access the device's 'seq' member directly.
This makes it harder to change the meaning of that member. Change access
to go through a function instead.

The drivers/i2c/lpc32xx_i2c.c file is left unchanged for now.

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

# d61728c8 03-Aug-2020 Michal Simek <michal.simek@amd.com>

xilinx: board: Read the whole eeprom not just offset

Starts to use new way how eeproms should be referenced.
Reference is done via nvmem alias nodes. When this new way is specified
code itself read the eeprom and decode xilinx legacy format and fill struct
xilinx_board_description. Then based on information present there board_*
variables are setup.
If variables are saved and content can't be changed information is just
shown on console.

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

# 62b96262 27-Jul-2020 Michal Simek <michal.simek@amd.com>

xilinx: Add support for ENV_VARS_UBOOT_RUNTIME_CONFIG

Start to use ENV_VARS_UBOOT_RUNTIME_CONFIG to enable/disable updating
variables with run time information.

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

# 22b6bb6c 09-Jul-2020 Michal Simek <michal.simek@amd.com>

xilinx: versal: Use lowest memory for U-Boot

Find and use the lowest memory for Versal to make sure that we keep u-boot
as low as possible and never use memory above u-boot's maximum VA mapping.

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

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

common: Drop log.h from common header

Move this header out of the common header.

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

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

command: Remove the cmd_tbl_t typedef

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

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

This requires quite a few header-file additions.

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

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

common: Drop net.h from common header

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

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

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

# 51f6c52e 08-Apr-2020 Michal Simek <michal.simek@amd.com>

xilinx: Move bootmode detection to separate function

Create special function for reading bootmode on Versal and ZynqMP.
Zynq is using specific function (without mask) already.
Future patches will be calling this function from different location too.

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

# a29511ee 08-Apr-2020 Michal Simek <michal.simek@amd.com>

xilinx: Move initrd_high setup to common location

Moving to common location initrd_high is also setup for Zynq which hasn't
done in run time code.

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

# 80fdef12 30-Mar-2020 Michal Simek <michal.simek@amd.com>

xilinx: Introduce board_late_init_xilinx()

This function should keep common shared late configurations for Xilinx
SoCs.

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

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

common: Move reset_cpu() to the CPU header

Move this function out of common.h and into a relevant header file.

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

# 53c69dec 18-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

board: xilinx: Add support for user configurable boot script offset

Currently "script_offset_f" env variable is hardcoded, this variable
specifies from which offset of the flash boot.scr should be read/write.
As flashes are of different sizes having a fixed offset makes it
difficult to load other images into the flash which may overwrite the
boot script or cannot utilize the full memory. This current fix
creates a new config "CONFIG_BOOT_SCRIPT_OFFSET" which holds the
offset address, overwrites the "script_offset_f" variable.
Also removed existing variable with default values, as the default
values are held by CONFIG_BOOT_SCRIPT_OFFSET

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c5b7bb1 16-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Fix emmc boot mode boot_target issue

Emmc boot devcie is mounted to sdhci@f1050000 controller on versal, while
in emmc boot mode, boot tragets are set to mmc0. So removed mmc0 and using
the dev seq number from the sdhci@f1050000 controller.
Dev seq number is setup based on DT aliases that's why needs to be setup at
run time.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

common: Move some board functions out of common.h

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

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

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

common: Move get_ticks() function out of common.h

This function belongs in time.h so move it over and add a comment.

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

# f0c16cd6 11-Jul-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Add new dfu usb distro boot command

This patch adds new dfu usb distro boot command to look for bootscript
from dfu-util and runs it.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>

# 3d865acb 25-Jun-2019 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

arm64: versal: Add new jtag distro boot command

This patch adds new jtag distro boot command to look for bootscript file
in DDR and execute it first incase of jtag bootmode.
This patch also updates scriptaddr to 512MB as there is high of script
corruption incase of bigger kernel image.

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

# aef149e9 29-Apr-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Enable memory mapping via DT

Code reads DT and setup MMU table based on memory node. This will ensure
that only DT needs to be changed.

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

# 085201c2 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

arm64: versal: Set initrd_high to as high as possible

This patch is setting up the initrd_high to as high as possible by leaving
max stack size for u-boot so that bigger rootfs can also be loaded by
u-boot for booting kernel.

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

# 26e054c9 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

arm64: versal: fpga: Add PL bit stream load support

This patch adds PL bitstream load support for Versal platform. The PL
bitstream is loaded by making an SMC to ATF which in turn communicates
with platform firmware which configures and loads PL bitstream on to PL.

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

# bfd092f9 31-Jan-2019 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

arm64: versal: Define board_late_init for versal

Define board_late_init which performs bootmode detection
and prepares corresponding distro boot commaand sequence.

Also disable it for mini platforms because simply there is no need to have
it enabled.
But also disable it for virtual platform because Qemu is not modelling this
register space that's why travis testing would fail. This configuration
should be reverted when mainline Qemu is updated.

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

# 47a766f9 28-Jan-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig

Move hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up
for different platforms.

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

# fb771793 28-Jan-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Remove one level of indentation in board_early_init_r()

Simplify code indentation.

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

# ec48b6c9 22-Aug-2018 Michal Simek <michal.simek@amd.com>

arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
Engines with leading-edge memory and interfacing technologies to deliver
powerful heterogeneous acceleration for any application. The Versal AI
Core series has five devices, offering 128 to 400 AI Engines. The series
includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
than 1,900 DSP engines optimized for high-precision floating point with
low latency.

The patch is adding necessary infrastructure in place without enabling
platform which is done in separate patch.

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

# 5ef71012 30-Apr-2024 Tom Rini <trini@konsulko.com>

board: xilinx: Remove <common.h> and add needed includes

Remove <common.h> from this board vendor directory and when needed
add missing include files directly.

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

# 097ccdf9 21-Mar-2024 Michal Simek <michal.simek@amd.com>

xilinx: Do not call private env_get_location() when !ENV_IS_NOWHERE

Private function for finding out location of environment is not working
when ENV_IS_NOWHERE is disabled.
The reason is that current fallback is ENVL_UNKNOWN when
CONFIG_ENV_IS_NOWHERE is not enabled. The code could be updated like this

- return ENVL_NOWHERE;
+ if (IS_ENABLED(CONFIG_ENV_IS_NOWHERE))
+ return ENVL_NOWHERE;
+ return ENVL_UNKNOWN;

But then boot is still not working because ENVL_UNKNOWN has no driver and
env_init() returns -ENODEV. That's why it is better not to define board
specific env_get_location() because then weak env_get_location() is used
which is going over env_locations[] and returning locations which are
actually enabled in u-boot instance.

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

# facfa565 08-Oct-2023 Polak, Leszek <LPolak@arri.de>

arm64: versal: Add SelectMAP boot mode identification

The SelectMAP configuration interface provides an 8-bit,
16-bit or 32-bit bidirectional data bus interface to the Versal FPGA
configuration logic that can be used for both configuration and readback.

A connected microcontoller to the SelectMAP interface can load boot
image with bitstream, TF-A (ARM Trusted Firmware) and U-Boot.

This commit adds the missing identification of the SelectMAP mode.

Signed-off-by: Polak, Leszek <LPolak@arri.de>
Reviewed-by: Stefan Roese <sr@denx.de>
Cc: Michal Simek <michal.simek@amd.com>
Cc: Stefan Roese <sr@denx.de>
Link: https://lore.kernel.org/r/DU0PR07MB8419F7765892CDBCE7D559C5C8CFA@DU0PR07MB8419.eurprd07.prod.outlook.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 6ec17a2c 05-Sep-2023 Michal Simek <michal.simek@amd.com>

arm64: xilinx: Guard distro boot variable generation

When distro boot is disabled there is no reason to generate variables for
it. Also do not update boot_targets variable because it would be unused.

It is useful for example when standard boot is enabled and distro boot
is disabled.

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

# b687f5d2 03-Sep-2023 Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>

xilinx: versal: Do not setup boot_targets if driver is not enabled

SOC can boot in the device which is not accessible from APU and running
this is detected as error which ends up in stopping boot process.
Boot mode detection and logic around is present to setup priority on boot
devices that SOC boot device is likely also used for booting OS.
Change logic to detect this case with showing message about it but don't fail
in boot process and don't prioritize boot device in this case.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20230904032035.11926-3-venkatesh.abbarapu@amd.com

# 174d7284 10-Jul-2023 Michal Simek <michal.simek@amd.com>

arm64: zynqmp: Switch to amd.com emails

Update my and DPs email address to match current setup.

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

# b2561c5b 05-Feb-2023 Simon Glass <sjg@chromium.org>

Correct SPL uses of ENV_VARS_UBOOT_RUNTIME_CONFIG

This converts 4 usages of this option to the non-SPL form, since there is
no SPL_ENV_VARS_UBOOT_RUNTIME_CONFIG defined in Kconfig

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

# 1d15612b 19-Jan-2023 Algapally Santosh Sagar <santoshsagar.algapally@amd.com>

xilinx: versal: Add missing header

Add missing prototype to fix the sparse warning, warning: no
previous prototype for 'do_go_exec' [-Wmissing-prototypes].

Signed-off-by: Algapally Santosh Sagar <santoshsagar.algapally@amd.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20230120053617.32463-4-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

# a32c3e9e 25-Aug-2022 Michal Simek <michal.simek@amd.com>

arm64: xilinx: Move board_get_usable_ram_top() to common location

The commit ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory
location") adds functionality for ZynqMP to read reserved memory node and
do not place U-Boot to reserved location. This functionality is generic
across all Xilinx SOCs that's why move it to common location to be used by
all Xilinx SOCs.

On zynq platform this is also fixing issue where U-Boot was placed to
locating which was reserved already which ends up with error message
"ERROR: reserving fdt memory region failed (addr=30000000 size=10000000
flags=4)" which is shown when bdinfo is called.

Tested on vck190, zcu102, zc706 and kc705 to cover all platforms.

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

# d7fcbfc1 22-Jul-2022 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

fpga: xilinx: add bitstream flags to driver desc

Store a set of supported bitstream types in xilinx_desc structure.
It will be used to determine whether an FPGA image is able to be
loaded with a given driver.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Tested-by: Ricardo Salveti <ricardo@foundries.io>
Tested-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
Link: https://lore.kernel.org/r/20220722141614.297383-4-oleksandr.suvorov@foundries.io
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 2eeceb48 05-May-2022 Ashok Reddy Soma <ashok.reddy.soma@amd.com>

arm64: versal: Add support to load an app at EL1

Add support to switch to EL1 and load an EL1 app from U-Boot which is
executing at EL2 or EL3 in aarch64 mode.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Link: https://lore.kernel.org/r/20220506055345.1921-1-ashok.reddy.soma@xilinx.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 9c563e91 29-Apr-2022 Michal Simek <michal.simek@amd.com>

xilinx: Handle board_get_usable_ram_top(0) properly

board_get_usable_ram_top() was designed for getting the top most location
for U-Boot allocation that's why function itself supports via total_size
parameter to find out where the right location for U-Boot is.
But function itself is also reused by different (EFI) which is passing
total_size as 0 to find out where the usable ram top is. For this case
doesn't make sense (a waste time) to call any lmb functions.
That's why simply return gd->ram_top.

And gd->ram_top is filled already based on previous call for U-Boot iself.
The same solution is also used by stm32mp by commit 92b611e8b003 ("stm32mp:
correctly handle board_get_usable_ram_top(0)") and commit c8510e397fad
("stm32mp: Fix board_get_usable_ram_top()").

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

# d8c033a9 13-Apr-2022 Peng Fan <peng.fan@nxp.com>

xilinx: versal: board: use CONFIG_COUNTER_FREQUENCY

Since versal has CONFIG_COUNTER_FREQUENCY, so use it. And
COUNTER_FREQUENCY will be dropped.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>

# f66d0b53 17-Mar-2022 Michal Simek <michal.simek@amd.com>

arm64: versal: Do not place u-boot to reserved memory location

Versal can also have reserved space in DT which u-boot has to avoid to
placing self to that location. The same change was done in ZynqMP by commit
ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory location")
and also for microblaze by commit d7b5cc89d329 ("microblaze: Do not place
u-boot to reserved memory location").

The patch was tested by adding reserved-memory node to DT and check via
bdinfo back.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/15426fa6d64835dd23c5c8c12bbfc97306fb6098.1647527129.git.michal.simek@xilinx.com

# bf97c460 23-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

versal: Return ENVL_NOWHERE instead of ENVL_UNKNOWN

The system fails to boot without any environment location, so return
ENVL_NOWHERE when there's nowhere to store the environment instead
of ENVL_UNKNOWN.

The same change was also done by commit 50918d0df5cb ("xilinx: Return
ENVL_NOWHERE instead of ENVL_UNKNOWN") for zynq and zynqmp.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/e4ed36408f10159677ed8060bfd5289f3e0691fa.1637752614.git.michal.simek@xilinx.com

# 5f4e1ff7 17-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Fix sdhci node name as per DT

Fix the sdhci node name in versal board file as per the name in
device tree and also check for sdhci node as part of backward
compatibility.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/9110ecdabcabcef63fffd4719095acf4326a26e4.1637236638.git.michal.simek@xilinx.com

# 82cb49dc 30-Mar-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Add usb dfu/thor distro boot support

Change "dfu_usb" to "usb_dfu" for better representation and change
required macros. Add 60s timeout of dfu-utils to start transaction.
Add support for usb thor to distro boot. Remove DFU_ALT_INFO_RAM
as we use bootcmd_usb_dfu instead of dfu_ram.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 4fb83c9c 23-Feb-2021 Ashok Reddy Soma <ashok.reddy.soma@amd.com>

xilinx: versal: Add support for saving env based on bootmode

Enable saving variables to MMC(FAT) and SPI based on primary
bootmode. If bootmode is JTAG, dont save env anywhere(NOWHERE).

Enable ENV_FAT_DEVICE_AND_PART="0:auto" for Versal platforms as well.

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

# 35b65dd8 15-Dec-2020 Harald Seiler <hws@denx.de>

reset: Remove addr parameter from reset_cpu()

Historically, the reset_cpu() function had an `addr` parameter which was
meant to pass in an address of the reset vector location, where the CPU
should reset to. This feature is no longer used anywhere in U-Boot as
all reset_cpu() implementations now ignore the passed value. Generic
code has been added which always calls reset_cpu() with `0` which means
this feature can no longer be used easily anyway.

Over time, many implementations seem to have "misunderstood" the
existence of this parameter as a way to customize/parameterize the reset
(e.g. COLD vs WARM resets). As this is not properly supported, the
code will almost always not do what it is intended to (because all
call-sites just call reset_cpu() with 0).

To avoid confusion and to clean up the codebase from unused left-overs
of the past, remove the `addr` parameter entirely. Code which intends
to support different kinds of resets should be rewritten as a sysreset
driver instead.

This transformation was done with the following coccinelle patch:

@@
expression argvalue;
@@
- reset_cpu(argvalue)
+ reset_cpu()

@@
identifier argname;
type argtype;
@@
- reset_cpu(argtype argname)
+ reset_cpu(void)
{ ... }

Signed-off-by: Harald Seiler <hws@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

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

common: Drop asm/global_data.h from common header

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

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

# 8b85dfc6 16-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Avoid accessing seq directly

At present various drivers etc. access the device's 'seq' member directly.
This makes it harder to change the meaning of that member. Change access
to go through a function instead.

The drivers/i2c/lpc32xx_i2c.c file is left unchanged for now.

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

# d61728c8 03-Aug-2020 Michal Simek <michal.simek@amd.com>

xilinx: board: Read the whole eeprom not just offset

Starts to use new way how eeproms should be referenced.
Reference is done via nvmem alias nodes. When this new way is specified
code itself read the eeprom and decode xilinx legacy format and fill struct
xilinx_board_description. Then based on information present there board_*
variables are setup.
If variables are saved and content can't be changed information is just
shown on console.

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

# 62b96262 27-Jul-2020 Michal Simek <michal.simek@amd.com>

xilinx: Add support for ENV_VARS_UBOOT_RUNTIME_CONFIG

Start to use ENV_VARS_UBOOT_RUNTIME_CONFIG to enable/disable updating
variables with run time information.

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

# 22b6bb6c 09-Jul-2020 Michal Simek <michal.simek@amd.com>

xilinx: versal: Use lowest memory for U-Boot

Find and use the lowest memory for Versal to make sure that we keep u-boot
as low as possible and never use memory above u-boot's maximum VA mapping.

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

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

common: Drop log.h from common header

Move this header out of the common header.

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

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

command: Remove the cmd_tbl_t typedef

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

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

This requires quite a few header-file additions.

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

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

common: Drop net.h from common header

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

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

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

# 51f6c52e 08-Apr-2020 Michal Simek <michal.simek@amd.com>

xilinx: Move bootmode detection to separate function

Create special function for reading bootmode on Versal and ZynqMP.
Zynq is using specific function (without mask) already.
Future patches will be calling this function from different location too.

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

# a29511ee 08-Apr-2020 Michal Simek <michal.simek@amd.com>

xilinx: Move initrd_high setup to common location

Moving to common location initrd_high is also setup for Zynq which hasn't
done in run time code.

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

# 80fdef12 30-Mar-2020 Michal Simek <michal.simek@amd.com>

xilinx: Introduce board_late_init_xilinx()

This function should keep common shared late configurations for Xilinx
SoCs.

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

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

common: Move reset_cpu() to the CPU header

Move this function out of common.h and into a relevant header file.

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

# 53c69dec 18-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

board: xilinx: Add support for user configurable boot script offset

Currently "script_offset_f" env variable is hardcoded, this variable
specifies from which offset of the flash boot.scr should be read/write.
As flashes are of different sizes having a fixed offset makes it
difficult to load other images into the flash which may overwrite the
boot script or cannot utilize the full memory. This current fix
creates a new config "CONFIG_BOOT_SCRIPT_OFFSET" which holds the
offset address, overwrites the "script_offset_f" variable.
Also removed existing variable with default values, as the default
values are held by CONFIG_BOOT_SCRIPT_OFFSET

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c5b7bb1 16-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Fix emmc boot mode boot_target issue

Emmc boot devcie is mounted to sdhci@f1050000 controller on versal, while
in emmc boot mode, boot tragets are set to mmc0. So removed mmc0 and using
the dev seq number from the sdhci@f1050000 controller.
Dev seq number is setup based on DT aliases that's why needs to be setup at
run time.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

common: Move some board functions out of common.h

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

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

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

common: Move get_ticks() function out of common.h

This function belongs in time.h so move it over and add a comment.

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

# f0c16cd6 11-Jul-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Add new dfu usb distro boot command

This patch adds new dfu usb distro boot command to look for bootscript
from dfu-util and runs it.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>

# 3d865acb 25-Jun-2019 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

arm64: versal: Add new jtag distro boot command

This patch adds new jtag distro boot command to look for bootscript file
in DDR and execute it first incase of jtag bootmode.
This patch also updates scriptaddr to 512MB as there is high of script
corruption incase of bigger kernel image.

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

# aef149e9 29-Apr-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Enable memory mapping via DT

Code reads DT and setup MMU table based on memory node. This will ensure
that only DT needs to be changed.

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

# 085201c2 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

arm64: versal: Set initrd_high to as high as possible

This patch is setting up the initrd_high to as high as possible by leaving
max stack size for u-boot so that bigger rootfs can also be loaded by
u-boot for booting kernel.

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

# 26e054c9 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

arm64: versal: fpga: Add PL bit stream load support

This patch adds PL bitstream load support for Versal platform. The PL
bitstream is loaded by making an SMC to ATF which in turn communicates
with platform firmware which configures and loads PL bitstream on to PL.

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

# bfd092f9 31-Jan-2019 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

arm64: versal: Define board_late_init for versal

Define board_late_init which performs bootmode detection
and prepares corresponding distro boot commaand sequence.

Also disable it for mini platforms because simply there is no need to have
it enabled.
But also disable it for virtual platform because Qemu is not modelling this
register space that's why travis testing would fail. This configuration
should be reverted when mainline Qemu is updated.

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

# 47a766f9 28-Jan-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig

Move hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up
for different platforms.

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

# fb771793 28-Jan-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Remove one level of indentation in board_early_init_r()

Simplify code indentation.

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

# ec48b6c9 22-Aug-2018 Michal Simek <michal.simek@amd.com>

arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
Engines with leading-edge memory and interfacing technologies to deliver
powerful heterogeneous acceleration for any application. The Versal AI
Core series has five devices, offering 128 to 400 AI Engines. The series
includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
than 1,900 DSP engines optimized for high-precision floating point with
low latency.

The patch is adding necessary infrastructure in place without enabling
platform which is done in separate patch.

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

# 097ccdf9 21-Mar-2024 Michal Simek <michal.simek@amd.com>

xilinx: Do not call private env_get_location() when !ENV_IS_NOWHERE

Private function for finding out location of environment is not working
when ENV_IS_NOWHERE is disabled.
The reason is that current fallback is ENVL_UNKNOWN when
CONFIG_ENV_IS_NOWHERE is not enabled. The code could be updated like this

- return ENVL_NOWHERE;
+ if (IS_ENABLED(CONFIG_ENV_IS_NOWHERE))
+ return ENVL_NOWHERE;
+ return ENVL_UNKNOWN;

But then boot is still not working because ENVL_UNKNOWN has no driver and
env_init() returns -ENODEV. That's why it is better not to define board
specific env_get_location() because then weak env_get_location() is used
which is going over env_locations[] and returning locations which are
actually enabled in u-boot instance.

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

# facfa565 08-Oct-2023 Polak, Leszek <LPolak@arri.de>

arm64: versal: Add SelectMAP boot mode identification

The SelectMAP configuration interface provides an 8-bit,
16-bit or 32-bit bidirectional data bus interface to the Versal FPGA
configuration logic that can be used for both configuration and readback.

A connected microcontoller to the SelectMAP interface can load boot
image with bitstream, TF-A (ARM Trusted Firmware) and U-Boot.

This commit adds the missing identification of the SelectMAP mode.

Signed-off-by: Polak, Leszek <LPolak@arri.de>
Reviewed-by: Stefan Roese <sr@denx.de>
Cc: Michal Simek <michal.simek@amd.com>
Cc: Stefan Roese <sr@denx.de>
Link: https://lore.kernel.org/r/DU0PR07MB8419F7765892CDBCE7D559C5C8CFA@DU0PR07MB8419.eurprd07.prod.outlook.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 6ec17a2c 05-Sep-2023 Michal Simek <michal.simek@amd.com>

arm64: xilinx: Guard distro boot variable generation

When distro boot is disabled there is no reason to generate variables for
it. Also do not update boot_targets variable because it would be unused.

It is useful for example when standard boot is enabled and distro boot
is disabled.

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

# b687f5d2 03-Sep-2023 Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>

xilinx: versal: Do not setup boot_targets if driver is not enabled

SOC can boot in the device which is not accessible from APU and running
this is detected as error which ends up in stopping boot process.
Boot mode detection and logic around is present to setup priority on boot
devices that SOC boot device is likely also used for booting OS.
Change logic to detect this case with showing message about it but don't fail
in boot process and don't prioritize boot device in this case.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20230904032035.11926-3-venkatesh.abbarapu@amd.com

# 174d7284 10-Jul-2023 Michal Simek <michal.simek@amd.com>

arm64: zynqmp: Switch to amd.com emails

Update my and DPs email address to match current setup.

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

# b2561c5b 05-Feb-2023 Simon Glass <sjg@chromium.org>

Correct SPL uses of ENV_VARS_UBOOT_RUNTIME_CONFIG

This converts 4 usages of this option to the non-SPL form, since there is
no SPL_ENV_VARS_UBOOT_RUNTIME_CONFIG defined in Kconfig

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

# 1d15612b 19-Jan-2023 Algapally Santosh Sagar <santoshsagar.algapally@amd.com>

xilinx: versal: Add missing header

Add missing prototype to fix the sparse warning, warning: no
previous prototype for 'do_go_exec' [-Wmissing-prototypes].

Signed-off-by: Algapally Santosh Sagar <santoshsagar.algapally@amd.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20230120053617.32463-4-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

# a32c3e9e 25-Aug-2022 Michal Simek <michal.simek@amd.com>

arm64: xilinx: Move board_get_usable_ram_top() to common location

The commit ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory
location") adds functionality for ZynqMP to read reserved memory node and
do not place U-Boot to reserved location. This functionality is generic
across all Xilinx SOCs that's why move it to common location to be used by
all Xilinx SOCs.

On zynq platform this is also fixing issue where U-Boot was placed to
locating which was reserved already which ends up with error message
"ERROR: reserving fdt memory region failed (addr=30000000 size=10000000
flags=4)" which is shown when bdinfo is called.

Tested on vck190, zcu102, zc706 and kc705 to cover all platforms.

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

# d7fcbfc1 22-Jul-2022 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

fpga: xilinx: add bitstream flags to driver desc

Store a set of supported bitstream types in xilinx_desc structure.
It will be used to determine whether an FPGA image is able to be
loaded with a given driver.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Tested-by: Ricardo Salveti <ricardo@foundries.io>
Tested-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
Link: https://lore.kernel.org/r/20220722141614.297383-4-oleksandr.suvorov@foundries.io
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 2eeceb48 05-May-2022 Ashok Reddy Soma <ashok.reddy.soma@amd.com>

arm64: versal: Add support to load an app at EL1

Add support to switch to EL1 and load an EL1 app from U-Boot which is
executing at EL2 or EL3 in aarch64 mode.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Link: https://lore.kernel.org/r/20220506055345.1921-1-ashok.reddy.soma@xilinx.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 9c563e91 29-Apr-2022 Michal Simek <michal.simek@amd.com>

xilinx: Handle board_get_usable_ram_top(0) properly

board_get_usable_ram_top() was designed for getting the top most location
for U-Boot allocation that's why function itself supports via total_size
parameter to find out where the right location for U-Boot is.
But function itself is also reused by different (EFI) which is passing
total_size as 0 to find out where the usable ram top is. For this case
doesn't make sense (a waste time) to call any lmb functions.
That's why simply return gd->ram_top.

And gd->ram_top is filled already based on previous call for U-Boot iself.
The same solution is also used by stm32mp by commit 92b611e8b003 ("stm32mp:
correctly handle board_get_usable_ram_top(0)") and commit c8510e397fad
("stm32mp: Fix board_get_usable_ram_top()").

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

# d8c033a9 13-Apr-2022 Peng Fan <peng.fan@nxp.com>

xilinx: versal: board: use CONFIG_COUNTER_FREQUENCY

Since versal has CONFIG_COUNTER_FREQUENCY, so use it. And
COUNTER_FREQUENCY will be dropped.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>

# f66d0b53 17-Mar-2022 Michal Simek <michal.simek@amd.com>

arm64: versal: Do not place u-boot to reserved memory location

Versal can also have reserved space in DT which u-boot has to avoid to
placing self to that location. The same change was done in ZynqMP by commit
ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory location")
and also for microblaze by commit d7b5cc89d329 ("microblaze: Do not place
u-boot to reserved memory location").

The patch was tested by adding reserved-memory node to DT and check via
bdinfo back.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/15426fa6d64835dd23c5c8c12bbfc97306fb6098.1647527129.git.michal.simek@xilinx.com

# bf97c460 23-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

versal: Return ENVL_NOWHERE instead of ENVL_UNKNOWN

The system fails to boot without any environment location, so return
ENVL_NOWHERE when there's nowhere to store the environment instead
of ENVL_UNKNOWN.

The same change was also done by commit 50918d0df5cb ("xilinx: Return
ENVL_NOWHERE instead of ENVL_UNKNOWN") for zynq and zynqmp.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/e4ed36408f10159677ed8060bfd5289f3e0691fa.1637752614.git.michal.simek@xilinx.com

# 5f4e1ff7 17-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Fix sdhci node name as per DT

Fix the sdhci node name in versal board file as per the name in
device tree and also check for sdhci node as part of backward
compatibility.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/9110ecdabcabcef63fffd4719095acf4326a26e4.1637236638.git.michal.simek@xilinx.com

# 82cb49dc 30-Mar-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Add usb dfu/thor distro boot support

Change "dfu_usb" to "usb_dfu" for better representation and change
required macros. Add 60s timeout of dfu-utils to start transaction.
Add support for usb thor to distro boot. Remove DFU_ALT_INFO_RAM
as we use bootcmd_usb_dfu instead of dfu_ram.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 4fb83c9c 23-Feb-2021 Ashok Reddy Soma <ashok.reddy.soma@amd.com>

xilinx: versal: Add support for saving env based on bootmode

Enable saving variables to MMC(FAT) and SPI based on primary
bootmode. If bootmode is JTAG, dont save env anywhere(NOWHERE).

Enable ENV_FAT_DEVICE_AND_PART="0:auto" for Versal platforms as well.

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

# 35b65dd8 15-Dec-2020 Harald Seiler <hws@denx.de>

reset: Remove addr parameter from reset_cpu()

Historically, the reset_cpu() function had an `addr` parameter which was
meant to pass in an address of the reset vector location, where the CPU
should reset to. This feature is no longer used anywhere in U-Boot as
all reset_cpu() implementations now ignore the passed value. Generic
code has been added which always calls reset_cpu() with `0` which means
this feature can no longer be used easily anyway.

Over time, many implementations seem to have "misunderstood" the
existence of this parameter as a way to customize/parameterize the reset
(e.g. COLD vs WARM resets). As this is not properly supported, the
code will almost always not do what it is intended to (because all
call-sites just call reset_cpu() with 0).

To avoid confusion and to clean up the codebase from unused left-overs
of the past, remove the `addr` parameter entirely. Code which intends
to support different kinds of resets should be rewritten as a sysreset
driver instead.

This transformation was done with the following coccinelle patch:

@@
expression argvalue;
@@
- reset_cpu(argvalue)
+ reset_cpu()

@@
identifier argname;
type argtype;
@@
- reset_cpu(argtype argname)
+ reset_cpu(void)
{ ... }

Signed-off-by: Harald Seiler <hws@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

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

common: Drop asm/global_data.h from common header

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

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

# 8b85dfc6 16-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Avoid accessing seq directly

At present various drivers etc. access the device's 'seq' member directly.
This makes it harder to change the meaning of that member. Change access
to go through a function instead.

The drivers/i2c/lpc32xx_i2c.c file is left unchanged for now.

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

# d61728c8 03-Aug-2020 Michal Simek <michal.simek@amd.com>

xilinx: board: Read the whole eeprom not just offset

Starts to use new way how eeproms should be referenced.
Reference is done via nvmem alias nodes. When this new way is specified
code itself read the eeprom and decode xilinx legacy format and fill struct
xilinx_board_description. Then based on information present there board_*
variables are setup.
If variables are saved and content can't be changed information is just
shown on console.

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

# 62b96262 27-Jul-2020 Michal Simek <michal.simek@amd.com>

xilinx: Add support for ENV_VARS_UBOOT_RUNTIME_CONFIG

Start to use ENV_VARS_UBOOT_RUNTIME_CONFIG to enable/disable updating
variables with run time information.

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

# 22b6bb6c 09-Jul-2020 Michal Simek <michal.simek@amd.com>

xilinx: versal: Use lowest memory for U-Boot

Find and use the lowest memory for Versal to make sure that we keep u-boot
as low as possible and never use memory above u-boot's maximum VA mapping.

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

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

common: Drop log.h from common header

Move this header out of the common header.

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

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

command: Remove the cmd_tbl_t typedef

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

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

This requires quite a few header-file additions.

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

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

common: Drop net.h from common header

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

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

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

# 51f6c52e 08-Apr-2020 Michal Simek <michal.simek@amd.com>

xilinx: Move bootmode detection to separate function

Create special function for reading bootmode on Versal and ZynqMP.
Zynq is using specific function (without mask) already.
Future patches will be calling this function from different location too.

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

# a29511ee 08-Apr-2020 Michal Simek <michal.simek@amd.com>

xilinx: Move initrd_high setup to common location

Moving to common location initrd_high is also setup for Zynq which hasn't
done in run time code.

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

# 80fdef12 30-Mar-2020 Michal Simek <michal.simek@amd.com>

xilinx: Introduce board_late_init_xilinx()

This function should keep common shared late configurations for Xilinx
SoCs.

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

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

common: Move reset_cpu() to the CPU header

Move this function out of common.h and into a relevant header file.

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

# 53c69dec 18-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

board: xilinx: Add support for user configurable boot script offset

Currently "script_offset_f" env variable is hardcoded, this variable
specifies from which offset of the flash boot.scr should be read/write.
As flashes are of different sizes having a fixed offset makes it
difficult to load other images into the flash which may overwrite the
boot script or cannot utilize the full memory. This current fix
creates a new config "CONFIG_BOOT_SCRIPT_OFFSET" which holds the
offset address, overwrites the "script_offset_f" variable.
Also removed existing variable with default values, as the default
values are held by CONFIG_BOOT_SCRIPT_OFFSET

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c5b7bb1 16-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Fix emmc boot mode boot_target issue

Emmc boot devcie is mounted to sdhci@f1050000 controller on versal, while
in emmc boot mode, boot tragets are set to mmc0. So removed mmc0 and using
the dev seq number from the sdhci@f1050000 controller.
Dev seq number is setup based on DT aliases that's why needs to be setup at
run time.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

common: Move some board functions out of common.h

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

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

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

common: Move get_ticks() function out of common.h

This function belongs in time.h so move it over and add a comment.

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

# f0c16cd6 11-Jul-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Add new dfu usb distro boot command

This patch adds new dfu usb distro boot command to look for bootscript
from dfu-util and runs it.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>

# 3d865acb 25-Jun-2019 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

arm64: versal: Add new jtag distro boot command

This patch adds new jtag distro boot command to look for bootscript file
in DDR and execute it first incase of jtag bootmode.
This patch also updates scriptaddr to 512MB as there is high of script
corruption incase of bigger kernel image.

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

# aef149e9 29-Apr-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Enable memory mapping via DT

Code reads DT and setup MMU table based on memory node. This will ensure
that only DT needs to be changed.

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

# 085201c2 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

arm64: versal: Set initrd_high to as high as possible

This patch is setting up the initrd_high to as high as possible by leaving
max stack size for u-boot so that bigger rootfs can also be loaded by
u-boot for booting kernel.

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

# 26e054c9 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

arm64: versal: fpga: Add PL bit stream load support

This patch adds PL bitstream load support for Versal platform. The PL
bitstream is loaded by making an SMC to ATF which in turn communicates
with platform firmware which configures and loads PL bitstream on to PL.

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

# bfd092f9 31-Jan-2019 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

arm64: versal: Define board_late_init for versal

Define board_late_init which performs bootmode detection
and prepares corresponding distro boot commaand sequence.

Also disable it for mini platforms because simply there is no need to have
it enabled.
But also disable it for virtual platform because Qemu is not modelling this
register space that's why travis testing would fail. This configuration
should be reverted when mainline Qemu is updated.

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

# 47a766f9 28-Jan-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig

Move hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up
for different platforms.

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

# fb771793 28-Jan-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Remove one level of indentation in board_early_init_r()

Simplify code indentation.

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

# ec48b6c9 22-Aug-2018 Michal Simek <michal.simek@amd.com>

arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
Engines with leading-edge memory and interfacing technologies to deliver
powerful heterogeneous acceleration for any application. The Versal AI
Core series has five devices, offering 128 to 400 AI Engines. The series
includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
than 1,900 DSP engines optimized for high-precision floating point with
low latency.

The patch is adding necessary infrastructure in place without enabling
platform which is done in separate patch.

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

# facfa565 08-Oct-2023 Polak, Leszek <LPolak@arri.de>

arm64: versal: Add SelectMAP boot mode identification

The SelectMAP configuration interface provides an 8-bit,
16-bit or 32-bit bidirectional data bus interface to the Versal FPGA
configuration logic that can be used for both configuration and readback.

A connected microcontoller to the SelectMAP interface can load boot
image with bitstream, TF-A (ARM Trusted Firmware) and U-Boot.

This commit adds the missing identification of the SelectMAP mode.

Signed-off-by: Polak, Leszek <LPolak@arri.de>
Reviewed-by: Stefan Roese <sr@denx.de>
Cc: Michal Simek <michal.simek@amd.com>
Cc: Stefan Roese <sr@denx.de>
Link: https://lore.kernel.org/r/DU0PR07MB8419F7765892CDBCE7D559C5C8CFA@DU0PR07MB8419.eurprd07.prod.outlook.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 6ec17a2c 05-Sep-2023 Michal Simek <michal.simek@amd.com>

arm64: xilinx: Guard distro boot variable generation

When distro boot is disabled there is no reason to generate variables for
it. Also do not update boot_targets variable because it would be unused.

It is useful for example when standard boot is enabled and distro boot
is disabled.

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

# b687f5d2 03-Sep-2023 Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>

xilinx: versal: Do not setup boot_targets if driver is not enabled

SOC can boot in the device which is not accessible from APU and running
this is detected as error which ends up in stopping boot process.
Boot mode detection and logic around is present to setup priority on boot
devices that SOC boot device is likely also used for booting OS.
Change logic to detect this case with showing message about it but don't fail
in boot process and don't prioritize boot device in this case.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20230904032035.11926-3-venkatesh.abbarapu@amd.com

# 174d7284 10-Jul-2023 Michal Simek <michal.simek@amd.com>

arm64: zynqmp: Switch to amd.com emails

Update my and DPs email address to match current setup.

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

# b2561c5b 05-Feb-2023 Simon Glass <sjg@chromium.org>

Correct SPL uses of ENV_VARS_UBOOT_RUNTIME_CONFIG

This converts 4 usages of this option to the non-SPL form, since there is
no SPL_ENV_VARS_UBOOT_RUNTIME_CONFIG defined in Kconfig

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

# 1d15612b 19-Jan-2023 Algapally Santosh Sagar <santoshsagar.algapally@amd.com>

xilinx: versal: Add missing header

Add missing prototype to fix the sparse warning, warning: no
previous prototype for 'do_go_exec' [-Wmissing-prototypes].

Signed-off-by: Algapally Santosh Sagar <santoshsagar.algapally@amd.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20230120053617.32463-4-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

# a32c3e9e 25-Aug-2022 Michal Simek <michal.simek@amd.com>

arm64: xilinx: Move board_get_usable_ram_top() to common location

The commit ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory
location") adds functionality for ZynqMP to read reserved memory node and
do not place U-Boot to reserved location. This functionality is generic
across all Xilinx SOCs that's why move it to common location to be used by
all Xilinx SOCs.

On zynq platform this is also fixing issue where U-Boot was placed to
locating which was reserved already which ends up with error message
"ERROR: reserving fdt memory region failed (addr=30000000 size=10000000
flags=4)" which is shown when bdinfo is called.

Tested on vck190, zcu102, zc706 and kc705 to cover all platforms.

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

# d7fcbfc1 22-Jul-2022 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

fpga: xilinx: add bitstream flags to driver desc

Store a set of supported bitstream types in xilinx_desc structure.
It will be used to determine whether an FPGA image is able to be
loaded with a given driver.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Tested-by: Ricardo Salveti <ricardo@foundries.io>
Tested-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
Link: https://lore.kernel.org/r/20220722141614.297383-4-oleksandr.suvorov@foundries.io
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 2eeceb48 05-May-2022 Ashok Reddy Soma <ashok.reddy.soma@amd.com>

arm64: versal: Add support to load an app at EL1

Add support to switch to EL1 and load an EL1 app from U-Boot which is
executing at EL2 or EL3 in aarch64 mode.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Link: https://lore.kernel.org/r/20220506055345.1921-1-ashok.reddy.soma@xilinx.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 9c563e91 29-Apr-2022 Michal Simek <michal.simek@amd.com>

xilinx: Handle board_get_usable_ram_top(0) properly

board_get_usable_ram_top() was designed for getting the top most location
for U-Boot allocation that's why function itself supports via total_size
parameter to find out where the right location for U-Boot is.
But function itself is also reused by different (EFI) which is passing
total_size as 0 to find out where the usable ram top is. For this case
doesn't make sense (a waste time) to call any lmb functions.
That's why simply return gd->ram_top.

And gd->ram_top is filled already based on previous call for U-Boot iself.
The same solution is also used by stm32mp by commit 92b611e8b003 ("stm32mp:
correctly handle board_get_usable_ram_top(0)") and commit c8510e397fad
("stm32mp: Fix board_get_usable_ram_top()").

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

# d8c033a9 13-Apr-2022 Peng Fan <peng.fan@nxp.com>

xilinx: versal: board: use CONFIG_COUNTER_FREQUENCY

Since versal has CONFIG_COUNTER_FREQUENCY, so use it. And
COUNTER_FREQUENCY will be dropped.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>

# f66d0b53 17-Mar-2022 Michal Simek <michal.simek@amd.com>

arm64: versal: Do not place u-boot to reserved memory location

Versal can also have reserved space in DT which u-boot has to avoid to
placing self to that location. The same change was done in ZynqMP by commit
ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory location")
and also for microblaze by commit d7b5cc89d329 ("microblaze: Do not place
u-boot to reserved memory location").

The patch was tested by adding reserved-memory node to DT and check via
bdinfo back.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/15426fa6d64835dd23c5c8c12bbfc97306fb6098.1647527129.git.michal.simek@xilinx.com

# bf97c460 23-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

versal: Return ENVL_NOWHERE instead of ENVL_UNKNOWN

The system fails to boot without any environment location, so return
ENVL_NOWHERE when there's nowhere to store the environment instead
of ENVL_UNKNOWN.

The same change was also done by commit 50918d0df5cb ("xilinx: Return
ENVL_NOWHERE instead of ENVL_UNKNOWN") for zynq and zynqmp.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/e4ed36408f10159677ed8060bfd5289f3e0691fa.1637752614.git.michal.simek@xilinx.com

# 5f4e1ff7 17-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Fix sdhci node name as per DT

Fix the sdhci node name in versal board file as per the name in
device tree and also check for sdhci node as part of backward
compatibility.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/9110ecdabcabcef63fffd4719095acf4326a26e4.1637236638.git.michal.simek@xilinx.com

# 82cb49dc 30-Mar-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Add usb dfu/thor distro boot support

Change "dfu_usb" to "usb_dfu" for better representation and change
required macros. Add 60s timeout of dfu-utils to start transaction.
Add support for usb thor to distro boot. Remove DFU_ALT_INFO_RAM
as we use bootcmd_usb_dfu instead of dfu_ram.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 4fb83c9c 23-Feb-2021 Ashok Reddy Soma <ashok.reddy.soma@amd.com>

xilinx: versal: Add support for saving env based on bootmode

Enable saving variables to MMC(FAT) and SPI based on primary
bootmode. If bootmode is JTAG, dont save env anywhere(NOWHERE).

Enable ENV_FAT_DEVICE_AND_PART="0:auto" for Versal platforms as well.

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

# 35b65dd8 15-Dec-2020 Harald Seiler <hws@denx.de>

reset: Remove addr parameter from reset_cpu()

Historically, the reset_cpu() function had an `addr` parameter which was
meant to pass in an address of the reset vector location, where the CPU
should reset to. This feature is no longer used anywhere in U-Boot as
all reset_cpu() implementations now ignore the passed value. Generic
code has been added which always calls reset_cpu() with `0` which means
this feature can no longer be used easily anyway.

Over time, many implementations seem to have "misunderstood" the
existence of this parameter as a way to customize/parameterize the reset
(e.g. COLD vs WARM resets). As this is not properly supported, the
code will almost always not do what it is intended to (because all
call-sites just call reset_cpu() with 0).

To avoid confusion and to clean up the codebase from unused left-overs
of the past, remove the `addr` parameter entirely. Code which intends
to support different kinds of resets should be rewritten as a sysreset
driver instead.

This transformation was done with the following coccinelle patch:

@@
expression argvalue;
@@
- reset_cpu(argvalue)
+ reset_cpu()

@@
identifier argname;
type argtype;
@@
- reset_cpu(argtype argname)
+ reset_cpu(void)
{ ... }

Signed-off-by: Harald Seiler <hws@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

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

common: Drop asm/global_data.h from common header

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

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

# 8b85dfc6 16-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Avoid accessing seq directly

At present various drivers etc. access the device's 'seq' member directly.
This makes it harder to change the meaning of that member. Change access
to go through a function instead.

The drivers/i2c/lpc32xx_i2c.c file is left unchanged for now.

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

# d61728c8 03-Aug-2020 Michal Simek <michal.simek@amd.com>

xilinx: board: Read the whole eeprom not just offset

Starts to use new way how eeproms should be referenced.
Reference is done via nvmem alias nodes. When this new way is specified
code itself read the eeprom and decode xilinx legacy format and fill struct
xilinx_board_description. Then based on information present there board_*
variables are setup.
If variables are saved and content can't be changed information is just
shown on console.

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

# 62b96262 27-Jul-2020 Michal Simek <michal.simek@amd.com>

xilinx: Add support for ENV_VARS_UBOOT_RUNTIME_CONFIG

Start to use ENV_VARS_UBOOT_RUNTIME_CONFIG to enable/disable updating
variables with run time information.

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

# 22b6bb6c 09-Jul-2020 Michal Simek <michal.simek@amd.com>

xilinx: versal: Use lowest memory for U-Boot

Find and use the lowest memory for Versal to make sure that we keep u-boot
as low as possible and never use memory above u-boot's maximum VA mapping.

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

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

common: Drop log.h from common header

Move this header out of the common header.

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

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

command: Remove the cmd_tbl_t typedef

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

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

This requires quite a few header-file additions.

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

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

common: Drop net.h from common header

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

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

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

# 51f6c52e 08-Apr-2020 Michal Simek <michal.simek@amd.com>

xilinx: Move bootmode detection to separate function

Create special function for reading bootmode on Versal and ZynqMP.
Zynq is using specific function (without mask) already.
Future patches will be calling this function from different location too.

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

# a29511ee 08-Apr-2020 Michal Simek <michal.simek@amd.com>

xilinx: Move initrd_high setup to common location

Moving to common location initrd_high is also setup for Zynq which hasn't
done in run time code.

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

# 80fdef12 30-Mar-2020 Michal Simek <michal.simek@amd.com>

xilinx: Introduce board_late_init_xilinx()

This function should keep common shared late configurations for Xilinx
SoCs.

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

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

common: Move reset_cpu() to the CPU header

Move this function out of common.h and into a relevant header file.

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

# 53c69dec 18-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

board: xilinx: Add support for user configurable boot script offset

Currently "script_offset_f" env variable is hardcoded, this variable
specifies from which offset of the flash boot.scr should be read/write.
As flashes are of different sizes having a fixed offset makes it
difficult to load other images into the flash which may overwrite the
boot script or cannot utilize the full memory. This current fix
creates a new config "CONFIG_BOOT_SCRIPT_OFFSET" which holds the
offset address, overwrites the "script_offset_f" variable.
Also removed existing variable with default values, as the default
values are held by CONFIG_BOOT_SCRIPT_OFFSET

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c5b7bb1 16-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Fix emmc boot mode boot_target issue

Emmc boot devcie is mounted to sdhci@f1050000 controller on versal, while
in emmc boot mode, boot tragets are set to mmc0. So removed mmc0 and using
the dev seq number from the sdhci@f1050000 controller.
Dev seq number is setup based on DT aliases that's why needs to be setup at
run time.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

common: Move some board functions out of common.h

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

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

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

common: Move get_ticks() function out of common.h

This function belongs in time.h so move it over and add a comment.

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

# f0c16cd6 11-Jul-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Add new dfu usb distro boot command

This patch adds new dfu usb distro boot command to look for bootscript
from dfu-util and runs it.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>

# 3d865acb 25-Jun-2019 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

arm64: versal: Add new jtag distro boot command

This patch adds new jtag distro boot command to look for bootscript file
in DDR and execute it first incase of jtag bootmode.
This patch also updates scriptaddr to 512MB as there is high of script
corruption incase of bigger kernel image.

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

# aef149e9 29-Apr-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Enable memory mapping via DT

Code reads DT and setup MMU table based on memory node. This will ensure
that only DT needs to be changed.

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

# 085201c2 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

arm64: versal: Set initrd_high to as high as possible

This patch is setting up the initrd_high to as high as possible by leaving
max stack size for u-boot so that bigger rootfs can also be loaded by
u-boot for booting kernel.

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

# 26e054c9 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

arm64: versal: fpga: Add PL bit stream load support

This patch adds PL bitstream load support for Versal platform. The PL
bitstream is loaded by making an SMC to ATF which in turn communicates
with platform firmware which configures and loads PL bitstream on to PL.

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

# bfd092f9 31-Jan-2019 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

arm64: versal: Define board_late_init for versal

Define board_late_init which performs bootmode detection
and prepares corresponding distro boot commaand sequence.

Also disable it for mini platforms because simply there is no need to have
it enabled.
But also disable it for virtual platform because Qemu is not modelling this
register space that's why travis testing would fail. This configuration
should be reverted when mainline Qemu is updated.

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

# 47a766f9 28-Jan-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig

Move hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up
for different platforms.

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

# fb771793 28-Jan-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Remove one level of indentation in board_early_init_r()

Simplify code indentation.

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

# ec48b6c9 22-Aug-2018 Michal Simek <michal.simek@amd.com>

arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
Engines with leading-edge memory and interfacing technologies to deliver
powerful heterogeneous acceleration for any application. The Versal AI
Core series has five devices, offering 128 to 400 AI Engines. The series
includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
than 1,900 DSP engines optimized for high-precision floating point with
low latency.

The patch is adding necessary infrastructure in place without enabling
platform which is done in separate patch.

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

# 6ec17a2c 05-Sep-2023 Michal Simek <michal.simek@amd.com>

arm64: xilinx: Guard distro boot variable generation

When distro boot is disabled there is no reason to generate variables for
it. Also do not update boot_targets variable because it would be unused.

It is useful for example when standard boot is enabled and distro boot
is disabled.

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

# b687f5d2 03-Sep-2023 Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>

xilinx: versal: Do not setup boot_targets if driver is not enabled

SOC can boot in the device which is not accessible from APU and running
this is detected as error which ends up in stopping boot process.
Boot mode detection and logic around is present to setup priority on boot
devices that SOC boot device is likely also used for booting OS.
Change logic to detect this case with showing message about it but don't fail
in boot process and don't prioritize boot device in this case.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20230904032035.11926-3-venkatesh.abbarapu@amd.com

# 174d7284 10-Jul-2023 Michal Simek <michal.simek@amd.com>

arm64: zynqmp: Switch to amd.com emails

Update my and DPs email address to match current setup.

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

# b2561c5b 05-Feb-2023 Simon Glass <sjg@chromium.org>

Correct SPL uses of ENV_VARS_UBOOT_RUNTIME_CONFIG

This converts 4 usages of this option to the non-SPL form, since there is
no SPL_ENV_VARS_UBOOT_RUNTIME_CONFIG defined in Kconfig

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

# 1d15612b 19-Jan-2023 Algapally Santosh Sagar <santoshsagar.algapally@amd.com>

xilinx: versal: Add missing header

Add missing prototype to fix the sparse warning, warning: no
previous prototype for 'do_go_exec' [-Wmissing-prototypes].

Signed-off-by: Algapally Santosh Sagar <santoshsagar.algapally@amd.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20230120053617.32463-4-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

# a32c3e9e 25-Aug-2022 Michal Simek <michal.simek@amd.com>

arm64: xilinx: Move board_get_usable_ram_top() to common location

The commit ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory
location") adds functionality for ZynqMP to read reserved memory node and
do not place U-Boot to reserved location. This functionality is generic
across all Xilinx SOCs that's why move it to common location to be used by
all Xilinx SOCs.

On zynq platform this is also fixing issue where U-Boot was placed to
locating which was reserved already which ends up with error message
"ERROR: reserving fdt memory region failed (addr=30000000 size=10000000
flags=4)" which is shown when bdinfo is called.

Tested on vck190, zcu102, zc706 and kc705 to cover all platforms.

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

# d7fcbfc1 22-Jul-2022 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

fpga: xilinx: add bitstream flags to driver desc

Store a set of supported bitstream types in xilinx_desc structure.
It will be used to determine whether an FPGA image is able to be
loaded with a given driver.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Tested-by: Ricardo Salveti <ricardo@foundries.io>
Tested-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
Link: https://lore.kernel.org/r/20220722141614.297383-4-oleksandr.suvorov@foundries.io
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 2eeceb48 05-May-2022 Ashok Reddy Soma <ashok.reddy.soma@amd.com>

arm64: versal: Add support to load an app at EL1

Add support to switch to EL1 and load an EL1 app from U-Boot which is
executing at EL2 or EL3 in aarch64 mode.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Link: https://lore.kernel.org/r/20220506055345.1921-1-ashok.reddy.soma@xilinx.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 9c563e91 29-Apr-2022 Michal Simek <michal.simek@amd.com>

xilinx: Handle board_get_usable_ram_top(0) properly

board_get_usable_ram_top() was designed for getting the top most location
for U-Boot allocation that's why function itself supports via total_size
parameter to find out where the right location for U-Boot is.
But function itself is also reused by different (EFI) which is passing
total_size as 0 to find out where the usable ram top is. For this case
doesn't make sense (a waste time) to call any lmb functions.
That's why simply return gd->ram_top.

And gd->ram_top is filled already based on previous call for U-Boot iself.
The same solution is also used by stm32mp by commit 92b611e8b003 ("stm32mp:
correctly handle board_get_usable_ram_top(0)") and commit c8510e397fad
("stm32mp: Fix board_get_usable_ram_top()").

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

# d8c033a9 13-Apr-2022 Peng Fan <peng.fan@nxp.com>

xilinx: versal: board: use CONFIG_COUNTER_FREQUENCY

Since versal has CONFIG_COUNTER_FREQUENCY, so use it. And
COUNTER_FREQUENCY will be dropped.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>

# f66d0b53 17-Mar-2022 Michal Simek <michal.simek@amd.com>

arm64: versal: Do not place u-boot to reserved memory location

Versal can also have reserved space in DT which u-boot has to avoid to
placing self to that location. The same change was done in ZynqMP by commit
ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory location")
and also for microblaze by commit d7b5cc89d329 ("microblaze: Do not place
u-boot to reserved memory location").

The patch was tested by adding reserved-memory node to DT and check via
bdinfo back.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/15426fa6d64835dd23c5c8c12bbfc97306fb6098.1647527129.git.michal.simek@xilinx.com

# bf97c460 23-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

versal: Return ENVL_NOWHERE instead of ENVL_UNKNOWN

The system fails to boot without any environment location, so return
ENVL_NOWHERE when there's nowhere to store the environment instead
of ENVL_UNKNOWN.

The same change was also done by commit 50918d0df5cb ("xilinx: Return
ENVL_NOWHERE instead of ENVL_UNKNOWN") for zynq and zynqmp.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/e4ed36408f10159677ed8060bfd5289f3e0691fa.1637752614.git.michal.simek@xilinx.com

# 5f4e1ff7 17-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Fix sdhci node name as per DT

Fix the sdhci node name in versal board file as per the name in
device tree and also check for sdhci node as part of backward
compatibility.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/9110ecdabcabcef63fffd4719095acf4326a26e4.1637236638.git.michal.simek@xilinx.com

# 82cb49dc 30-Mar-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Add usb dfu/thor distro boot support

Change "dfu_usb" to "usb_dfu" for better representation and change
required macros. Add 60s timeout of dfu-utils to start transaction.
Add support for usb thor to distro boot. Remove DFU_ALT_INFO_RAM
as we use bootcmd_usb_dfu instead of dfu_ram.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 4fb83c9c 23-Feb-2021 Ashok Reddy Soma <ashok.reddy.soma@amd.com>

xilinx: versal: Add support for saving env based on bootmode

Enable saving variables to MMC(FAT) and SPI based on primary
bootmode. If bootmode is JTAG, dont save env anywhere(NOWHERE).

Enable ENV_FAT_DEVICE_AND_PART="0:auto" for Versal platforms as well.

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

# 35b65dd8 15-Dec-2020 Harald Seiler <hws@denx.de>

reset: Remove addr parameter from reset_cpu()

Historically, the reset_cpu() function had an `addr` parameter which was
meant to pass in an address of the reset vector location, where the CPU
should reset to. This feature is no longer used anywhere in U-Boot as
all reset_cpu() implementations now ignore the passed value. Generic
code has been added which always calls reset_cpu() with `0` which means
this feature can no longer be used easily anyway.

Over time, many implementations seem to have "misunderstood" the
existence of this parameter as a way to customize/parameterize the reset
(e.g. COLD vs WARM resets). As this is not properly supported, the
code will almost always not do what it is intended to (because all
call-sites just call reset_cpu() with 0).

To avoid confusion and to clean up the codebase from unused left-overs
of the past, remove the `addr` parameter entirely. Code which intends
to support different kinds of resets should be rewritten as a sysreset
driver instead.

This transformation was done with the following coccinelle patch:

@@
expression argvalue;
@@
- reset_cpu(argvalue)
+ reset_cpu()

@@
identifier argname;
type argtype;
@@
- reset_cpu(argtype argname)
+ reset_cpu(void)
{ ... }

Signed-off-by: Harald Seiler <hws@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

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

common: Drop asm/global_data.h from common header

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

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

# 8b85dfc6 16-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Avoid accessing seq directly

At present various drivers etc. access the device's 'seq' member directly.
This makes it harder to change the meaning of that member. Change access
to go through a function instead.

The drivers/i2c/lpc32xx_i2c.c file is left unchanged for now.

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

# d61728c8 03-Aug-2020 Michal Simek <michal.simek@amd.com>

xilinx: board: Read the whole eeprom not just offset

Starts to use new way how eeproms should be referenced.
Reference is done via nvmem alias nodes. When this new way is specified
code itself read the eeprom and decode xilinx legacy format and fill struct
xilinx_board_description. Then based on information present there board_*
variables are setup.
If variables are saved and content can't be changed information is just
shown on console.

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

# 62b96262 27-Jul-2020 Michal Simek <michal.simek@amd.com>

xilinx: Add support for ENV_VARS_UBOOT_RUNTIME_CONFIG

Start to use ENV_VARS_UBOOT_RUNTIME_CONFIG to enable/disable updating
variables with run time information.

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

# 22b6bb6c 09-Jul-2020 Michal Simek <michal.simek@amd.com>

xilinx: versal: Use lowest memory for U-Boot

Find and use the lowest memory for Versal to make sure that we keep u-boot
as low as possible and never use memory above u-boot's maximum VA mapping.

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

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

common: Drop log.h from common header

Move this header out of the common header.

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

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

command: Remove the cmd_tbl_t typedef

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

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

This requires quite a few header-file additions.

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

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

common: Drop net.h from common header

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

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

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

# 51f6c52e 08-Apr-2020 Michal Simek <michal.simek@amd.com>

xilinx: Move bootmode detection to separate function

Create special function for reading bootmode on Versal and ZynqMP.
Zynq is using specific function (without mask) already.
Future patches will be calling this function from different location too.

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

# a29511ee 08-Apr-2020 Michal Simek <michal.simek@amd.com>

xilinx: Move initrd_high setup to common location

Moving to common location initrd_high is also setup for Zynq which hasn't
done in run time code.

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

# 80fdef12 30-Mar-2020 Michal Simek <michal.simek@amd.com>

xilinx: Introduce board_late_init_xilinx()

This function should keep common shared late configurations for Xilinx
SoCs.

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

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

common: Move reset_cpu() to the CPU header

Move this function out of common.h and into a relevant header file.

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

# 53c69dec 18-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

board: xilinx: Add support for user configurable boot script offset

Currently "script_offset_f" env variable is hardcoded, this variable
specifies from which offset of the flash boot.scr should be read/write.
As flashes are of different sizes having a fixed offset makes it
difficult to load other images into the flash which may overwrite the
boot script or cannot utilize the full memory. This current fix
creates a new config "CONFIG_BOOT_SCRIPT_OFFSET" which holds the
offset address, overwrites the "script_offset_f" variable.
Also removed existing variable with default values, as the default
values are held by CONFIG_BOOT_SCRIPT_OFFSET

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c5b7bb1 16-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Fix emmc boot mode boot_target issue

Emmc boot devcie is mounted to sdhci@f1050000 controller on versal, while
in emmc boot mode, boot tragets are set to mmc0. So removed mmc0 and using
the dev seq number from the sdhci@f1050000 controller.
Dev seq number is setup based on DT aliases that's why needs to be setup at
run time.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

common: Move some board functions out of common.h

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

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

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

common: Move get_ticks() function out of common.h

This function belongs in time.h so move it over and add a comment.

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

# f0c16cd6 11-Jul-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Add new dfu usb distro boot command

This patch adds new dfu usb distro boot command to look for bootscript
from dfu-util and runs it.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>

# 3d865acb 25-Jun-2019 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

arm64: versal: Add new jtag distro boot command

This patch adds new jtag distro boot command to look for bootscript file
in DDR and execute it first incase of jtag bootmode.
This patch also updates scriptaddr to 512MB as there is high of script
corruption incase of bigger kernel image.

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

# aef149e9 29-Apr-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Enable memory mapping via DT

Code reads DT and setup MMU table based on memory node. This will ensure
that only DT needs to be changed.

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

# 085201c2 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

arm64: versal: Set initrd_high to as high as possible

This patch is setting up the initrd_high to as high as possible by leaving
max stack size for u-boot so that bigger rootfs can also be loaded by
u-boot for booting kernel.

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

# 26e054c9 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

arm64: versal: fpga: Add PL bit stream load support

This patch adds PL bitstream load support for Versal platform. The PL
bitstream is loaded by making an SMC to ATF which in turn communicates
with platform firmware which configures and loads PL bitstream on to PL.

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

# bfd092f9 31-Jan-2019 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

arm64: versal: Define board_late_init for versal

Define board_late_init which performs bootmode detection
and prepares corresponding distro boot commaand sequence.

Also disable it for mini platforms because simply there is no need to have
it enabled.
But also disable it for virtual platform because Qemu is not modelling this
register space that's why travis testing would fail. This configuration
should be reverted when mainline Qemu is updated.

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

# 47a766f9 28-Jan-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig

Move hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up
for different platforms.

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

# fb771793 28-Jan-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Remove one level of indentation in board_early_init_r()

Simplify code indentation.

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

# ec48b6c9 22-Aug-2018 Michal Simek <michal.simek@amd.com>

arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
Engines with leading-edge memory and interfacing technologies to deliver
powerful heterogeneous acceleration for any application. The Versal AI
Core series has five devices, offering 128 to 400 AI Engines. The series
includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
than 1,900 DSP engines optimized for high-precision floating point with
low latency.

The patch is adding necessary infrastructure in place without enabling
platform which is done in separate patch.

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

# 174d7284 10-Jul-2023 Michal Simek <michal.simek@amd.com>

arm64: zynqmp: Switch to amd.com emails

Update my and DPs email address to match current setup.

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

# b2561c5b 05-Feb-2023 Simon Glass <sjg@chromium.org>

Correct SPL uses of ENV_VARS_UBOOT_RUNTIME_CONFIG

This converts 4 usages of this option to the non-SPL form, since there is
no SPL_ENV_VARS_UBOOT_RUNTIME_CONFIG defined in Kconfig

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

# 1d15612b 19-Jan-2023 Algapally Santosh Sagar <santoshsagar.algapally@amd.com>

xilinx: versal: Add missing header

Add missing prototype to fix the sparse warning, warning: no
previous prototype for 'do_go_exec' [-Wmissing-prototypes].

Signed-off-by: Algapally Santosh Sagar <santoshsagar.algapally@amd.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20230120053617.32463-4-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

# a32c3e9e 25-Aug-2022 Michal Simek <michal.simek@amd.com>

arm64: xilinx: Move board_get_usable_ram_top() to common location

The commit ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory
location") adds functionality for ZynqMP to read reserved memory node and
do not place U-Boot to reserved location. This functionality is generic
across all Xilinx SOCs that's why move it to common location to be used by
all Xilinx SOCs.

On zynq platform this is also fixing issue where U-Boot was placed to
locating which was reserved already which ends up with error message
"ERROR: reserving fdt memory region failed (addr=30000000 size=10000000
flags=4)" which is shown when bdinfo is called.

Tested on vck190, zcu102, zc706 and kc705 to cover all platforms.

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

# d7fcbfc1 22-Jul-2022 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

fpga: xilinx: add bitstream flags to driver desc

Store a set of supported bitstream types in xilinx_desc structure.
It will be used to determine whether an FPGA image is able to be
loaded with a given driver.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Tested-by: Ricardo Salveti <ricardo@foundries.io>
Tested-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
Link: https://lore.kernel.org/r/20220722141614.297383-4-oleksandr.suvorov@foundries.io
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 2eeceb48 05-May-2022 Ashok Reddy Soma <ashok.reddy.soma@amd.com>

arm64: versal: Add support to load an app at EL1

Add support to switch to EL1 and load an EL1 app from U-Boot which is
executing at EL2 or EL3 in aarch64 mode.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Link: https://lore.kernel.org/r/20220506055345.1921-1-ashok.reddy.soma@xilinx.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 9c563e91 29-Apr-2022 Michal Simek <michal.simek@amd.com>

xilinx: Handle board_get_usable_ram_top(0) properly

board_get_usable_ram_top() was designed for getting the top most location
for U-Boot allocation that's why function itself supports via total_size
parameter to find out where the right location for U-Boot is.
But function itself is also reused by different (EFI) which is passing
total_size as 0 to find out where the usable ram top is. For this case
doesn't make sense (a waste time) to call any lmb functions.
That's why simply return gd->ram_top.

And gd->ram_top is filled already based on previous call for U-Boot iself.
The same solution is also used by stm32mp by commit 92b611e8b003 ("stm32mp:
correctly handle board_get_usable_ram_top(0)") and commit c8510e397fad
("stm32mp: Fix board_get_usable_ram_top()").

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

# d8c033a9 13-Apr-2022 Peng Fan <peng.fan@nxp.com>

xilinx: versal: board: use CONFIG_COUNTER_FREQUENCY

Since versal has CONFIG_COUNTER_FREQUENCY, so use it. And
COUNTER_FREQUENCY will be dropped.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>

# f66d0b53 17-Mar-2022 Michal Simek <michal.simek@amd.com>

arm64: versal: Do not place u-boot to reserved memory location

Versal can also have reserved space in DT which u-boot has to avoid to
placing self to that location. The same change was done in ZynqMP by commit
ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory location")
and also for microblaze by commit d7b5cc89d329 ("microblaze: Do not place
u-boot to reserved memory location").

The patch was tested by adding reserved-memory node to DT and check via
bdinfo back.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/15426fa6d64835dd23c5c8c12bbfc97306fb6098.1647527129.git.michal.simek@xilinx.com

# bf97c460 23-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

versal: Return ENVL_NOWHERE instead of ENVL_UNKNOWN

The system fails to boot without any environment location, so return
ENVL_NOWHERE when there's nowhere to store the environment instead
of ENVL_UNKNOWN.

The same change was also done by commit 50918d0df5cb ("xilinx: Return
ENVL_NOWHERE instead of ENVL_UNKNOWN") for zynq and zynqmp.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/e4ed36408f10159677ed8060bfd5289f3e0691fa.1637752614.git.michal.simek@xilinx.com

# 5f4e1ff7 17-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Fix sdhci node name as per DT

Fix the sdhci node name in versal board file as per the name in
device tree and also check for sdhci node as part of backward
compatibility.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/9110ecdabcabcef63fffd4719095acf4326a26e4.1637236638.git.michal.simek@xilinx.com

# 82cb49dc 30-Mar-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Add usb dfu/thor distro boot support

Change "dfu_usb" to "usb_dfu" for better representation and change
required macros. Add 60s timeout of dfu-utils to start transaction.
Add support for usb thor to distro boot. Remove DFU_ALT_INFO_RAM
as we use bootcmd_usb_dfu instead of dfu_ram.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 4fb83c9c 23-Feb-2021 Ashok Reddy Soma <ashok.reddy.soma@amd.com>

xilinx: versal: Add support for saving env based on bootmode

Enable saving variables to MMC(FAT) and SPI based on primary
bootmode. If bootmode is JTAG, dont save env anywhere(NOWHERE).

Enable ENV_FAT_DEVICE_AND_PART="0:auto" for Versal platforms as well.

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

# 35b65dd8 15-Dec-2020 Harald Seiler <hws@denx.de>

reset: Remove addr parameter from reset_cpu()

Historically, the reset_cpu() function had an `addr` parameter which was
meant to pass in an address of the reset vector location, where the CPU
should reset to. This feature is no longer used anywhere in U-Boot as
all reset_cpu() implementations now ignore the passed value. Generic
code has been added which always calls reset_cpu() with `0` which means
this feature can no longer be used easily anyway.

Over time, many implementations seem to have "misunderstood" the
existence of this parameter as a way to customize/parameterize the reset
(e.g. COLD vs WARM resets). As this is not properly supported, the
code will almost always not do what it is intended to (because all
call-sites just call reset_cpu() with 0).

To avoid confusion and to clean up the codebase from unused left-overs
of the past, remove the `addr` parameter entirely. Code which intends
to support different kinds of resets should be rewritten as a sysreset
driver instead.

This transformation was done with the following coccinelle patch:

@@
expression argvalue;
@@
- reset_cpu(argvalue)
+ reset_cpu()

@@
identifier argname;
type argtype;
@@
- reset_cpu(argtype argname)
+ reset_cpu(void)
{ ... }

Signed-off-by: Harald Seiler <hws@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

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

common: Drop asm/global_data.h from common header

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

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

# 8b85dfc6 16-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Avoid accessing seq directly

At present various drivers etc. access the device's 'seq' member directly.
This makes it harder to change the meaning of that member. Change access
to go through a function instead.

The drivers/i2c/lpc32xx_i2c.c file is left unchanged for now.

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

# d61728c8 03-Aug-2020 Michal Simek <michal.simek@amd.com>

xilinx: board: Read the whole eeprom not just offset

Starts to use new way how eeproms should be referenced.
Reference is done via nvmem alias nodes. When this new way is specified
code itself read the eeprom and decode xilinx legacy format and fill struct
xilinx_board_description. Then based on information present there board_*
variables are setup.
If variables are saved and content can't be changed information is just
shown on console.

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

# 62b96262 27-Jul-2020 Michal Simek <michal.simek@amd.com>

xilinx: Add support for ENV_VARS_UBOOT_RUNTIME_CONFIG

Start to use ENV_VARS_UBOOT_RUNTIME_CONFIG to enable/disable updating
variables with run time information.

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

# 22b6bb6c 09-Jul-2020 Michal Simek <michal.simek@amd.com>

xilinx: versal: Use lowest memory for U-Boot

Find and use the lowest memory for Versal to make sure that we keep u-boot
as low as possible and never use memory above u-boot's maximum VA mapping.

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

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

common: Drop log.h from common header

Move this header out of the common header.

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

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

command: Remove the cmd_tbl_t typedef

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

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

This requires quite a few header-file additions.

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

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

common: Drop net.h from common header

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

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

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

# 51f6c52e 08-Apr-2020 Michal Simek <michal.simek@amd.com>

xilinx: Move bootmode detection to separate function

Create special function for reading bootmode on Versal and ZynqMP.
Zynq is using specific function (without mask) already.
Future patches will be calling this function from different location too.

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

# a29511ee 08-Apr-2020 Michal Simek <michal.simek@amd.com>

xilinx: Move initrd_high setup to common location

Moving to common location initrd_high is also setup for Zynq which hasn't
done in run time code.

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

# 80fdef12 30-Mar-2020 Michal Simek <michal.simek@amd.com>

xilinx: Introduce board_late_init_xilinx()

This function should keep common shared late configurations for Xilinx
SoCs.

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

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

common: Move reset_cpu() to the CPU header

Move this function out of common.h and into a relevant header file.

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

# 53c69dec 18-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

board: xilinx: Add support for user configurable boot script offset

Currently "script_offset_f" env variable is hardcoded, this variable
specifies from which offset of the flash boot.scr should be read/write.
As flashes are of different sizes having a fixed offset makes it
difficult to load other images into the flash which may overwrite the
boot script or cannot utilize the full memory. This current fix
creates a new config "CONFIG_BOOT_SCRIPT_OFFSET" which holds the
offset address, overwrites the "script_offset_f" variable.
Also removed existing variable with default values, as the default
values are held by CONFIG_BOOT_SCRIPT_OFFSET

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c5b7bb1 16-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Fix emmc boot mode boot_target issue

Emmc boot devcie is mounted to sdhci@f1050000 controller on versal, while
in emmc boot mode, boot tragets are set to mmc0. So removed mmc0 and using
the dev seq number from the sdhci@f1050000 controller.
Dev seq number is setup based on DT aliases that's why needs to be setup at
run time.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

common: Move some board functions out of common.h

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

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

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

common: Move get_ticks() function out of common.h

This function belongs in time.h so move it over and add a comment.

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

# f0c16cd6 11-Jul-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Add new dfu usb distro boot command

This patch adds new dfu usb distro boot command to look for bootscript
from dfu-util and runs it.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>

# 3d865acb 25-Jun-2019 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

arm64: versal: Add new jtag distro boot command

This patch adds new jtag distro boot command to look for bootscript file
in DDR and execute it first incase of jtag bootmode.
This patch also updates scriptaddr to 512MB as there is high of script
corruption incase of bigger kernel image.

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

# aef149e9 29-Apr-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Enable memory mapping via DT

Code reads DT and setup MMU table based on memory node. This will ensure
that only DT needs to be changed.

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

# 085201c2 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

arm64: versal: Set initrd_high to as high as possible

This patch is setting up the initrd_high to as high as possible by leaving
max stack size for u-boot so that bigger rootfs can also be loaded by
u-boot for booting kernel.

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

# 26e054c9 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

arm64: versal: fpga: Add PL bit stream load support

This patch adds PL bitstream load support for Versal platform. The PL
bitstream is loaded by making an SMC to ATF which in turn communicates
with platform firmware which configures and loads PL bitstream on to PL.

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

# bfd092f9 31-Jan-2019 Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

arm64: versal: Define board_late_init for versal

Define board_late_init which performs bootmode detection
and prepares corresponding distro boot commaand sequence.

Also disable it for mini platforms because simply there is no need to have
it enabled.
But also disable it for virtual platform because Qemu is not modelling this
register space that's why travis testing would fail. This configuration
should be reverted when mainline Qemu is updated.

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

# 47a766f9 28-Jan-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig

Move hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up
for different platforms.

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

# fb771793 28-Jan-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Remove one level of indentation in board_early_init_r()

Simplify code indentation.

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

# ec48b6c9 22-Aug-2018 Michal Simek <michal.simek@amd.com>

arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
Engines with leading-edge memory and interfacing technologies to deliver
powerful heterogeneous acceleration for any application. The Versal AI
Core series has five devices, offering 128 to 400 AI Engines. The series
includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
than 1,900 DSP engines optimized for high-precision floating point with
low latency.

The patch is adding necessary infrastructure in place without enabling
platform which is done in separate patch.

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

# b2561c5b 05-Feb-2023 Simon Glass <sjg@chromium.org>

Correct SPL uses of ENV_VARS_UBOOT_RUNTIME_CONFIG

This converts 4 usages of this option to the non-SPL form, since there is
no SPL_ENV_VARS_UBOOT_RUNTIME_CONFIG defined in Kconfig

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

# 1d15612b 19-Jan-2023 Algapally Santosh Sagar <santoshsagar.algapally@amd.com>

xilinx: versal: Add missing header

Add missing prototype to fix the sparse warning, warning: no
previous prototype for 'do_go_exec' [-Wmissing-prototypes].

Signed-off-by: Algapally Santosh Sagar <santoshsagar.algapally@amd.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20230120053617.32463-4-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

# a32c3e9e 25-Aug-2022 Michal Simek <michal.simek@amd.com>

arm64: xilinx: Move board_get_usable_ram_top() to common location

The commit ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory
location") adds functionality for ZynqMP to read reserved memory node and
do not place U-Boot to reserved location. This functionality is generic
across all Xilinx SOCs that's why move it to common location to be used by
all Xilinx SOCs.

On zynq platform this is also fixing issue where U-Boot was placed to
locating which was reserved already which ends up with error message
"ERROR: reserving fdt memory region failed (addr=30000000 size=10000000
flags=4)" which is shown when bdinfo is called.

Tested on vck190, zcu102, zc706 and kc705 to cover all platforms.

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

# d7fcbfc1 22-Jul-2022 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

fpga: xilinx: add bitstream flags to driver desc

Store a set of supported bitstream types in xilinx_desc structure.
It will be used to determine whether an FPGA image is able to be
loaded with a given driver.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Tested-by: Ricardo Salveti <ricardo@foundries.io>
Tested-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
Link: https://lore.kernel.org/r/20220722141614.297383-4-oleksandr.suvorov@foundries.io
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 2eeceb48 05-May-2022 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

arm64: versal: Add support to load an app at EL1

Add support to switch to EL1 and load an EL1 app from U-Boot which is
executing at EL2 or EL3 in aarch64 mode.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Link: https://lore.kernel.org/r/20220506055345.1921-1-ashok.reddy.soma@xilinx.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 9c563e91 29-Apr-2022 Michal Simek <michal.simek@xilinx.com>

xilinx: Handle board_get_usable_ram_top(0) properly

board_get_usable_ram_top() was designed for getting the top most location
for U-Boot allocation that's why function itself supports via total_size
parameter to find out where the right location for U-Boot is.
But function itself is also reused by different (EFI) which is passing
total_size as 0 to find out where the usable ram top is. For this case
doesn't make sense (a waste time) to call any lmb functions.
That's why simply return gd->ram_top.

And gd->ram_top is filled already based on previous call for U-Boot iself.
The same solution is also used by stm32mp by commit 92b611e8b003 ("stm32mp:
correctly handle board_get_usable_ram_top(0)") and commit c8510e397fad
("stm32mp: Fix board_get_usable_ram_top()").

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

# d8c033a9 13-Apr-2022 Peng Fan <peng.fan@nxp.com>

xilinx: versal: board: use CONFIG_COUNTER_FREQUENCY

Since versal has CONFIG_COUNTER_FREQUENCY, so use it. And
COUNTER_FREQUENCY will be dropped.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>

# f66d0b53 17-Mar-2022 Michal Simek <michal.simek@amd.com>

arm64: versal: Do not place u-boot to reserved memory location

Versal can also have reserved space in DT which u-boot has to avoid to
placing self to that location. The same change was done in ZynqMP by commit
ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory location")
and also for microblaze by commit d7b5cc89d329 ("microblaze: Do not place
u-boot to reserved memory location").

The patch was tested by adding reserved-memory node to DT and check via
bdinfo back.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/15426fa6d64835dd23c5c8c12bbfc97306fb6098.1647527129.git.michal.simek@xilinx.com

# bf97c460 23-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

versal: Return ENVL_NOWHERE instead of ENVL_UNKNOWN

The system fails to boot without any environment location, so return
ENVL_NOWHERE when there's nowhere to store the environment instead
of ENVL_UNKNOWN.

The same change was also done by commit 50918d0df5cb ("xilinx: Return
ENVL_NOWHERE instead of ENVL_UNKNOWN") for zynq and zynqmp.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/e4ed36408f10159677ed8060bfd5289f3e0691fa.1637752614.git.michal.simek@xilinx.com

# 5f4e1ff7 17-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Fix sdhci node name as per DT

Fix the sdhci node name in versal board file as per the name in
device tree and also check for sdhci node as part of backward
compatibility.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/9110ecdabcabcef63fffd4719095acf4326a26e4.1637236638.git.michal.simek@xilinx.com

# 82cb49dc 30-Mar-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Add usb dfu/thor distro boot support

Change "dfu_usb" to "usb_dfu" for better representation and change
required macros. Add 60s timeout of dfu-utils to start transaction.
Add support for usb thor to distro boot. Remove DFU_ALT_INFO_RAM
as we use bootcmd_usb_dfu instead of dfu_ram.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 4fb83c9c 23-Feb-2021 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

xilinx: versal: Add support for saving env based on bootmode

Enable saving variables to MMC(FAT) and SPI based on primary
bootmode. If bootmode is JTAG, dont save env anywhere(NOWHERE).

Enable ENV_FAT_DEVICE_AND_PART="0:auto" for Versal platforms as well.

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

# 35b65dd8 15-Dec-2020 Harald Seiler <hws@denx.de>

reset: Remove addr parameter from reset_cpu()

Historically, the reset_cpu() function had an `addr` parameter which was
meant to pass in an address of the reset vector location, where the CPU
should reset to. This feature is no longer used anywhere in U-Boot as
all reset_cpu() implementations now ignore the passed value. Generic
code has been added which always calls reset_cpu() with `0` which means
this feature can no longer be used easily anyway.

Over time, many implementations seem to have "misunderstood" the
existence of this parameter as a way to customize/parameterize the reset
(e.g. COLD vs WARM resets). As this is not properly supported, the
code will almost always not do what it is intended to (because all
call-sites just call reset_cpu() with 0).

To avoid confusion and to clean up the codebase from unused left-overs
of the past, remove the `addr` parameter entirely. Code which intends
to support different kinds of resets should be rewritten as a sysreset
driver instead.

This transformation was done with the following coccinelle patch:

@@
expression argvalue;
@@
- reset_cpu(argvalue)
+ reset_cpu()

@@
identifier argname;
type argtype;
@@
- reset_cpu(argtype argname)
+ reset_cpu(void)
{ ... }

Signed-off-by: Harald Seiler <hws@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

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

common: Drop asm/global_data.h from common header

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

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

# 8b85dfc6 16-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Avoid accessing seq directly

At present various drivers etc. access the device's 'seq' member directly.
This makes it harder to change the meaning of that member. Change access
to go through a function instead.

The drivers/i2c/lpc32xx_i2c.c file is left unchanged for now.

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

# d61728c8 03-Aug-2020 Michal Simek <michal.simek@amd.com>

xilinx: board: Read the whole eeprom not just offset

Starts to use new way how eeproms should be referenced.
Reference is done via nvmem alias nodes. When this new way is specified
code itself read the eeprom and decode xilinx legacy format and fill struct
xilinx_board_description. Then based on information present there board_*
variables are setup.
If variables are saved and content can't be changed information is just
shown on console.

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

# 62b96262 27-Jul-2020 Michal Simek <michal.simek@amd.com>

xilinx: Add support for ENV_VARS_UBOOT_RUNTIME_CONFIG

Start to use ENV_VARS_UBOOT_RUNTIME_CONFIG to enable/disable updating
variables with run time information.

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

# 22b6bb6c 09-Jul-2020 Michal Simek <michal.simek@amd.com>

xilinx: versal: Use lowest memory for U-Boot

Find and use the lowest memory for Versal to make sure that we keep u-boot
as low as possible and never use memory above u-boot's maximum VA mapping.

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

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

common: Drop log.h from common header

Move this header out of the common header.

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

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

command: Remove the cmd_tbl_t typedef

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

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

This requires quite a few header-file additions.

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

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

common: Drop net.h from common header

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

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

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

# 51f6c52e 08-Apr-2020 Michal Simek <michal.simek@amd.com>

xilinx: Move bootmode detection to separate function

Create special function for reading bootmode on Versal and ZynqMP.
Zynq is using specific function (without mask) already.
Future patches will be calling this function from different location too.

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

# a29511ee 08-Apr-2020 Michal Simek <michal.simek@amd.com>

xilinx: Move initrd_high setup to common location

Moving to common location initrd_high is also setup for Zynq which hasn't
done in run time code.

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

# 80fdef12 30-Mar-2020 Michal Simek <michal.simek@amd.com>

xilinx: Introduce board_late_init_xilinx()

This function should keep common shared late configurations for Xilinx
SoCs.

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

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

common: Move reset_cpu() to the CPU header

Move this function out of common.h and into a relevant header file.

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

# 53c69dec 18-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

board: xilinx: Add support for user configurable boot script offset

Currently "script_offset_f" env variable is hardcoded, this variable
specifies from which offset of the flash boot.scr should be read/write.
As flashes are of different sizes having a fixed offset makes it
difficult to load other images into the flash which may overwrite the
boot script or cannot utilize the full memory. This current fix
creates a new config "CONFIG_BOOT_SCRIPT_OFFSET" which holds the
offset address, overwrites the "script_offset_f" variable.
Also removed existing variable with default values, as the default
values are held by CONFIG_BOOT_SCRIPT_OFFSET

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c5b7bb1 16-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Fix emmc boot mode boot_target issue

Emmc boot devcie is mounted to sdhci@f1050000 controller on versal, while
in emmc boot mode, boot tragets are set to mmc0. So removed mmc0 and using
the dev seq number from the sdhci@f1050000 controller.
Dev seq number is setup based on DT aliases that's why needs to be setup at
run time.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

common: Move some board functions out of common.h

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

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

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

common: Move get_ticks() function out of common.h

This function belongs in time.h so move it over and add a comment.

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

# f0c16cd6 11-Jul-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Add new dfu usb distro boot command

This patch adds new dfu usb distro boot command to look for bootscript
from dfu-util and runs it.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>

# 3d865acb 25-Jun-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Add new jtag distro boot command

This patch adds new jtag distro boot command to look for bootscript file
in DDR and execute it first incase of jtag bootmode.
This patch also updates scriptaddr to 512MB as there is high of script
corruption incase of bigger kernel image.

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

# aef149e9 29-Apr-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Enable memory mapping via DT

Code reads DT and setup MMU table based on memory node. This will ensure
that only DT needs to be changed.

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

# 085201c2 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Set initrd_high to as high as possible

This patch is setting up the initrd_high to as high as possible by leaving
max stack size for u-boot so that bigger rootfs can also be loaded by
u-boot for booting kernel.

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

# 26e054c9 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: fpga: Add PL bit stream load support

This patch adds PL bitstream load support for Versal platform. The PL
bitstream is loaded by making an SMC to ATF which in turn communicates
with platform firmware which configures and loads PL bitstream on to PL.

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

# bfd092f9 31-Jan-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Define board_late_init for versal

Define board_late_init which performs bootmode detection
and prepares corresponding distro boot commaand sequence.

Also disable it for mini platforms because simply there is no need to have
it enabled.
But also disable it for virtual platform because Qemu is not modelling this
register space that's why travis testing would fail. This configuration
should be reverted when mainline Qemu is updated.

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

# 47a766f9 28-Jan-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig

Move hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up
for different platforms.

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

# fb771793 28-Jan-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Remove one level of indentation in board_early_init_r()

Simplify code indentation.

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

# ec48b6c9 22-Aug-2018 Michal Simek <michal.simek@amd.com>

arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
Engines with leading-edge memory and interfacing technologies to deliver
powerful heterogeneous acceleration for any application. The Versal AI
Core series has five devices, offering 128 to 400 AI Engines. The series
includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
than 1,900 DSP engines optimized for high-precision floating point with
low latency.

The patch is adding necessary infrastructure in place without enabling
platform which is done in separate patch.

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

# 1d15612b 19-Jan-2023 Algapally Santosh Sagar <santoshsagar.algapally@amd.com>

xilinx: versal: Add missing header

Add missing prototype to fix the sparse warning, warning: no
previous prototype for 'do_go_exec' [-Wmissing-prototypes].

Signed-off-by: Algapally Santosh Sagar <santoshsagar.algapally@amd.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20230120053617.32463-4-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

# a32c3e9e 25-Aug-2022 Michal Simek <michal.simek@amd.com>

arm64: xilinx: Move board_get_usable_ram_top() to common location

The commit ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory
location") adds functionality for ZynqMP to read reserved memory node and
do not place U-Boot to reserved location. This functionality is generic
across all Xilinx SOCs that's why move it to common location to be used by
all Xilinx SOCs.

On zynq platform this is also fixing issue where U-Boot was placed to
locating which was reserved already which ends up with error message
"ERROR: reserving fdt memory region failed (addr=30000000 size=10000000
flags=4)" which is shown when bdinfo is called.

Tested on vck190, zcu102, zc706 and kc705 to cover all platforms.

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

# d7fcbfc1 22-Jul-2022 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

fpga: xilinx: add bitstream flags to driver desc

Store a set of supported bitstream types in xilinx_desc structure.
It will be used to determine whether an FPGA image is able to be
loaded with a given driver.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Tested-by: Ricardo Salveti <ricardo@foundries.io>
Tested-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
Link: https://lore.kernel.org/r/20220722141614.297383-4-oleksandr.suvorov@foundries.io
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 2eeceb48 05-May-2022 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

arm64: versal: Add support to load an app at EL1

Add support to switch to EL1 and load an EL1 app from U-Boot which is
executing at EL2 or EL3 in aarch64 mode.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Link: https://lore.kernel.org/r/20220506055345.1921-1-ashok.reddy.soma@xilinx.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 9c563e91 29-Apr-2022 Michal Simek <michal.simek@xilinx.com>

xilinx: Handle board_get_usable_ram_top(0) properly

board_get_usable_ram_top() was designed for getting the top most location
for U-Boot allocation that's why function itself supports via total_size
parameter to find out where the right location for U-Boot is.
But function itself is also reused by different (EFI) which is passing
total_size as 0 to find out where the usable ram top is. For this case
doesn't make sense (a waste time) to call any lmb functions.
That's why simply return gd->ram_top.

And gd->ram_top is filled already based on previous call for U-Boot iself.
The same solution is also used by stm32mp by commit 92b611e8b003 ("stm32mp:
correctly handle board_get_usable_ram_top(0)") and commit c8510e397fad
("stm32mp: Fix board_get_usable_ram_top()").

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

# d8c033a9 13-Apr-2022 Peng Fan <peng.fan@nxp.com>

xilinx: versal: board: use CONFIG_COUNTER_FREQUENCY

Since versal has CONFIG_COUNTER_FREQUENCY, so use it. And
COUNTER_FREQUENCY will be dropped.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>

# f66d0b53 17-Mar-2022 Michal Simek <michal.simek@amd.com>

arm64: versal: Do not place u-boot to reserved memory location

Versal can also have reserved space in DT which u-boot has to avoid to
placing self to that location. The same change was done in ZynqMP by commit
ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory location")
and also for microblaze by commit d7b5cc89d329 ("microblaze: Do not place
u-boot to reserved memory location").

The patch was tested by adding reserved-memory node to DT and check via
bdinfo back.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/15426fa6d64835dd23c5c8c12bbfc97306fb6098.1647527129.git.michal.simek@xilinx.com

# bf97c460 23-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

versal: Return ENVL_NOWHERE instead of ENVL_UNKNOWN

The system fails to boot without any environment location, so return
ENVL_NOWHERE when there's nowhere to store the environment instead
of ENVL_UNKNOWN.

The same change was also done by commit 50918d0df5cb ("xilinx: Return
ENVL_NOWHERE instead of ENVL_UNKNOWN") for zynq and zynqmp.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/e4ed36408f10159677ed8060bfd5289f3e0691fa.1637752614.git.michal.simek@xilinx.com

# 5f4e1ff7 17-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Fix sdhci node name as per DT

Fix the sdhci node name in versal board file as per the name in
device tree and also check for sdhci node as part of backward
compatibility.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/9110ecdabcabcef63fffd4719095acf4326a26e4.1637236638.git.michal.simek@xilinx.com

# 82cb49dc 30-Mar-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Add usb dfu/thor distro boot support

Change "dfu_usb" to "usb_dfu" for better representation and change
required macros. Add 60s timeout of dfu-utils to start transaction.
Add support for usb thor to distro boot. Remove DFU_ALT_INFO_RAM
as we use bootcmd_usb_dfu instead of dfu_ram.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 4fb83c9c 23-Feb-2021 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

xilinx: versal: Add support for saving env based on bootmode

Enable saving variables to MMC(FAT) and SPI based on primary
bootmode. If bootmode is JTAG, dont save env anywhere(NOWHERE).

Enable ENV_FAT_DEVICE_AND_PART="0:auto" for Versal platforms as well.

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

# 35b65dd8 15-Dec-2020 Harald Seiler <hws@denx.de>

reset: Remove addr parameter from reset_cpu()

Historically, the reset_cpu() function had an `addr` parameter which was
meant to pass in an address of the reset vector location, where the CPU
should reset to. This feature is no longer used anywhere in U-Boot as
all reset_cpu() implementations now ignore the passed value. Generic
code has been added which always calls reset_cpu() with `0` which means
this feature can no longer be used easily anyway.

Over time, many implementations seem to have "misunderstood" the
existence of this parameter as a way to customize/parameterize the reset
(e.g. COLD vs WARM resets). As this is not properly supported, the
code will almost always not do what it is intended to (because all
call-sites just call reset_cpu() with 0).

To avoid confusion and to clean up the codebase from unused left-overs
of the past, remove the `addr` parameter entirely. Code which intends
to support different kinds of resets should be rewritten as a sysreset
driver instead.

This transformation was done with the following coccinelle patch:

@@
expression argvalue;
@@
- reset_cpu(argvalue)
+ reset_cpu()

@@
identifier argname;
type argtype;
@@
- reset_cpu(argtype argname)
+ reset_cpu(void)
{ ... }

Signed-off-by: Harald Seiler <hws@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

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

common: Drop asm/global_data.h from common header

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

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

# 8b85dfc6 16-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Avoid accessing seq directly

At present various drivers etc. access the device's 'seq' member directly.
This makes it harder to change the meaning of that member. Change access
to go through a function instead.

The drivers/i2c/lpc32xx_i2c.c file is left unchanged for now.

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

# d61728c8 03-Aug-2020 Michal Simek <michal.simek@amd.com>

xilinx: board: Read the whole eeprom not just offset

Starts to use new way how eeproms should be referenced.
Reference is done via nvmem alias nodes. When this new way is specified
code itself read the eeprom and decode xilinx legacy format and fill struct
xilinx_board_description. Then based on information present there board_*
variables are setup.
If variables are saved and content can't be changed information is just
shown on console.

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

# 62b96262 27-Jul-2020 Michal Simek <michal.simek@amd.com>

xilinx: Add support for ENV_VARS_UBOOT_RUNTIME_CONFIG

Start to use ENV_VARS_UBOOT_RUNTIME_CONFIG to enable/disable updating
variables with run time information.

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

# 22b6bb6c 09-Jul-2020 Michal Simek <michal.simek@amd.com>

xilinx: versal: Use lowest memory for U-Boot

Find and use the lowest memory for Versal to make sure that we keep u-boot
as low as possible and never use memory above u-boot's maximum VA mapping.

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

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

common: Drop log.h from common header

Move this header out of the common header.

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

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

command: Remove the cmd_tbl_t typedef

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

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

This requires quite a few header-file additions.

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

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

common: Drop net.h from common header

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

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

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

# 51f6c52e 08-Apr-2020 Michal Simek <michal.simek@amd.com>

xilinx: Move bootmode detection to separate function

Create special function for reading bootmode on Versal and ZynqMP.
Zynq is using specific function (without mask) already.
Future patches will be calling this function from different location too.

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

# a29511ee 08-Apr-2020 Michal Simek <michal.simek@amd.com>

xilinx: Move initrd_high setup to common location

Moving to common location initrd_high is also setup for Zynq which hasn't
done in run time code.

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

# 80fdef12 30-Mar-2020 Michal Simek <michal.simek@amd.com>

xilinx: Introduce board_late_init_xilinx()

This function should keep common shared late configurations for Xilinx
SoCs.

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

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

common: Move reset_cpu() to the CPU header

Move this function out of common.h and into a relevant header file.

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

# 53c69dec 18-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

board: xilinx: Add support for user configurable boot script offset

Currently "script_offset_f" env variable is hardcoded, this variable
specifies from which offset of the flash boot.scr should be read/write.
As flashes are of different sizes having a fixed offset makes it
difficult to load other images into the flash which may overwrite the
boot script or cannot utilize the full memory. This current fix
creates a new config "CONFIG_BOOT_SCRIPT_OFFSET" which holds the
offset address, overwrites the "script_offset_f" variable.
Also removed existing variable with default values, as the default
values are held by CONFIG_BOOT_SCRIPT_OFFSET

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c5b7bb1 16-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Fix emmc boot mode boot_target issue

Emmc boot devcie is mounted to sdhci@f1050000 controller on versal, while
in emmc boot mode, boot tragets are set to mmc0. So removed mmc0 and using
the dev seq number from the sdhci@f1050000 controller.
Dev seq number is setup based on DT aliases that's why needs to be setup at
run time.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

common: Move some board functions out of common.h

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

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

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

common: Move get_ticks() function out of common.h

This function belongs in time.h so move it over and add a comment.

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

# f0c16cd6 11-Jul-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Add new dfu usb distro boot command

This patch adds new dfu usb distro boot command to look for bootscript
from dfu-util and runs it.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>

# 3d865acb 25-Jun-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Add new jtag distro boot command

This patch adds new jtag distro boot command to look for bootscript file
in DDR and execute it first incase of jtag bootmode.
This patch also updates scriptaddr to 512MB as there is high of script
corruption incase of bigger kernel image.

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

# aef149e9 29-Apr-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Enable memory mapping via DT

Code reads DT and setup MMU table based on memory node. This will ensure
that only DT needs to be changed.

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

# 085201c2 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Set initrd_high to as high as possible

This patch is setting up the initrd_high to as high as possible by leaving
max stack size for u-boot so that bigger rootfs can also be loaded by
u-boot for booting kernel.

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

# 26e054c9 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: fpga: Add PL bit stream load support

This patch adds PL bitstream load support for Versal platform. The PL
bitstream is loaded by making an SMC to ATF which in turn communicates
with platform firmware which configures and loads PL bitstream on to PL.

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

# bfd092f9 31-Jan-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Define board_late_init for versal

Define board_late_init which performs bootmode detection
and prepares corresponding distro boot commaand sequence.

Also disable it for mini platforms because simply there is no need to have
it enabled.
But also disable it for virtual platform because Qemu is not modelling this
register space that's why travis testing would fail. This configuration
should be reverted when mainline Qemu is updated.

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

# 47a766f9 28-Jan-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig

Move hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up
for different platforms.

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

# fb771793 28-Jan-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Remove one level of indentation in board_early_init_r()

Simplify code indentation.

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

# ec48b6c9 22-Aug-2018 Michal Simek <michal.simek@amd.com>

arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
Engines with leading-edge memory and interfacing technologies to deliver
powerful heterogeneous acceleration for any application. The Versal AI
Core series has five devices, offering 128 to 400 AI Engines. The series
includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
than 1,900 DSP engines optimized for high-precision floating point with
low latency.

The patch is adding necessary infrastructure in place without enabling
platform which is done in separate patch.

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

# a32c3e9e 25-Aug-2022 Michal Simek <michal.simek@amd.com>

arm64: xilinx: Move board_get_usable_ram_top() to common location

The commit ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory
location") adds functionality for ZynqMP to read reserved memory node and
do not place U-Boot to reserved location. This functionality is generic
across all Xilinx SOCs that's why move it to common location to be used by
all Xilinx SOCs.

On zynq platform this is also fixing issue where U-Boot was placed to
locating which was reserved already which ends up with error message
"ERROR: reserving fdt memory region failed (addr=30000000 size=10000000
flags=4)" which is shown when bdinfo is called.

Tested on vck190, zcu102, zc706 and kc705 to cover all platforms.

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

# d7fcbfc1 22-Jul-2022 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

fpga: xilinx: add bitstream flags to driver desc

Store a set of supported bitstream types in xilinx_desc structure.
It will be used to determine whether an FPGA image is able to be
loaded with a given driver.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Tested-by: Ricardo Salveti <ricardo@foundries.io>
Tested-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
Link: https://lore.kernel.org/r/20220722141614.297383-4-oleksandr.suvorov@foundries.io
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 2eeceb48 05-May-2022 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

arm64: versal: Add support to load an app at EL1

Add support to switch to EL1 and load an EL1 app from U-Boot which is
executing at EL2 or EL3 in aarch64 mode.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Link: https://lore.kernel.org/r/20220506055345.1921-1-ashok.reddy.soma@xilinx.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 9c563e91 29-Apr-2022 Michal Simek <michal.simek@xilinx.com>

xilinx: Handle board_get_usable_ram_top(0) properly

board_get_usable_ram_top() was designed for getting the top most location
for U-Boot allocation that's why function itself supports via total_size
parameter to find out where the right location for U-Boot is.
But function itself is also reused by different (EFI) which is passing
total_size as 0 to find out where the usable ram top is. For this case
doesn't make sense (a waste time) to call any lmb functions.
That's why simply return gd->ram_top.

And gd->ram_top is filled already based on previous call for U-Boot iself.
The same solution is also used by stm32mp by commit 92b611e8b003 ("stm32mp:
correctly handle board_get_usable_ram_top(0)") and commit c8510e397fad
("stm32mp: Fix board_get_usable_ram_top()").

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

# d8c033a9 13-Apr-2022 Peng Fan <peng.fan@nxp.com>

xilinx: versal: board: use CONFIG_COUNTER_FREQUENCY

Since versal has CONFIG_COUNTER_FREQUENCY, so use it. And
COUNTER_FREQUENCY will be dropped.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>

# f66d0b53 17-Mar-2022 Michal Simek <michal.simek@amd.com>

arm64: versal: Do not place u-boot to reserved memory location

Versal can also have reserved space in DT which u-boot has to avoid to
placing self to that location. The same change was done in ZynqMP by commit
ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory location")
and also for microblaze by commit d7b5cc89d329 ("microblaze: Do not place
u-boot to reserved memory location").

The patch was tested by adding reserved-memory node to DT and check via
bdinfo back.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/15426fa6d64835dd23c5c8c12bbfc97306fb6098.1647527129.git.michal.simek@xilinx.com

# bf97c460 23-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

versal: Return ENVL_NOWHERE instead of ENVL_UNKNOWN

The system fails to boot without any environment location, so return
ENVL_NOWHERE when there's nowhere to store the environment instead
of ENVL_UNKNOWN.

The same change was also done by commit 50918d0df5cb ("xilinx: Return
ENVL_NOWHERE instead of ENVL_UNKNOWN") for zynq and zynqmp.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/e4ed36408f10159677ed8060bfd5289f3e0691fa.1637752614.git.michal.simek@xilinx.com

# 5f4e1ff7 17-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Fix sdhci node name as per DT

Fix the sdhci node name in versal board file as per the name in
device tree and also check for sdhci node as part of backward
compatibility.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/9110ecdabcabcef63fffd4719095acf4326a26e4.1637236638.git.michal.simek@xilinx.com

# 82cb49dc 30-Mar-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Add usb dfu/thor distro boot support

Change "dfu_usb" to "usb_dfu" for better representation and change
required macros. Add 60s timeout of dfu-utils to start transaction.
Add support for usb thor to distro boot. Remove DFU_ALT_INFO_RAM
as we use bootcmd_usb_dfu instead of dfu_ram.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 4fb83c9c 23-Feb-2021 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

xilinx: versal: Add support for saving env based on bootmode

Enable saving variables to MMC(FAT) and SPI based on primary
bootmode. If bootmode is JTAG, dont save env anywhere(NOWHERE).

Enable ENV_FAT_DEVICE_AND_PART="0:auto" for Versal platforms as well.

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

# 35b65dd8 15-Dec-2020 Harald Seiler <hws@denx.de>

reset: Remove addr parameter from reset_cpu()

Historically, the reset_cpu() function had an `addr` parameter which was
meant to pass in an address of the reset vector location, where the CPU
should reset to. This feature is no longer used anywhere in U-Boot as
all reset_cpu() implementations now ignore the passed value. Generic
code has been added which always calls reset_cpu() with `0` which means
this feature can no longer be used easily anyway.

Over time, many implementations seem to have "misunderstood" the
existence of this parameter as a way to customize/parameterize the reset
(e.g. COLD vs WARM resets). As this is not properly supported, the
code will almost always not do what it is intended to (because all
call-sites just call reset_cpu() with 0).

To avoid confusion and to clean up the codebase from unused left-overs
of the past, remove the `addr` parameter entirely. Code which intends
to support different kinds of resets should be rewritten as a sysreset
driver instead.

This transformation was done with the following coccinelle patch:

@@
expression argvalue;
@@
- reset_cpu(argvalue)
+ reset_cpu()

@@
identifier argname;
type argtype;
@@
- reset_cpu(argtype argname)
+ reset_cpu(void)
{ ... }

Signed-off-by: Harald Seiler <hws@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

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

common: Drop asm/global_data.h from common header

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

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

# 8b85dfc6 16-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Avoid accessing seq directly

At present various drivers etc. access the device's 'seq' member directly.
This makes it harder to change the meaning of that member. Change access
to go through a function instead.

The drivers/i2c/lpc32xx_i2c.c file is left unchanged for now.

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

# d61728c8 03-Aug-2020 Michal Simek <michal.simek@amd.com>

xilinx: board: Read the whole eeprom not just offset

Starts to use new way how eeproms should be referenced.
Reference is done via nvmem alias nodes. When this new way is specified
code itself read the eeprom and decode xilinx legacy format and fill struct
xilinx_board_description. Then based on information present there board_*
variables are setup.
If variables are saved and content can't be changed information is just
shown on console.

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

# 62b96262 27-Jul-2020 Michal Simek <michal.simek@amd.com>

xilinx: Add support for ENV_VARS_UBOOT_RUNTIME_CONFIG

Start to use ENV_VARS_UBOOT_RUNTIME_CONFIG to enable/disable updating
variables with run time information.

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

# 22b6bb6c 09-Jul-2020 Michal Simek <michal.simek@amd.com>

xilinx: versal: Use lowest memory for U-Boot

Find and use the lowest memory for Versal to make sure that we keep u-boot
as low as possible and never use memory above u-boot's maximum VA mapping.

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

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

common: Drop log.h from common header

Move this header out of the common header.

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

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

command: Remove the cmd_tbl_t typedef

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

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

This requires quite a few header-file additions.

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

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

common: Drop net.h from common header

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

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

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

# 51f6c52e 08-Apr-2020 Michal Simek <michal.simek@amd.com>

xilinx: Move bootmode detection to separate function

Create special function for reading bootmode on Versal and ZynqMP.
Zynq is using specific function (without mask) already.
Future patches will be calling this function from different location too.

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

# a29511ee 08-Apr-2020 Michal Simek <michal.simek@amd.com>

xilinx: Move initrd_high setup to common location

Moving to common location initrd_high is also setup for Zynq which hasn't
done in run time code.

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

# 80fdef12 30-Mar-2020 Michal Simek <michal.simek@amd.com>

xilinx: Introduce board_late_init_xilinx()

This function should keep common shared late configurations for Xilinx
SoCs.

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

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

common: Move reset_cpu() to the CPU header

Move this function out of common.h and into a relevant header file.

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

# 53c69dec 18-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

board: xilinx: Add support for user configurable boot script offset

Currently "script_offset_f" env variable is hardcoded, this variable
specifies from which offset of the flash boot.scr should be read/write.
As flashes are of different sizes having a fixed offset makes it
difficult to load other images into the flash which may overwrite the
boot script or cannot utilize the full memory. This current fix
creates a new config "CONFIG_BOOT_SCRIPT_OFFSET" which holds the
offset address, overwrites the "script_offset_f" variable.
Also removed existing variable with default values, as the default
values are held by CONFIG_BOOT_SCRIPT_OFFSET

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c5b7bb1 16-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Fix emmc boot mode boot_target issue

Emmc boot devcie is mounted to sdhci@f1050000 controller on versal, while
in emmc boot mode, boot tragets are set to mmc0. So removed mmc0 and using
the dev seq number from the sdhci@f1050000 controller.
Dev seq number is setup based on DT aliases that's why needs to be setup at
run time.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

common: Move some board functions out of common.h

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

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

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

common: Move get_ticks() function out of common.h

This function belongs in time.h so move it over and add a comment.

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

# f0c16cd6 11-Jul-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Add new dfu usb distro boot command

This patch adds new dfu usb distro boot command to look for bootscript
from dfu-util and runs it.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>

# 3d865acb 25-Jun-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Add new jtag distro boot command

This patch adds new jtag distro boot command to look for bootscript file
in DDR and execute it first incase of jtag bootmode.
This patch also updates scriptaddr to 512MB as there is high of script
corruption incase of bigger kernel image.

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

# aef149e9 29-Apr-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Enable memory mapping via DT

Code reads DT and setup MMU table based on memory node. This will ensure
that only DT needs to be changed.

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

# 085201c2 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Set initrd_high to as high as possible

This patch is setting up the initrd_high to as high as possible by leaving
max stack size for u-boot so that bigger rootfs can also be loaded by
u-boot for booting kernel.

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

# 26e054c9 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: fpga: Add PL bit stream load support

This patch adds PL bitstream load support for Versal platform. The PL
bitstream is loaded by making an SMC to ATF which in turn communicates
with platform firmware which configures and loads PL bitstream on to PL.

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

# bfd092f9 31-Jan-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Define board_late_init for versal

Define board_late_init which performs bootmode detection
and prepares corresponding distro boot commaand sequence.

Also disable it for mini platforms because simply there is no need to have
it enabled.
But also disable it for virtual platform because Qemu is not modelling this
register space that's why travis testing would fail. This configuration
should be reverted when mainline Qemu is updated.

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

# 47a766f9 28-Jan-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig

Move hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up
for different platforms.

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

# fb771793 28-Jan-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Remove one level of indentation in board_early_init_r()

Simplify code indentation.

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

# ec48b6c9 22-Aug-2018 Michal Simek <michal.simek@amd.com>

arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
Engines with leading-edge memory and interfacing technologies to deliver
powerful heterogeneous acceleration for any application. The Versal AI
Core series has five devices, offering 128 to 400 AI Engines. The series
includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
than 1,900 DSP engines optimized for high-precision floating point with
low latency.

The patch is adding necessary infrastructure in place without enabling
platform which is done in separate patch.

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

# d7fcbfc1 22-Jul-2022 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

fpga: xilinx: add bitstream flags to driver desc

Store a set of supported bitstream types in xilinx_desc structure.
It will be used to determine whether an FPGA image is able to be
loaded with a given driver.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Tested-by: Ricardo Salveti <ricardo@foundries.io>
Tested-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
Link: https://lore.kernel.org/r/20220722141614.297383-4-oleksandr.suvorov@foundries.io
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 2eeceb48 05-May-2022 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

arm64: versal: Add support to load an app at EL1

Add support to switch to EL1 and load an EL1 app from U-Boot which is
executing at EL2 or EL3 in aarch64 mode.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Link: https://lore.kernel.org/r/20220506055345.1921-1-ashok.reddy.soma@xilinx.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 9c563e91 29-Apr-2022 Michal Simek <michal.simek@xilinx.com>

xilinx: Handle board_get_usable_ram_top(0) properly

board_get_usable_ram_top() was designed for getting the top most location
for U-Boot allocation that's why function itself supports via total_size
parameter to find out where the right location for U-Boot is.
But function itself is also reused by different (EFI) which is passing
total_size as 0 to find out where the usable ram top is. For this case
doesn't make sense (a waste time) to call any lmb functions.
That's why simply return gd->ram_top.

And gd->ram_top is filled already based on previous call for U-Boot iself.
The same solution is also used by stm32mp by commit 92b611e8b003 ("stm32mp:
correctly handle board_get_usable_ram_top(0)") and commit c8510e397fad
("stm32mp: Fix board_get_usable_ram_top()").

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

# d8c033a9 13-Apr-2022 Peng Fan <peng.fan@nxp.com>

xilinx: versal: board: use CONFIG_COUNTER_FREQUENCY

Since versal has CONFIG_COUNTER_FREQUENCY, so use it. And
COUNTER_FREQUENCY will be dropped.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>

# f66d0b53 17-Mar-2022 Michal Simek <michal.simek@amd.com>

arm64: versal: Do not place u-boot to reserved memory location

Versal can also have reserved space in DT which u-boot has to avoid to
placing self to that location. The same change was done in ZynqMP by commit
ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory location")
and also for microblaze by commit d7b5cc89d329 ("microblaze: Do not place
u-boot to reserved memory location").

The patch was tested by adding reserved-memory node to DT and check via
bdinfo back.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/15426fa6d64835dd23c5c8c12bbfc97306fb6098.1647527129.git.michal.simek@xilinx.com

# bf97c460 23-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

versal: Return ENVL_NOWHERE instead of ENVL_UNKNOWN

The system fails to boot without any environment location, so return
ENVL_NOWHERE when there's nowhere to store the environment instead
of ENVL_UNKNOWN.

The same change was also done by commit 50918d0df5cb ("xilinx: Return
ENVL_NOWHERE instead of ENVL_UNKNOWN") for zynq and zynqmp.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/e4ed36408f10159677ed8060bfd5289f3e0691fa.1637752614.git.michal.simek@xilinx.com

# 5f4e1ff7 17-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Fix sdhci node name as per DT

Fix the sdhci node name in versal board file as per the name in
device tree and also check for sdhci node as part of backward
compatibility.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/9110ecdabcabcef63fffd4719095acf4326a26e4.1637236638.git.michal.simek@xilinx.com

# 82cb49dc 30-Mar-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Add usb dfu/thor distro boot support

Change "dfu_usb" to "usb_dfu" for better representation and change
required macros. Add 60s timeout of dfu-utils to start transaction.
Add support for usb thor to distro boot. Remove DFU_ALT_INFO_RAM
as we use bootcmd_usb_dfu instead of dfu_ram.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 4fb83c9c 23-Feb-2021 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

xilinx: versal: Add support for saving env based on bootmode

Enable saving variables to MMC(FAT) and SPI based on primary
bootmode. If bootmode is JTAG, dont save env anywhere(NOWHERE).

Enable ENV_FAT_DEVICE_AND_PART="0:auto" for Versal platforms as well.

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

# 35b65dd8 15-Dec-2020 Harald Seiler <hws@denx.de>

reset: Remove addr parameter from reset_cpu()

Historically, the reset_cpu() function had an `addr` parameter which was
meant to pass in an address of the reset vector location, where the CPU
should reset to. This feature is no longer used anywhere in U-Boot as
all reset_cpu() implementations now ignore the passed value. Generic
code has been added which always calls reset_cpu() with `0` which means
this feature can no longer be used easily anyway.

Over time, many implementations seem to have "misunderstood" the
existence of this parameter as a way to customize/parameterize the reset
(e.g. COLD vs WARM resets). As this is not properly supported, the
code will almost always not do what it is intended to (because all
call-sites just call reset_cpu() with 0).

To avoid confusion and to clean up the codebase from unused left-overs
of the past, remove the `addr` parameter entirely. Code which intends
to support different kinds of resets should be rewritten as a sysreset
driver instead.

This transformation was done with the following coccinelle patch:

@@
expression argvalue;
@@
- reset_cpu(argvalue)
+ reset_cpu()

@@
identifier argname;
type argtype;
@@
- reset_cpu(argtype argname)
+ reset_cpu(void)
{ ... }

Signed-off-by: Harald Seiler <hws@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

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

common: Drop asm/global_data.h from common header

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

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

# 8b85dfc6 16-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Avoid accessing seq directly

At present various drivers etc. access the device's 'seq' member directly.
This makes it harder to change the meaning of that member. Change access
to go through a function instead.

The drivers/i2c/lpc32xx_i2c.c file is left unchanged for now.

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

# d61728c8 03-Aug-2020 Michal Simek <michal.simek@amd.com>

xilinx: board: Read the whole eeprom not just offset

Starts to use new way how eeproms should be referenced.
Reference is done via nvmem alias nodes. When this new way is specified
code itself read the eeprom and decode xilinx legacy format and fill struct
xilinx_board_description. Then based on information present there board_*
variables are setup.
If variables are saved and content can't be changed information is just
shown on console.

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

# 62b96262 27-Jul-2020 Michal Simek <michal.simek@amd.com>

xilinx: Add support for ENV_VARS_UBOOT_RUNTIME_CONFIG

Start to use ENV_VARS_UBOOT_RUNTIME_CONFIG to enable/disable updating
variables with run time information.

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

# 22b6bb6c 09-Jul-2020 Michal Simek <michal.simek@amd.com>

xilinx: versal: Use lowest memory for U-Boot

Find and use the lowest memory for Versal to make sure that we keep u-boot
as low as possible and never use memory above u-boot's maximum VA mapping.

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

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

common: Drop log.h from common header

Move this header out of the common header.

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

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

command: Remove the cmd_tbl_t typedef

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

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

This requires quite a few header-file additions.

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

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

common: Drop net.h from common header

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

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

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

# 51f6c52e 08-Apr-2020 Michal Simek <michal.simek@amd.com>

xilinx: Move bootmode detection to separate function

Create special function for reading bootmode on Versal and ZynqMP.
Zynq is using specific function (without mask) already.
Future patches will be calling this function from different location too.

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

# a29511ee 08-Apr-2020 Michal Simek <michal.simek@amd.com>

xilinx: Move initrd_high setup to common location

Moving to common location initrd_high is also setup for Zynq which hasn't
done in run time code.

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

# 80fdef12 30-Mar-2020 Michal Simek <michal.simek@amd.com>

xilinx: Introduce board_late_init_xilinx()

This function should keep common shared late configurations for Xilinx
SoCs.

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

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

common: Move reset_cpu() to the CPU header

Move this function out of common.h and into a relevant header file.

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

# 53c69dec 18-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

board: xilinx: Add support for user configurable boot script offset

Currently "script_offset_f" env variable is hardcoded, this variable
specifies from which offset of the flash boot.scr should be read/write.
As flashes are of different sizes having a fixed offset makes it
difficult to load other images into the flash which may overwrite the
boot script or cannot utilize the full memory. This current fix
creates a new config "CONFIG_BOOT_SCRIPT_OFFSET" which holds the
offset address, overwrites the "script_offset_f" variable.
Also removed existing variable with default values, as the default
values are held by CONFIG_BOOT_SCRIPT_OFFSET

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c5b7bb1 16-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Fix emmc boot mode boot_target issue

Emmc boot devcie is mounted to sdhci@f1050000 controller on versal, while
in emmc boot mode, boot tragets are set to mmc0. So removed mmc0 and using
the dev seq number from the sdhci@f1050000 controller.
Dev seq number is setup based on DT aliases that's why needs to be setup at
run time.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

common: Move some board functions out of common.h

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

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

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

common: Move get_ticks() function out of common.h

This function belongs in time.h so move it over and add a comment.

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

# f0c16cd6 11-Jul-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Add new dfu usb distro boot command

This patch adds new dfu usb distro boot command to look for bootscript
from dfu-util and runs it.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>

# 3d865acb 25-Jun-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Add new jtag distro boot command

This patch adds new jtag distro boot command to look for bootscript file
in DDR and execute it first incase of jtag bootmode.
This patch also updates scriptaddr to 512MB as there is high of script
corruption incase of bigger kernel image.

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

# aef149e9 29-Apr-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Enable memory mapping via DT

Code reads DT and setup MMU table based on memory node. This will ensure
that only DT needs to be changed.

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

# 085201c2 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Set initrd_high to as high as possible

This patch is setting up the initrd_high to as high as possible by leaving
max stack size for u-boot so that bigger rootfs can also be loaded by
u-boot for booting kernel.

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

# 26e054c9 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: fpga: Add PL bit stream load support

This patch adds PL bitstream load support for Versal platform. The PL
bitstream is loaded by making an SMC to ATF which in turn communicates
with platform firmware which configures and loads PL bitstream on to PL.

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

# bfd092f9 31-Jan-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Define board_late_init for versal

Define board_late_init which performs bootmode detection
and prepares corresponding distro boot commaand sequence.

Also disable it for mini platforms because simply there is no need to have
it enabled.
But also disable it for virtual platform because Qemu is not modelling this
register space that's why travis testing would fail. This configuration
should be reverted when mainline Qemu is updated.

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

# 47a766f9 28-Jan-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig

Move hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up
for different platforms.

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

# fb771793 28-Jan-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Remove one level of indentation in board_early_init_r()

Simplify code indentation.

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

# ec48b6c9 22-Aug-2018 Michal Simek <michal.simek@amd.com>

arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
Engines with leading-edge memory and interfacing technologies to deliver
powerful heterogeneous acceleration for any application. The Versal AI
Core series has five devices, offering 128 to 400 AI Engines. The series
includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
than 1,900 DSP engines optimized for high-precision floating point with
low latency.

The patch is adding necessary infrastructure in place without enabling
platform which is done in separate patch.

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

# 2eeceb48 05-May-2022 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

arm64: versal: Add support to load an app at EL1

Add support to switch to EL1 and load an EL1 app from U-Boot which is
executing at EL2 or EL3 in aarch64 mode.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Link: https://lore.kernel.org/r/20220506055345.1921-1-ashok.reddy.soma@xilinx.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 9c563e91 29-Apr-2022 Michal Simek <michal.simek@xilinx.com>

xilinx: Handle board_get_usable_ram_top(0) properly

board_get_usable_ram_top() was designed for getting the top most location
for U-Boot allocation that's why function itself supports via total_size
parameter to find out where the right location for U-Boot is.
But function itself is also reused by different (EFI) which is passing
total_size as 0 to find out where the usable ram top is. For this case
doesn't make sense (a waste time) to call any lmb functions.
That's why simply return gd->ram_top.

And gd->ram_top is filled already based on previous call for U-Boot iself.
The same solution is also used by stm32mp by commit 92b611e8b003 ("stm32mp:
correctly handle board_get_usable_ram_top(0)") and commit c8510e397fad
("stm32mp: Fix board_get_usable_ram_top()").

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

# d8c033a9 13-Apr-2022 Peng Fan <peng.fan@nxp.com>

xilinx: versal: board: use CONFIG_COUNTER_FREQUENCY

Since versal has CONFIG_COUNTER_FREQUENCY, so use it. And
COUNTER_FREQUENCY will be dropped.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>

# f66d0b53 17-Mar-2022 Michal Simek <michal.simek@amd.com>

arm64: versal: Do not place u-boot to reserved memory location

Versal can also have reserved space in DT which u-boot has to avoid to
placing self to that location. The same change was done in ZynqMP by commit
ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory location")
and also for microblaze by commit d7b5cc89d329 ("microblaze: Do not place
u-boot to reserved memory location").

The patch was tested by adding reserved-memory node to DT and check via
bdinfo back.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/15426fa6d64835dd23c5c8c12bbfc97306fb6098.1647527129.git.michal.simek@xilinx.com

# bf97c460 23-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

versal: Return ENVL_NOWHERE instead of ENVL_UNKNOWN

The system fails to boot without any environment location, so return
ENVL_NOWHERE when there's nowhere to store the environment instead
of ENVL_UNKNOWN.

The same change was also done by commit 50918d0df5cb ("xilinx: Return
ENVL_NOWHERE instead of ENVL_UNKNOWN") for zynq and zynqmp.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/e4ed36408f10159677ed8060bfd5289f3e0691fa.1637752614.git.michal.simek@xilinx.com

# 5f4e1ff7 17-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Fix sdhci node name as per DT

Fix the sdhci node name in versal board file as per the name in
device tree and also check for sdhci node as part of backward
compatibility.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/9110ecdabcabcef63fffd4719095acf4326a26e4.1637236638.git.michal.simek@xilinx.com

# 82cb49dc 30-Mar-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Add usb dfu/thor distro boot support

Change "dfu_usb" to "usb_dfu" for better representation and change
required macros. Add 60s timeout of dfu-utils to start transaction.
Add support for usb thor to distro boot. Remove DFU_ALT_INFO_RAM
as we use bootcmd_usb_dfu instead of dfu_ram.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 4fb83c9c 23-Feb-2021 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

xilinx: versal: Add support for saving env based on bootmode

Enable saving variables to MMC(FAT) and SPI based on primary
bootmode. If bootmode is JTAG, dont save env anywhere(NOWHERE).

Enable ENV_FAT_DEVICE_AND_PART="0:auto" for Versal platforms as well.

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

# 35b65dd8 15-Dec-2020 Harald Seiler <hws@denx.de>

reset: Remove addr parameter from reset_cpu()

Historically, the reset_cpu() function had an `addr` parameter which was
meant to pass in an address of the reset vector location, where the CPU
should reset to. This feature is no longer used anywhere in U-Boot as
all reset_cpu() implementations now ignore the passed value. Generic
code has been added which always calls reset_cpu() with `0` which means
this feature can no longer be used easily anyway.

Over time, many implementations seem to have "misunderstood" the
existence of this parameter as a way to customize/parameterize the reset
(e.g. COLD vs WARM resets). As this is not properly supported, the
code will almost always not do what it is intended to (because all
call-sites just call reset_cpu() with 0).

To avoid confusion and to clean up the codebase from unused left-overs
of the past, remove the `addr` parameter entirely. Code which intends
to support different kinds of resets should be rewritten as a sysreset
driver instead.

This transformation was done with the following coccinelle patch:

@@
expression argvalue;
@@
- reset_cpu(argvalue)
+ reset_cpu()

@@
identifier argname;
type argtype;
@@
- reset_cpu(argtype argname)
+ reset_cpu(void)
{ ... }

Signed-off-by: Harald Seiler <hws@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

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

common: Drop asm/global_data.h from common header

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

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

# 8b85dfc6 16-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Avoid accessing seq directly

At present various drivers etc. access the device's 'seq' member directly.
This makes it harder to change the meaning of that member. Change access
to go through a function instead.

The drivers/i2c/lpc32xx_i2c.c file is left unchanged for now.

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

# d61728c8 03-Aug-2020 Michal Simek <michal.simek@amd.com>

xilinx: board: Read the whole eeprom not just offset

Starts to use new way how eeproms should be referenced.
Reference is done via nvmem alias nodes. When this new way is specified
code itself read the eeprom and decode xilinx legacy format and fill struct
xilinx_board_description. Then based on information present there board_*
variables are setup.
If variables are saved and content can't be changed information is just
shown on console.

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

# 62b96262 27-Jul-2020 Michal Simek <michal.simek@amd.com>

xilinx: Add support for ENV_VARS_UBOOT_RUNTIME_CONFIG

Start to use ENV_VARS_UBOOT_RUNTIME_CONFIG to enable/disable updating
variables with run time information.

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

# 22b6bb6c 09-Jul-2020 Michal Simek <michal.simek@amd.com>

xilinx: versal: Use lowest memory for U-Boot

Find and use the lowest memory for Versal to make sure that we keep u-boot
as low as possible and never use memory above u-boot's maximum VA mapping.

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

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

common: Drop log.h from common header

Move this header out of the common header.

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

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

command: Remove the cmd_tbl_t typedef

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

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

This requires quite a few header-file additions.

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

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

common: Drop net.h from common header

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

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

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

# 51f6c52e 08-Apr-2020 Michal Simek <michal.simek@amd.com>

xilinx: Move bootmode detection to separate function

Create special function for reading bootmode on Versal and ZynqMP.
Zynq is using specific function (without mask) already.
Future patches will be calling this function from different location too.

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

# a29511ee 08-Apr-2020 Michal Simek <michal.simek@amd.com>

xilinx: Move initrd_high setup to common location

Moving to common location initrd_high is also setup for Zynq which hasn't
done in run time code.

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

# 80fdef12 30-Mar-2020 Michal Simek <michal.simek@amd.com>

xilinx: Introduce board_late_init_xilinx()

This function should keep common shared late configurations for Xilinx
SoCs.

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

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

common: Move reset_cpu() to the CPU header

Move this function out of common.h and into a relevant header file.

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

# 53c69dec 18-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

board: xilinx: Add support for user configurable boot script offset

Currently "script_offset_f" env variable is hardcoded, this variable
specifies from which offset of the flash boot.scr should be read/write.
As flashes are of different sizes having a fixed offset makes it
difficult to load other images into the flash which may overwrite the
boot script or cannot utilize the full memory. This current fix
creates a new config "CONFIG_BOOT_SCRIPT_OFFSET" which holds the
offset address, overwrites the "script_offset_f" variable.
Also removed existing variable with default values, as the default
values are held by CONFIG_BOOT_SCRIPT_OFFSET

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c5b7bb1 16-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Fix emmc boot mode boot_target issue

Emmc boot devcie is mounted to sdhci@f1050000 controller on versal, while
in emmc boot mode, boot tragets are set to mmc0. So removed mmc0 and using
the dev seq number from the sdhci@f1050000 controller.
Dev seq number is setup based on DT aliases that's why needs to be setup at
run time.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

common: Move some board functions out of common.h

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

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

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

common: Move get_ticks() function out of common.h

This function belongs in time.h so move it over and add a comment.

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

# f0c16cd6 11-Jul-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Add new dfu usb distro boot command

This patch adds new dfu usb distro boot command to look for bootscript
from dfu-util and runs it.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>

# 3d865acb 25-Jun-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Add new jtag distro boot command

This patch adds new jtag distro boot command to look for bootscript file
in DDR and execute it first incase of jtag bootmode.
This patch also updates scriptaddr to 512MB as there is high of script
corruption incase of bigger kernel image.

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

# aef149e9 29-Apr-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Enable memory mapping via DT

Code reads DT and setup MMU table based on memory node. This will ensure
that only DT needs to be changed.

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

# 085201c2 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Set initrd_high to as high as possible

This patch is setting up the initrd_high to as high as possible by leaving
max stack size for u-boot so that bigger rootfs can also be loaded by
u-boot for booting kernel.

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

# 26e054c9 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: fpga: Add PL bit stream load support

This patch adds PL bitstream load support for Versal platform. The PL
bitstream is loaded by making an SMC to ATF which in turn communicates
with platform firmware which configures and loads PL bitstream on to PL.

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

# bfd092f9 31-Jan-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Define board_late_init for versal

Define board_late_init which performs bootmode detection
and prepares corresponding distro boot commaand sequence.

Also disable it for mini platforms because simply there is no need to have
it enabled.
But also disable it for virtual platform because Qemu is not modelling this
register space that's why travis testing would fail. This configuration
should be reverted when mainline Qemu is updated.

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

# 47a766f9 28-Jan-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig

Move hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up
for different platforms.

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

# fb771793 28-Jan-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Remove one level of indentation in board_early_init_r()

Simplify code indentation.

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

# ec48b6c9 22-Aug-2018 Michal Simek <michal.simek@amd.com>

arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
Engines with leading-edge memory and interfacing technologies to deliver
powerful heterogeneous acceleration for any application. The Versal AI
Core series has five devices, offering 128 to 400 AI Engines. The series
includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
than 1,900 DSP engines optimized for high-precision floating point with
low latency.

The patch is adding necessary infrastructure in place without enabling
platform which is done in separate patch.

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

# 9c563e91 29-Apr-2022 Michal Simek <michal.simek@xilinx.com>

xilinx: Handle board_get_usable_ram_top(0) properly

board_get_usable_ram_top() was designed for getting the top most location
for U-Boot allocation that's why function itself supports via total_size
parameter to find out where the right location for U-Boot is.
But function itself is also reused by different (EFI) which is passing
total_size as 0 to find out where the usable ram top is. For this case
doesn't make sense (a waste time) to call any lmb functions.
That's why simply return gd->ram_top.

And gd->ram_top is filled already based on previous call for U-Boot iself.
The same solution is also used by stm32mp by commit 92b611e8b003 ("stm32mp:
correctly handle board_get_usable_ram_top(0)") and commit c8510e397fad
("stm32mp: Fix board_get_usable_ram_top()").

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

# d8c033a9 13-Apr-2022 Peng Fan <peng.fan@nxp.com>

xilinx: versal: board: use CONFIG_COUNTER_FREQUENCY

Since versal has CONFIG_COUNTER_FREQUENCY, so use it. And
COUNTER_FREQUENCY will be dropped.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>

# f66d0b53 17-Mar-2022 Michal Simek <michal.simek@amd.com>

arm64: versal: Do not place u-boot to reserved memory location

Versal can also have reserved space in DT which u-boot has to avoid to
placing self to that location. The same change was done in ZynqMP by commit
ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory location")
and also for microblaze by commit d7b5cc89d329 ("microblaze: Do not place
u-boot to reserved memory location").

The patch was tested by adding reserved-memory node to DT and check via
bdinfo back.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/15426fa6d64835dd23c5c8c12bbfc97306fb6098.1647527129.git.michal.simek@xilinx.com

# bf97c460 23-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

versal: Return ENVL_NOWHERE instead of ENVL_UNKNOWN

The system fails to boot without any environment location, so return
ENVL_NOWHERE when there's nowhere to store the environment instead
of ENVL_UNKNOWN.

The same change was also done by commit 50918d0df5cb ("xilinx: Return
ENVL_NOWHERE instead of ENVL_UNKNOWN") for zynq and zynqmp.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/e4ed36408f10159677ed8060bfd5289f3e0691fa.1637752614.git.michal.simek@xilinx.com

# 5f4e1ff7 17-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Fix sdhci node name as per DT

Fix the sdhci node name in versal board file as per the name in
device tree and also check for sdhci node as part of backward
compatibility.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/9110ecdabcabcef63fffd4719095acf4326a26e4.1637236638.git.michal.simek@xilinx.com

# 82cb49dc 30-Mar-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Add usb dfu/thor distro boot support

Change "dfu_usb" to "usb_dfu" for better representation and change
required macros. Add 60s timeout of dfu-utils to start transaction.
Add support for usb thor to distro boot. Remove DFU_ALT_INFO_RAM
as we use bootcmd_usb_dfu instead of dfu_ram.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 4fb83c9c 23-Feb-2021 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

xilinx: versal: Add support for saving env based on bootmode

Enable saving variables to MMC(FAT) and SPI based on primary
bootmode. If bootmode is JTAG, dont save env anywhere(NOWHERE).

Enable ENV_FAT_DEVICE_AND_PART="0:auto" for Versal platforms as well.

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

# 35b65dd8 15-Dec-2020 Harald Seiler <hws@denx.de>

reset: Remove addr parameter from reset_cpu()

Historically, the reset_cpu() function had an `addr` parameter which was
meant to pass in an address of the reset vector location, where the CPU
should reset to. This feature is no longer used anywhere in U-Boot as
all reset_cpu() implementations now ignore the passed value. Generic
code has been added which always calls reset_cpu() with `0` which means
this feature can no longer be used easily anyway.

Over time, many implementations seem to have "misunderstood" the
existence of this parameter as a way to customize/parameterize the reset
(e.g. COLD vs WARM resets). As this is not properly supported, the
code will almost always not do what it is intended to (because all
call-sites just call reset_cpu() with 0).

To avoid confusion and to clean up the codebase from unused left-overs
of the past, remove the `addr` parameter entirely. Code which intends
to support different kinds of resets should be rewritten as a sysreset
driver instead.

This transformation was done with the following coccinelle patch:

@@
expression argvalue;
@@
- reset_cpu(argvalue)
+ reset_cpu()

@@
identifier argname;
type argtype;
@@
- reset_cpu(argtype argname)
+ reset_cpu(void)
{ ... }

Signed-off-by: Harald Seiler <hws@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

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

common: Drop asm/global_data.h from common header

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

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

# 8b85dfc6 16-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Avoid accessing seq directly

At present various drivers etc. access the device's 'seq' member directly.
This makes it harder to change the meaning of that member. Change access
to go through a function instead.

The drivers/i2c/lpc32xx_i2c.c file is left unchanged for now.

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

# d61728c8 03-Aug-2020 Michal Simek <michal.simek@amd.com>

xilinx: board: Read the whole eeprom not just offset

Starts to use new way how eeproms should be referenced.
Reference is done via nvmem alias nodes. When this new way is specified
code itself read the eeprom and decode xilinx legacy format and fill struct
xilinx_board_description. Then based on information present there board_*
variables are setup.
If variables are saved and content can't be changed information is just
shown on console.

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

# 62b96262 27-Jul-2020 Michal Simek <michal.simek@amd.com>

xilinx: Add support for ENV_VARS_UBOOT_RUNTIME_CONFIG

Start to use ENV_VARS_UBOOT_RUNTIME_CONFIG to enable/disable updating
variables with run time information.

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

# 22b6bb6c 09-Jul-2020 Michal Simek <michal.simek@amd.com>

xilinx: versal: Use lowest memory for U-Boot

Find and use the lowest memory for Versal to make sure that we keep u-boot
as low as possible and never use memory above u-boot's maximum VA mapping.

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

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

common: Drop log.h from common header

Move this header out of the common header.

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

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

command: Remove the cmd_tbl_t typedef

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

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

This requires quite a few header-file additions.

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

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

common: Drop net.h from common header

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

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

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

# 51f6c52e 08-Apr-2020 Michal Simek <michal.simek@amd.com>

xilinx: Move bootmode detection to separate function

Create special function for reading bootmode on Versal and ZynqMP.
Zynq is using specific function (without mask) already.
Future patches will be calling this function from different location too.

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

# a29511ee 08-Apr-2020 Michal Simek <michal.simek@amd.com>

xilinx: Move initrd_high setup to common location

Moving to common location initrd_high is also setup for Zynq which hasn't
done in run time code.

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

# 80fdef12 30-Mar-2020 Michal Simek <michal.simek@amd.com>

xilinx: Introduce board_late_init_xilinx()

This function should keep common shared late configurations for Xilinx
SoCs.

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

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

common: Move reset_cpu() to the CPU header

Move this function out of common.h and into a relevant header file.

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

# 53c69dec 18-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

board: xilinx: Add support for user configurable boot script offset

Currently "script_offset_f" env variable is hardcoded, this variable
specifies from which offset of the flash boot.scr should be read/write.
As flashes are of different sizes having a fixed offset makes it
difficult to load other images into the flash which may overwrite the
boot script or cannot utilize the full memory. This current fix
creates a new config "CONFIG_BOOT_SCRIPT_OFFSET" which holds the
offset address, overwrites the "script_offset_f" variable.
Also removed existing variable with default values, as the default
values are held by CONFIG_BOOT_SCRIPT_OFFSET

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c5b7bb1 16-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Fix emmc boot mode boot_target issue

Emmc boot devcie is mounted to sdhci@f1050000 controller on versal, while
in emmc boot mode, boot tragets are set to mmc0. So removed mmc0 and using
the dev seq number from the sdhci@f1050000 controller.
Dev seq number is setup based on DT aliases that's why needs to be setup at
run time.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

common: Move some board functions out of common.h

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

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

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

common: Move get_ticks() function out of common.h

This function belongs in time.h so move it over and add a comment.

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

# f0c16cd6 11-Jul-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Add new dfu usb distro boot command

This patch adds new dfu usb distro boot command to look for bootscript
from dfu-util and runs it.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>

# 3d865acb 25-Jun-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Add new jtag distro boot command

This patch adds new jtag distro boot command to look for bootscript file
in DDR and execute it first incase of jtag bootmode.
This patch also updates scriptaddr to 512MB as there is high of script
corruption incase of bigger kernel image.

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

# aef149e9 29-Apr-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Enable memory mapping via DT

Code reads DT and setup MMU table based on memory node. This will ensure
that only DT needs to be changed.

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

# 085201c2 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Set initrd_high to as high as possible

This patch is setting up the initrd_high to as high as possible by leaving
max stack size for u-boot so that bigger rootfs can also be loaded by
u-boot for booting kernel.

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

# 26e054c9 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: fpga: Add PL bit stream load support

This patch adds PL bitstream load support for Versal platform. The PL
bitstream is loaded by making an SMC to ATF which in turn communicates
with platform firmware which configures and loads PL bitstream on to PL.

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

# bfd092f9 31-Jan-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Define board_late_init for versal

Define board_late_init which performs bootmode detection
and prepares corresponding distro boot commaand sequence.

Also disable it for mini platforms because simply there is no need to have
it enabled.
But also disable it for virtual platform because Qemu is not modelling this
register space that's why travis testing would fail. This configuration
should be reverted when mainline Qemu is updated.

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

# 47a766f9 28-Jan-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig

Move hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up
for different platforms.

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

# fb771793 28-Jan-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Remove one level of indentation in board_early_init_r()

Simplify code indentation.

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

# ec48b6c9 22-Aug-2018 Michal Simek <michal.simek@amd.com>

arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
Engines with leading-edge memory and interfacing technologies to deliver
powerful heterogeneous acceleration for any application. The Versal AI
Core series has five devices, offering 128 to 400 AI Engines. The series
includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
than 1,900 DSP engines optimized for high-precision floating point with
low latency.

The patch is adding necessary infrastructure in place without enabling
platform which is done in separate patch.

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

# d8c033a9 13-Apr-2022 Peng Fan <peng.fan@nxp.com>

xilinx: versal: board: use CONFIG_COUNTER_FREQUENCY

Since versal has CONFIG_COUNTER_FREQUENCY, so use it. And
COUNTER_FREQUENCY will be dropped.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>

# f66d0b53 17-Mar-2022 Michal Simek <michal.simek@amd.com>

arm64: versal: Do not place u-boot to reserved memory location

Versal can also have reserved space in DT which u-boot has to avoid to
placing self to that location. The same change was done in ZynqMP by commit
ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory location")
and also for microblaze by commit d7b5cc89d329 ("microblaze: Do not place
u-boot to reserved memory location").

The patch was tested by adding reserved-memory node to DT and check via
bdinfo back.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/15426fa6d64835dd23c5c8c12bbfc97306fb6098.1647527129.git.michal.simek@xilinx.com

# bf97c460 23-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

versal: Return ENVL_NOWHERE instead of ENVL_UNKNOWN

The system fails to boot without any environment location, so return
ENVL_NOWHERE when there's nowhere to store the environment instead
of ENVL_UNKNOWN.

The same change was also done by commit 50918d0df5cb ("xilinx: Return
ENVL_NOWHERE instead of ENVL_UNKNOWN") for zynq and zynqmp.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/e4ed36408f10159677ed8060bfd5289f3e0691fa.1637752614.git.michal.simek@xilinx.com

# 5f4e1ff7 17-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Fix sdhci node name as per DT

Fix the sdhci node name in versal board file as per the name in
device tree and also check for sdhci node as part of backward
compatibility.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/9110ecdabcabcef63fffd4719095acf4326a26e4.1637236638.git.michal.simek@xilinx.com

# 82cb49dc 30-Mar-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Add usb dfu/thor distro boot support

Change "dfu_usb" to "usb_dfu" for better representation and change
required macros. Add 60s timeout of dfu-utils to start transaction.
Add support for usb thor to distro boot. Remove DFU_ALT_INFO_RAM
as we use bootcmd_usb_dfu instead of dfu_ram.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 4fb83c9c 23-Feb-2021 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

xilinx: versal: Add support for saving env based on bootmode

Enable saving variables to MMC(FAT) and SPI based on primary
bootmode. If bootmode is JTAG, dont save env anywhere(NOWHERE).

Enable ENV_FAT_DEVICE_AND_PART="0:auto" for Versal platforms as well.

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

# 35b65dd8 15-Dec-2020 Harald Seiler <hws@denx.de>

reset: Remove addr parameter from reset_cpu()

Historically, the reset_cpu() function had an `addr` parameter which was
meant to pass in an address of the reset vector location, where the CPU
should reset to. This feature is no longer used anywhere in U-Boot as
all reset_cpu() implementations now ignore the passed value. Generic
code has been added which always calls reset_cpu() with `0` which means
this feature can no longer be used easily anyway.

Over time, many implementations seem to have "misunderstood" the
existence of this parameter as a way to customize/parameterize the reset
(e.g. COLD vs WARM resets). As this is not properly supported, the
code will almost always not do what it is intended to (because all
call-sites just call reset_cpu() with 0).

To avoid confusion and to clean up the codebase from unused left-overs
of the past, remove the `addr` parameter entirely. Code which intends
to support different kinds of resets should be rewritten as a sysreset
driver instead.

This transformation was done with the following coccinelle patch:

@@
expression argvalue;
@@
- reset_cpu(argvalue)
+ reset_cpu()

@@
identifier argname;
type argtype;
@@
- reset_cpu(argtype argname)
+ reset_cpu(void)
{ ... }

Signed-off-by: Harald Seiler <hws@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

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

common: Drop asm/global_data.h from common header

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

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

# 8b85dfc6 16-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Avoid accessing seq directly

At present various drivers etc. access the device's 'seq' member directly.
This makes it harder to change the meaning of that member. Change access
to go through a function instead.

The drivers/i2c/lpc32xx_i2c.c file is left unchanged for now.

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

# d61728c8 03-Aug-2020 Michal Simek <michal.simek@amd.com>

xilinx: board: Read the whole eeprom not just offset

Starts to use new way how eeproms should be referenced.
Reference is done via nvmem alias nodes. When this new way is specified
code itself read the eeprom and decode xilinx legacy format and fill struct
xilinx_board_description. Then based on information present there board_*
variables are setup.
If variables are saved and content can't be changed information is just
shown on console.

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

# 62b96262 27-Jul-2020 Michal Simek <michal.simek@amd.com>

xilinx: Add support for ENV_VARS_UBOOT_RUNTIME_CONFIG

Start to use ENV_VARS_UBOOT_RUNTIME_CONFIG to enable/disable updating
variables with run time information.

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

# 22b6bb6c 09-Jul-2020 Michal Simek <michal.simek@amd.com>

xilinx: versal: Use lowest memory for U-Boot

Find and use the lowest memory for Versal to make sure that we keep u-boot
as low as possible and never use memory above u-boot's maximum VA mapping.

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

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

common: Drop log.h from common header

Move this header out of the common header.

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

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

command: Remove the cmd_tbl_t typedef

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

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

This requires quite a few header-file additions.

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

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

common: Drop net.h from common header

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

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

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

# 51f6c52e 08-Apr-2020 Michal Simek <michal.simek@amd.com>

xilinx: Move bootmode detection to separate function

Create special function for reading bootmode on Versal and ZynqMP.
Zynq is using specific function (without mask) already.
Future patches will be calling this function from different location too.

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

# a29511ee 08-Apr-2020 Michal Simek <michal.simek@amd.com>

xilinx: Move initrd_high setup to common location

Moving to common location initrd_high is also setup for Zynq which hasn't
done in run time code.

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

# 80fdef12 30-Mar-2020 Michal Simek <michal.simek@amd.com>

xilinx: Introduce board_late_init_xilinx()

This function should keep common shared late configurations for Xilinx
SoCs.

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

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

common: Move reset_cpu() to the CPU header

Move this function out of common.h and into a relevant header file.

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

# 53c69dec 18-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

board: xilinx: Add support for user configurable boot script offset

Currently "script_offset_f" env variable is hardcoded, this variable
specifies from which offset of the flash boot.scr should be read/write.
As flashes are of different sizes having a fixed offset makes it
difficult to load other images into the flash which may overwrite the
boot script or cannot utilize the full memory. This current fix
creates a new config "CONFIG_BOOT_SCRIPT_OFFSET" which holds the
offset address, overwrites the "script_offset_f" variable.
Also removed existing variable with default values, as the default
values are held by CONFIG_BOOT_SCRIPT_OFFSET

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c5b7bb1 16-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Fix emmc boot mode boot_target issue

Emmc boot devcie is mounted to sdhci@f1050000 controller on versal, while
in emmc boot mode, boot tragets are set to mmc0. So removed mmc0 and using
the dev seq number from the sdhci@f1050000 controller.
Dev seq number is setup based on DT aliases that's why needs to be setup at
run time.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

common: Move some board functions out of common.h

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

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

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

common: Move get_ticks() function out of common.h

This function belongs in time.h so move it over and add a comment.

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

# f0c16cd6 11-Jul-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Add new dfu usb distro boot command

This patch adds new dfu usb distro boot command to look for bootscript
from dfu-util and runs it.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>

# 3d865acb 25-Jun-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Add new jtag distro boot command

This patch adds new jtag distro boot command to look for bootscript file
in DDR and execute it first incase of jtag bootmode.
This patch also updates scriptaddr to 512MB as there is high of script
corruption incase of bigger kernel image.

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

# aef149e9 29-Apr-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Enable memory mapping via DT

Code reads DT and setup MMU table based on memory node. This will ensure
that only DT needs to be changed.

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

# 085201c2 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Set initrd_high to as high as possible

This patch is setting up the initrd_high to as high as possible by leaving
max stack size for u-boot so that bigger rootfs can also be loaded by
u-boot for booting kernel.

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

# 26e054c9 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: fpga: Add PL bit stream load support

This patch adds PL bitstream load support for Versal platform. The PL
bitstream is loaded by making an SMC to ATF which in turn communicates
with platform firmware which configures and loads PL bitstream on to PL.

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

# bfd092f9 31-Jan-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Define board_late_init for versal

Define board_late_init which performs bootmode detection
and prepares corresponding distro boot commaand sequence.

Also disable it for mini platforms because simply there is no need to have
it enabled.
But also disable it for virtual platform because Qemu is not modelling this
register space that's why travis testing would fail. This configuration
should be reverted when mainline Qemu is updated.

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

# 47a766f9 28-Jan-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig

Move hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up
for different platforms.

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

# fb771793 28-Jan-2019 Michal Simek <michal.simek@amd.com>

arm64: versal: Remove one level of indentation in board_early_init_r()

Simplify code indentation.

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

# ec48b6c9 22-Aug-2018 Michal Simek <michal.simek@amd.com>

arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
Engines with leading-edge memory and interfacing technologies to deliver
powerful heterogeneous acceleration for any application. The Versal AI
Core series has five devices, offering 128 to 400 AI Engines. The series
includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
than 1,900 DSP engines optimized for high-precision floating point with
low latency.

The patch is adding necessary infrastructure in place without enabling
platform which is done in separate patch.

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

# f66d0b53 17-Mar-2022 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Do not place u-boot to reserved memory location

Versal can also have reserved space in DT which u-boot has to avoid to
placing self to that location. The same change was done in ZynqMP by commit
ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory location")
and also for microblaze by commit d7b5cc89d329 ("microblaze: Do not place
u-boot to reserved memory location").

The patch was tested by adding reserved-memory node to DT and check via
bdinfo back.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/15426fa6d64835dd23c5c8c12bbfc97306fb6098.1647527129.git.michal.simek@xilinx.com

# bf97c460 23-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

versal: Return ENVL_NOWHERE instead of ENVL_UNKNOWN

The system fails to boot without any environment location, so return
ENVL_NOWHERE when there's nowhere to store the environment instead
of ENVL_UNKNOWN.

The same change was also done by commit 50918d0df5cb ("xilinx: Return
ENVL_NOWHERE instead of ENVL_UNKNOWN") for zynq and zynqmp.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/e4ed36408f10159677ed8060bfd5289f3e0691fa.1637752614.git.michal.simek@xilinx.com

# 5f4e1ff7 17-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Fix sdhci node name as per DT

Fix the sdhci node name in versal board file as per the name in
device tree and also check for sdhci node as part of backward
compatibility.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/9110ecdabcabcef63fffd4719095acf4326a26e4.1637236638.git.michal.simek@xilinx.com

# 82cb49dc 30-Mar-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Add usb dfu/thor distro boot support

Change "dfu_usb" to "usb_dfu" for better representation and change
required macros. Add 60s timeout of dfu-utils to start transaction.
Add support for usb thor to distro boot. Remove DFU_ALT_INFO_RAM
as we use bootcmd_usb_dfu instead of dfu_ram.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 4fb83c9c 23-Feb-2021 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

xilinx: versal: Add support for saving env based on bootmode

Enable saving variables to MMC(FAT) and SPI based on primary
bootmode. If bootmode is JTAG, dont save env anywhere(NOWHERE).

Enable ENV_FAT_DEVICE_AND_PART="0:auto" for Versal platforms as well.

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

# 35b65dd8 15-Dec-2020 Harald Seiler <hws@denx.de>

reset: Remove addr parameter from reset_cpu()

Historically, the reset_cpu() function had an `addr` parameter which was
meant to pass in an address of the reset vector location, where the CPU
should reset to. This feature is no longer used anywhere in U-Boot as
all reset_cpu() implementations now ignore the passed value. Generic
code has been added which always calls reset_cpu() with `0` which means
this feature can no longer be used easily anyway.

Over time, many implementations seem to have "misunderstood" the
existence of this parameter as a way to customize/parameterize the reset
(e.g. COLD vs WARM resets). As this is not properly supported, the
code will almost always not do what it is intended to (because all
call-sites just call reset_cpu() with 0).

To avoid confusion and to clean up the codebase from unused left-overs
of the past, remove the `addr` parameter entirely. Code which intends
to support different kinds of resets should be rewritten as a sysreset
driver instead.

This transformation was done with the following coccinelle patch:

@@
expression argvalue;
@@
- reset_cpu(argvalue)
+ reset_cpu()

@@
identifier argname;
type argtype;
@@
- reset_cpu(argtype argname)
+ reset_cpu(void)
{ ... }

Signed-off-by: Harald Seiler <hws@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

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

common: Drop asm/global_data.h from common header

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

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

# 8b85dfc6 16-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Avoid accessing seq directly

At present various drivers etc. access the device's 'seq' member directly.
This makes it harder to change the meaning of that member. Change access
to go through a function instead.

The drivers/i2c/lpc32xx_i2c.c file is left unchanged for now.

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

# d61728c8 03-Aug-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: board: Read the whole eeprom not just offset

Starts to use new way how eeproms should be referenced.
Reference is done via nvmem alias nodes. When this new way is specified
code itself read the eeprom and decode xilinx legacy format and fill struct
xilinx_board_description. Then based on information present there board_*
variables are setup.
If variables are saved and content can't be changed information is just
shown on console.

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

# 62b96262 27-Jul-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Add support for ENV_VARS_UBOOT_RUNTIME_CONFIG

Start to use ENV_VARS_UBOOT_RUNTIME_CONFIG to enable/disable updating
variables with run time information.

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

# 22b6bb6c 09-Jul-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: versal: Use lowest memory for U-Boot

Find and use the lowest memory for Versal to make sure that we keep u-boot
as low as possible and never use memory above u-boot's maximum VA mapping.

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

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

common: Drop log.h from common header

Move this header out of the common header.

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

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

command: Remove the cmd_tbl_t typedef

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

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

This requires quite a few header-file additions.

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

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

common: Drop net.h from common header

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

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

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

# 51f6c52e 08-Apr-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Move bootmode detection to separate function

Create special function for reading bootmode on Versal and ZynqMP.
Zynq is using specific function (without mask) already.
Future patches will be calling this function from different location too.

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

# a29511ee 08-Apr-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Move initrd_high setup to common location

Moving to common location initrd_high is also setup for Zynq which hasn't
done in run time code.

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

# 80fdef12 30-Mar-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Introduce board_late_init_xilinx()

This function should keep common shared late configurations for Xilinx
SoCs.

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

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

common: Move reset_cpu() to the CPU header

Move this function out of common.h and into a relevant header file.

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

# 53c69dec 18-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

board: xilinx: Add support for user configurable boot script offset

Currently "script_offset_f" env variable is hardcoded, this variable
specifies from which offset of the flash boot.scr should be read/write.
As flashes are of different sizes having a fixed offset makes it
difficult to load other images into the flash which may overwrite the
boot script or cannot utilize the full memory. This current fix
creates a new config "CONFIG_BOOT_SCRIPT_OFFSET" which holds the
offset address, overwrites the "script_offset_f" variable.
Also removed existing variable with default values, as the default
values are held by CONFIG_BOOT_SCRIPT_OFFSET

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c5b7bb1 16-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Fix emmc boot mode boot_target issue

Emmc boot devcie is mounted to sdhci@f1050000 controller on versal, while
in emmc boot mode, boot tragets are set to mmc0. So removed mmc0 and using
the dev seq number from the sdhci@f1050000 controller.
Dev seq number is setup based on DT aliases that's why needs to be setup at
run time.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

common: Move some board functions out of common.h

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

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

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

common: Move get_ticks() function out of common.h

This function belongs in time.h so move it over and add a comment.

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

# f0c16cd6 11-Jul-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Add new dfu usb distro boot command

This patch adds new dfu usb distro boot command to look for bootscript
from dfu-util and runs it.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>

# 3d865acb 25-Jun-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Add new jtag distro boot command

This patch adds new jtag distro boot command to look for bootscript file
in DDR and execute it first incase of jtag bootmode.
This patch also updates scriptaddr to 512MB as there is high of script
corruption incase of bigger kernel image.

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

# aef149e9 29-Apr-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Enable memory mapping via DT

Code reads DT and setup MMU table based on memory node. This will ensure
that only DT needs to be changed.

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

# 085201c2 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Set initrd_high to as high as possible

This patch is setting up the initrd_high to as high as possible by leaving
max stack size for u-boot so that bigger rootfs can also be loaded by
u-boot for booting kernel.

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

# 26e054c9 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: fpga: Add PL bit stream load support

This patch adds PL bitstream load support for Versal platform. The PL
bitstream is loaded by making an SMC to ATF which in turn communicates
with platform firmware which configures and loads PL bitstream on to PL.

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

# bfd092f9 31-Jan-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Define board_late_init for versal

Define board_late_init which performs bootmode detection
and prepares corresponding distro boot commaand sequence.

Also disable it for mini platforms because simply there is no need to have
it enabled.
But also disable it for virtual platform because Qemu is not modelling this
register space that's why travis testing would fail. This configuration
should be reverted when mainline Qemu is updated.

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

# 47a766f9 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig

Move hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up
for different platforms.

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

# fb771793 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Remove one level of indentation in board_early_init_r()

Simplify code indentation.

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

# ec48b6c9 22-Aug-2018 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
Engines with leading-edge memory and interfacing technologies to deliver
powerful heterogeneous acceleration for any application. The Versal AI
Core series has five devices, offering 128 to 400 AI Engines. The series
includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
than 1,900 DSP engines optimized for high-precision floating point with
low latency.

The patch is adding necessary infrastructure in place without enabling
platform which is done in separate patch.

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

# bf97c460 23-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

versal: Return ENVL_NOWHERE instead of ENVL_UNKNOWN

The system fails to boot without any environment location, so return
ENVL_NOWHERE when there's nowhere to store the environment instead
of ENVL_UNKNOWN.

The same change was also done by commit 50918d0df5cb ("xilinx: Return
ENVL_NOWHERE instead of ENVL_UNKNOWN") for zynq and zynqmp.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/e4ed36408f10159677ed8060bfd5289f3e0691fa.1637752614.git.michal.simek@xilinx.com

# 5f4e1ff7 17-Nov-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Fix sdhci node name as per DT

Fix the sdhci node name in versal board file as per the name in
device tree and also check for sdhci node as part of backward
compatibility.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/9110ecdabcabcef63fffd4719095acf4326a26e4.1637236638.git.michal.simek@xilinx.com

# 82cb49dc 30-Mar-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Add usb dfu/thor distro boot support

Change "dfu_usb" to "usb_dfu" for better representation and change
required macros. Add 60s timeout of dfu-utils to start transaction.
Add support for usb thor to distro boot. Remove DFU_ALT_INFO_RAM
as we use bootcmd_usb_dfu instead of dfu_ram.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 4fb83c9c 23-Feb-2021 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

xilinx: versal: Add support for saving env based on bootmode

Enable saving variables to MMC(FAT) and SPI based on primary
bootmode. If bootmode is JTAG, dont save env anywhere(NOWHERE).

Enable ENV_FAT_DEVICE_AND_PART="0:auto" for Versal platforms as well.

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

# 35b65dd8 15-Dec-2020 Harald Seiler <hws@denx.de>

reset: Remove addr parameter from reset_cpu()

Historically, the reset_cpu() function had an `addr` parameter which was
meant to pass in an address of the reset vector location, where the CPU
should reset to. This feature is no longer used anywhere in U-Boot as
all reset_cpu() implementations now ignore the passed value. Generic
code has been added which always calls reset_cpu() with `0` which means
this feature can no longer be used easily anyway.

Over time, many implementations seem to have "misunderstood" the
existence of this parameter as a way to customize/parameterize the reset
(e.g. COLD vs WARM resets). As this is not properly supported, the
code will almost always not do what it is intended to (because all
call-sites just call reset_cpu() with 0).

To avoid confusion and to clean up the codebase from unused left-overs
of the past, remove the `addr` parameter entirely. Code which intends
to support different kinds of resets should be rewritten as a sysreset
driver instead.

This transformation was done with the following coccinelle patch:

@@
expression argvalue;
@@
- reset_cpu(argvalue)
+ reset_cpu()

@@
identifier argname;
type argtype;
@@
- reset_cpu(argtype argname)
+ reset_cpu(void)
{ ... }

Signed-off-by: Harald Seiler <hws@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

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

common: Drop asm/global_data.h from common header

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

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

# 8b85dfc6 16-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Avoid accessing seq directly

At present various drivers etc. access the device's 'seq' member directly.
This makes it harder to change the meaning of that member. Change access
to go through a function instead.

The drivers/i2c/lpc32xx_i2c.c file is left unchanged for now.

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

# d61728c8 03-Aug-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: board: Read the whole eeprom not just offset

Starts to use new way how eeproms should be referenced.
Reference is done via nvmem alias nodes. When this new way is specified
code itself read the eeprom and decode xilinx legacy format and fill struct
xilinx_board_description. Then based on information present there board_*
variables are setup.
If variables are saved and content can't be changed information is just
shown on console.

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

# 62b96262 27-Jul-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Add support for ENV_VARS_UBOOT_RUNTIME_CONFIG

Start to use ENV_VARS_UBOOT_RUNTIME_CONFIG to enable/disable updating
variables with run time information.

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

# 22b6bb6c 09-Jul-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: versal: Use lowest memory for U-Boot

Find and use the lowest memory for Versal to make sure that we keep u-boot
as low as possible and never use memory above u-boot's maximum VA mapping.

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

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

common: Drop log.h from common header

Move this header out of the common header.

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

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

command: Remove the cmd_tbl_t typedef

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

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

This requires quite a few header-file additions.

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

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

common: Drop net.h from common header

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

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

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

# 51f6c52e 08-Apr-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Move bootmode detection to separate function

Create special function for reading bootmode on Versal and ZynqMP.
Zynq is using specific function (without mask) already.
Future patches will be calling this function from different location too.

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

# a29511ee 08-Apr-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Move initrd_high setup to common location

Moving to common location initrd_high is also setup for Zynq which hasn't
done in run time code.

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

# 80fdef12 30-Mar-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Introduce board_late_init_xilinx()

This function should keep common shared late configurations for Xilinx
SoCs.

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

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

common: Move reset_cpu() to the CPU header

Move this function out of common.h and into a relevant header file.

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

# 53c69dec 18-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

board: xilinx: Add support for user configurable boot script offset

Currently "script_offset_f" env variable is hardcoded, this variable
specifies from which offset of the flash boot.scr should be read/write.
As flashes are of different sizes having a fixed offset makes it
difficult to load other images into the flash which may overwrite the
boot script or cannot utilize the full memory. This current fix
creates a new config "CONFIG_BOOT_SCRIPT_OFFSET" which holds the
offset address, overwrites the "script_offset_f" variable.
Also removed existing variable with default values, as the default
values are held by CONFIG_BOOT_SCRIPT_OFFSET

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c5b7bb1 16-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Fix emmc boot mode boot_target issue

Emmc boot devcie is mounted to sdhci@f1050000 controller on versal, while
in emmc boot mode, boot tragets are set to mmc0. So removed mmc0 and using
the dev seq number from the sdhci@f1050000 controller.
Dev seq number is setup based on DT aliases that's why needs to be setup at
run time.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

common: Move some board functions out of common.h

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

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

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

common: Move get_ticks() function out of common.h

This function belongs in time.h so move it over and add a comment.

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

# f0c16cd6 11-Jul-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Add new dfu usb distro boot command

This patch adds new dfu usb distro boot command to look for bootscript
from dfu-util and runs it.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>

# 3d865acb 25-Jun-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Add new jtag distro boot command

This patch adds new jtag distro boot command to look for bootscript file
in DDR and execute it first incase of jtag bootmode.
This patch also updates scriptaddr to 512MB as there is high of script
corruption incase of bigger kernel image.

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

# aef149e9 29-Apr-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Enable memory mapping via DT

Code reads DT and setup MMU table based on memory node. This will ensure
that only DT needs to be changed.

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

# 085201c2 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Set initrd_high to as high as possible

This patch is setting up the initrd_high to as high as possible by leaving
max stack size for u-boot so that bigger rootfs can also be loaded by
u-boot for booting kernel.

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

# 26e054c9 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: fpga: Add PL bit stream load support

This patch adds PL bitstream load support for Versal platform. The PL
bitstream is loaded by making an SMC to ATF which in turn communicates
with platform firmware which configures and loads PL bitstream on to PL.

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

# bfd092f9 31-Jan-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Define board_late_init for versal

Define board_late_init which performs bootmode detection
and prepares corresponding distro boot commaand sequence.

Also disable it for mini platforms because simply there is no need to have
it enabled.
But also disable it for virtual platform because Qemu is not modelling this
register space that's why travis testing would fail. This configuration
should be reverted when mainline Qemu is updated.

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

# 47a766f9 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig

Move hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up
for different platforms.

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

# fb771793 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Remove one level of indentation in board_early_init_r()

Simplify code indentation.

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

# ec48b6c9 22-Aug-2018 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
Engines with leading-edge memory and interfacing technologies to deliver
powerful heterogeneous acceleration for any application. The Versal AI
Core series has five devices, offering 128 to 400 AI Engines. The series
includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
than 1,900 DSP engines optimized for high-precision floating point with
low latency.

The patch is adding necessary infrastructure in place without enabling
platform which is done in separate patch.

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

# 82cb49dc 30-Mar-2021 T Karthik Reddy <t.karthik.reddy@xilinx.com>

xilinx: versal: Add usb dfu/thor distro boot support

Change "dfu_usb" to "usb_dfu" for better representation and change
required macros. Add 60s timeout of dfu-utils to start transaction.
Add support for usb thor to distro boot. Remove DFU_ALT_INFO_RAM
as we use bootcmd_usb_dfu instead of dfu_ram.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 4fb83c9c 23-Feb-2021 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

xilinx: versal: Add support for saving env based on bootmode

Enable saving variables to MMC(FAT) and SPI based on primary
bootmode. If bootmode is JTAG, dont save env anywhere(NOWHERE).

Enable ENV_FAT_DEVICE_AND_PART="0:auto" for Versal platforms as well.

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

# 35b65dd8 15-Dec-2020 Harald Seiler <hws@denx.de>

reset: Remove addr parameter from reset_cpu()

Historically, the reset_cpu() function had an `addr` parameter which was
meant to pass in an address of the reset vector location, where the CPU
should reset to. This feature is no longer used anywhere in U-Boot as
all reset_cpu() implementations now ignore the passed value. Generic
code has been added which always calls reset_cpu() with `0` which means
this feature can no longer be used easily anyway.

Over time, many implementations seem to have "misunderstood" the
existence of this parameter as a way to customize/parameterize the reset
(e.g. COLD vs WARM resets). As this is not properly supported, the
code will almost always not do what it is intended to (because all
call-sites just call reset_cpu() with 0).

To avoid confusion and to clean up the codebase from unused left-overs
of the past, remove the `addr` parameter entirely. Code which intends
to support different kinds of resets should be rewritten as a sysreset
driver instead.

This transformation was done with the following coccinelle patch:

@@
expression argvalue;
@@
- reset_cpu(argvalue)
+ reset_cpu()

@@
identifier argname;
type argtype;
@@
- reset_cpu(argtype argname)
+ reset_cpu(void)
{ ... }

Signed-off-by: Harald Seiler <hws@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

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

common: Drop asm/global_data.h from common header

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

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

# 8b85dfc6 16-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Avoid accessing seq directly

At present various drivers etc. access the device's 'seq' member directly.
This makes it harder to change the meaning of that member. Change access
to go through a function instead.

The drivers/i2c/lpc32xx_i2c.c file is left unchanged for now.

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

# d61728c8 03-Aug-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: board: Read the whole eeprom not just offset

Starts to use new way how eeproms should be referenced.
Reference is done via nvmem alias nodes. When this new way is specified
code itself read the eeprom and decode xilinx legacy format and fill struct
xilinx_board_description. Then based on information present there board_*
variables are setup.
If variables are saved and content can't be changed information is just
shown on console.

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

# 62b96262 27-Jul-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Add support for ENV_VARS_UBOOT_RUNTIME_CONFIG

Start to use ENV_VARS_UBOOT_RUNTIME_CONFIG to enable/disable updating
variables with run time information.

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

# 22b6bb6c 09-Jul-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: versal: Use lowest memory for U-Boot

Find and use the lowest memory for Versal to make sure that we keep u-boot
as low as possible and never use memory above u-boot's maximum VA mapping.

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

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

common: Drop log.h from common header

Move this header out of the common header.

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

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

command: Remove the cmd_tbl_t typedef

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

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

This requires quite a few header-file additions.

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

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

common: Drop net.h from common header

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

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

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

# 51f6c52e 08-Apr-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Move bootmode detection to separate function

Create special function for reading bootmode on Versal and ZynqMP.
Zynq is using specific function (without mask) already.
Future patches will be calling this function from different location too.

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

# a29511ee 08-Apr-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Move initrd_high setup to common location

Moving to common location initrd_high is also setup for Zynq which hasn't
done in run time code.

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

# 80fdef12 30-Mar-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Introduce board_late_init_xilinx()

This function should keep common shared late configurations for Xilinx
SoCs.

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

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

common: Move reset_cpu() to the CPU header

Move this function out of common.h and into a relevant header file.

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

# 53c69dec 18-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

board: xilinx: Add support for user configurable boot script offset

Currently "script_offset_f" env variable is hardcoded, this variable
specifies from which offset of the flash boot.scr should be read/write.
As flashes are of different sizes having a fixed offset makes it
difficult to load other images into the flash which may overwrite the
boot script or cannot utilize the full memory. This current fix
creates a new config "CONFIG_BOOT_SCRIPT_OFFSET" which holds the
offset address, overwrites the "script_offset_f" variable.
Also removed existing variable with default values, as the default
values are held by CONFIG_BOOT_SCRIPT_OFFSET

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c5b7bb1 16-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Fix emmc boot mode boot_target issue

Emmc boot devcie is mounted to sdhci@f1050000 controller on versal, while
in emmc boot mode, boot tragets are set to mmc0. So removed mmc0 and using
the dev seq number from the sdhci@f1050000 controller.
Dev seq number is setup based on DT aliases that's why needs to be setup at
run time.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

common: Move some board functions out of common.h

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

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

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

common: Move get_ticks() function out of common.h

This function belongs in time.h so move it over and add a comment.

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

# f0c16cd6 11-Jul-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Add new dfu usb distro boot command

This patch adds new dfu usb distro boot command to look for bootscript
from dfu-util and runs it.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>

# 3d865acb 25-Jun-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Add new jtag distro boot command

This patch adds new jtag distro boot command to look for bootscript file
in DDR and execute it first incase of jtag bootmode.
This patch also updates scriptaddr to 512MB as there is high of script
corruption incase of bigger kernel image.

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

# aef149e9 29-Apr-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Enable memory mapping via DT

Code reads DT and setup MMU table based on memory node. This will ensure
that only DT needs to be changed.

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

# 085201c2 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Set initrd_high to as high as possible

This patch is setting up the initrd_high to as high as possible by leaving
max stack size for u-boot so that bigger rootfs can also be loaded by
u-boot for booting kernel.

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

# 26e054c9 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: fpga: Add PL bit stream load support

This patch adds PL bitstream load support for Versal platform. The PL
bitstream is loaded by making an SMC to ATF which in turn communicates
with platform firmware which configures and loads PL bitstream on to PL.

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

# bfd092f9 31-Jan-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Define board_late_init for versal

Define board_late_init which performs bootmode detection
and prepares corresponding distro boot commaand sequence.

Also disable it for mini platforms because simply there is no need to have
it enabled.
But also disable it for virtual platform because Qemu is not modelling this
register space that's why travis testing would fail. This configuration
should be reverted when mainline Qemu is updated.

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

# 47a766f9 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig

Move hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up
for different platforms.

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

# fb771793 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Remove one level of indentation in board_early_init_r()

Simplify code indentation.

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

# ec48b6c9 22-Aug-2018 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
Engines with leading-edge memory and interfacing technologies to deliver
powerful heterogeneous acceleration for any application. The Versal AI
Core series has five devices, offering 128 to 400 AI Engines. The series
includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
than 1,900 DSP engines optimized for high-precision floating point with
low latency.

The patch is adding necessary infrastructure in place without enabling
platform which is done in separate patch.

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

# 35b65dd8 15-Dec-2020 Harald Seiler <hws@denx.de>

reset: Remove addr parameter from reset_cpu()

Historically, the reset_cpu() function had an `addr` parameter which was
meant to pass in an address of the reset vector location, where the CPU
should reset to. This feature is no longer used anywhere in U-Boot as
all reset_cpu() implementations now ignore the passed value. Generic
code has been added which always calls reset_cpu() with `0` which means
this feature can no longer be used easily anyway.

Over time, many implementations seem to have "misunderstood" the
existence of this parameter as a way to customize/parameterize the reset
(e.g. COLD vs WARM resets). As this is not properly supported, the
code will almost always not do what it is intended to (because all
call-sites just call reset_cpu() with 0).

To avoid confusion and to clean up the codebase from unused left-overs
of the past, remove the `addr` parameter entirely. Code which intends
to support different kinds of resets should be rewritten as a sysreset
driver instead.

This transformation was done with the following coccinelle patch:

@@
expression argvalue;
@@
- reset_cpu(argvalue)
+ reset_cpu()

@@
identifier argname;
type argtype;
@@
- reset_cpu(argtype argname)
+ reset_cpu(void)
{ ... }

Signed-off-by: Harald Seiler <hws@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

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

common: Drop asm/global_data.h from common header

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

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

# 8b85dfc6 16-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Avoid accessing seq directly

At present various drivers etc. access the device's 'seq' member directly.
This makes it harder to change the meaning of that member. Change access
to go through a function instead.

The drivers/i2c/lpc32xx_i2c.c file is left unchanged for now.

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

# d61728c8 03-Aug-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: board: Read the whole eeprom not just offset

Starts to use new way how eeproms should be referenced.
Reference is done via nvmem alias nodes. When this new way is specified
code itself read the eeprom and decode xilinx legacy format and fill struct
xilinx_board_description. Then based on information present there board_*
variables are setup.
If variables are saved and content can't be changed information is just
shown on console.

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

# 62b96262 27-Jul-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Add support for ENV_VARS_UBOOT_RUNTIME_CONFIG

Start to use ENV_VARS_UBOOT_RUNTIME_CONFIG to enable/disable updating
variables with run time information.

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

# 22b6bb6c 09-Jul-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: versal: Use lowest memory for U-Boot

Find and use the lowest memory for Versal to make sure that we keep u-boot
as low as possible and never use memory above u-boot's maximum VA mapping.

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

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

common: Drop log.h from common header

Move this header out of the common header.

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

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

command: Remove the cmd_tbl_t typedef

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

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

This requires quite a few header-file additions.

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

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

common: Drop net.h from common header

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

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

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

# 51f6c52e 08-Apr-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Move bootmode detection to separate function

Create special function for reading bootmode on Versal and ZynqMP.
Zynq is using specific function (without mask) already.
Future patches will be calling this function from different location too.

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

# a29511ee 08-Apr-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Move initrd_high setup to common location

Moving to common location initrd_high is also setup for Zynq which hasn't
done in run time code.

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

# 80fdef12 30-Mar-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Introduce board_late_init_xilinx()

This function should keep common shared late configurations for Xilinx
SoCs.

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

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

common: Move reset_cpu() to the CPU header

Move this function out of common.h and into a relevant header file.

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

# 53c69dec 18-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

board: xilinx: Add support for user configurable boot script offset

Currently "script_offset_f" env variable is hardcoded, this variable
specifies from which offset of the flash boot.scr should be read/write.
As flashes are of different sizes having a fixed offset makes it
difficult to load other images into the flash which may overwrite the
boot script or cannot utilize the full memory. This current fix
creates a new config "CONFIG_BOOT_SCRIPT_OFFSET" which holds the
offset address, overwrites the "script_offset_f" variable.
Also removed existing variable with default values, as the default
values are held by CONFIG_BOOT_SCRIPT_OFFSET

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c5b7bb1 16-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Fix emmc boot mode boot_target issue

Emmc boot devcie is mounted to sdhci@f1050000 controller on versal, while
in emmc boot mode, boot tragets are set to mmc0. So removed mmc0 and using
the dev seq number from the sdhci@f1050000 controller.
Dev seq number is setup based on DT aliases that's why needs to be setup at
run time.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

common: Move some board functions out of common.h

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

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

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

common: Move get_ticks() function out of common.h

This function belongs in time.h so move it over and add a comment.

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

# f0c16cd6 11-Jul-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Add new dfu usb distro boot command

This patch adds new dfu usb distro boot command to look for bootscript
from dfu-util and runs it.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>

# 3d865acb 25-Jun-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Add new jtag distro boot command

This patch adds new jtag distro boot command to look for bootscript file
in DDR and execute it first incase of jtag bootmode.
This patch also updates scriptaddr to 512MB as there is high of script
corruption incase of bigger kernel image.

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

# aef149e9 29-Apr-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Enable memory mapping via DT

Code reads DT and setup MMU table based on memory node. This will ensure
that only DT needs to be changed.

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

# 085201c2 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Set initrd_high to as high as possible

This patch is setting up the initrd_high to as high as possible by leaving
max stack size for u-boot so that bigger rootfs can also be loaded by
u-boot for booting kernel.

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

# 26e054c9 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: fpga: Add PL bit stream load support

This patch adds PL bitstream load support for Versal platform. The PL
bitstream is loaded by making an SMC to ATF which in turn communicates
with platform firmware which configures and loads PL bitstream on to PL.

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

# bfd092f9 31-Jan-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Define board_late_init for versal

Define board_late_init which performs bootmode detection
and prepares corresponding distro boot commaand sequence.

Also disable it for mini platforms because simply there is no need to have
it enabled.
But also disable it for virtual platform because Qemu is not modelling this
register space that's why travis testing would fail. This configuration
should be reverted when mainline Qemu is updated.

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

# 47a766f9 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig

Move hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up
for different platforms.

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

# fb771793 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Remove one level of indentation in board_early_init_r()

Simplify code indentation.

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

# ec48b6c9 22-Aug-2018 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
Engines with leading-edge memory and interfacing technologies to deliver
powerful heterogeneous acceleration for any application. The Versal AI
Core series has five devices, offering 128 to 400 AI Engines. The series
includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
than 1,900 DSP engines optimized for high-precision floating point with
low latency.

The patch is adding necessary infrastructure in place without enabling
platform which is done in separate patch.

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

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

common: Drop asm/global_data.h from common header

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

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

# 8b85dfc6 16-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Avoid accessing seq directly

At present various drivers etc. access the device's 'seq' member directly.
This makes it harder to change the meaning of that member. Change access
to go through a function instead.

The drivers/i2c/lpc32xx_i2c.c file is left unchanged for now.

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

# d61728c8 03-Aug-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: board: Read the whole eeprom not just offset

Starts to use new way how eeproms should be referenced.
Reference is done via nvmem alias nodes. When this new way is specified
code itself read the eeprom and decode xilinx legacy format and fill struct
xilinx_board_description. Then based on information present there board_*
variables are setup.
If variables are saved and content can't be changed information is just
shown on console.

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

# 62b96262 27-Jul-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Add support for ENV_VARS_UBOOT_RUNTIME_CONFIG

Start to use ENV_VARS_UBOOT_RUNTIME_CONFIG to enable/disable updating
variables with run time information.

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

# 22b6bb6c 09-Jul-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: versal: Use lowest memory for U-Boot

Find and use the lowest memory for Versal to make sure that we keep u-boot
as low as possible and never use memory above u-boot's maximum VA mapping.

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

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

common: Drop log.h from common header

Move this header out of the common header.

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

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

command: Remove the cmd_tbl_t typedef

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

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

This requires quite a few header-file additions.

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

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

common: Drop net.h from common header

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

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

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

# 51f6c52e 08-Apr-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Move bootmode detection to separate function

Create special function for reading bootmode on Versal and ZynqMP.
Zynq is using specific function (without mask) already.
Future patches will be calling this function from different location too.

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

# a29511ee 08-Apr-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Move initrd_high setup to common location

Moving to common location initrd_high is also setup for Zynq which hasn't
done in run time code.

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

# 80fdef12 30-Mar-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Introduce board_late_init_xilinx()

This function should keep common shared late configurations for Xilinx
SoCs.

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

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

common: Move reset_cpu() to the CPU header

Move this function out of common.h and into a relevant header file.

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

# 53c69dec 18-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

board: xilinx: Add support for user configurable boot script offset

Currently "script_offset_f" env variable is hardcoded, this variable
specifies from which offset of the flash boot.scr should be read/write.
As flashes are of different sizes having a fixed offset makes it
difficult to load other images into the flash which may overwrite the
boot script or cannot utilize the full memory. This current fix
creates a new config "CONFIG_BOOT_SCRIPT_OFFSET" which holds the
offset address, overwrites the "script_offset_f" variable.
Also removed existing variable with default values, as the default
values are held by CONFIG_BOOT_SCRIPT_OFFSET

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c5b7bb1 16-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Fix emmc boot mode boot_target issue

Emmc boot devcie is mounted to sdhci@f1050000 controller on versal, while
in emmc boot mode, boot tragets are set to mmc0. So removed mmc0 and using
the dev seq number from the sdhci@f1050000 controller.
Dev seq number is setup based on DT aliases that's why needs to be setup at
run time.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

common: Move some board functions out of common.h

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

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

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

common: Move get_ticks() function out of common.h

This function belongs in time.h so move it over and add a comment.

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

# f0c16cd6 11-Jul-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Add new dfu usb distro boot command

This patch adds new dfu usb distro boot command to look for bootscript
from dfu-util and runs it.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>

# 3d865acb 25-Jun-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Add new jtag distro boot command

This patch adds new jtag distro boot command to look for bootscript file
in DDR and execute it first incase of jtag bootmode.
This patch also updates scriptaddr to 512MB as there is high of script
corruption incase of bigger kernel image.

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

# aef149e9 29-Apr-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Enable memory mapping via DT

Code reads DT and setup MMU table based on memory node. This will ensure
that only DT needs to be changed.

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

# 085201c2 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Set initrd_high to as high as possible

This patch is setting up the initrd_high to as high as possible by leaving
max stack size for u-boot so that bigger rootfs can also be loaded by
u-boot for booting kernel.

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

# 26e054c9 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: fpga: Add PL bit stream load support

This patch adds PL bitstream load support for Versal platform. The PL
bitstream is loaded by making an SMC to ATF which in turn communicates
with platform firmware which configures and loads PL bitstream on to PL.

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

# bfd092f9 31-Jan-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Define board_late_init for versal

Define board_late_init which performs bootmode detection
and prepares corresponding distro boot commaand sequence.

Also disable it for mini platforms because simply there is no need to have
it enabled.
But also disable it for virtual platform because Qemu is not modelling this
register space that's why travis testing would fail. This configuration
should be reverted when mainline Qemu is updated.

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

# 47a766f9 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig

Move hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up
for different platforms.

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

# fb771793 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Remove one level of indentation in board_early_init_r()

Simplify code indentation.

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

# ec48b6c9 22-Aug-2018 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
Engines with leading-edge memory and interfacing technologies to deliver
powerful heterogeneous acceleration for any application. The Versal AI
Core series has five devices, offering 128 to 400 AI Engines. The series
includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
than 1,900 DSP engines optimized for high-precision floating point with
low latency.

The patch is adding necessary infrastructure in place without enabling
platform which is done in separate patch.

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

# 8b85dfc6 16-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Avoid accessing seq directly

At present various drivers etc. access the device's 'seq' member directly.
This makes it harder to change the meaning of that member. Change access
to go through a function instead.

The drivers/i2c/lpc32xx_i2c.c file is left unchanged for now.

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

# d61728c8 03-Aug-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: board: Read the whole eeprom not just offset

Starts to use new way how eeproms should be referenced.
Reference is done via nvmem alias nodes. When this new way is specified
code itself read the eeprom and decode xilinx legacy format and fill struct
xilinx_board_description. Then based on information present there board_*
variables are setup.
If variables are saved and content can't be changed information is just
shown on console.

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

# 62b96262 27-Jul-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Add support for ENV_VARS_UBOOT_RUNTIME_CONFIG

Start to use ENV_VARS_UBOOT_RUNTIME_CONFIG to enable/disable updating
variables with run time information.

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

# 22b6bb6c 09-Jul-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: versal: Use lowest memory for U-Boot

Find and use the lowest memory for Versal to make sure that we keep u-boot
as low as possible and never use memory above u-boot's maximum VA mapping.

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

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

common: Drop log.h from common header

Move this header out of the common header.

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

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

command: Remove the cmd_tbl_t typedef

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

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

This requires quite a few header-file additions.

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

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

common: Drop net.h from common header

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

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

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

# 51f6c52e 08-Apr-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Move bootmode detection to separate function

Create special function for reading bootmode on Versal and ZynqMP.
Zynq is using specific function (without mask) already.
Future patches will be calling this function from different location too.

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

# a29511ee 08-Apr-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Move initrd_high setup to common location

Moving to common location initrd_high is also setup for Zynq which hasn't
done in run time code.

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

# 80fdef12 30-Mar-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Introduce board_late_init_xilinx()

This function should keep common shared late configurations for Xilinx
SoCs.

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

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

common: Move reset_cpu() to the CPU header

Move this function out of common.h and into a relevant header file.

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

# 53c69dec 18-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

board: xilinx: Add support for user configurable boot script offset

Currently "script_offset_f" env variable is hardcoded, this variable
specifies from which offset of the flash boot.scr should be read/write.
As flashes are of different sizes having a fixed offset makes it
difficult to load other images into the flash which may overwrite the
boot script or cannot utilize the full memory. This current fix
creates a new config "CONFIG_BOOT_SCRIPT_OFFSET" which holds the
offset address, overwrites the "script_offset_f" variable.
Also removed existing variable with default values, as the default
values are held by CONFIG_BOOT_SCRIPT_OFFSET

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c5b7bb1 16-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Fix emmc boot mode boot_target issue

Emmc boot devcie is mounted to sdhci@f1050000 controller on versal, while
in emmc boot mode, boot tragets are set to mmc0. So removed mmc0 and using
the dev seq number from the sdhci@f1050000 controller.
Dev seq number is setup based on DT aliases that's why needs to be setup at
run time.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

common: Move some board functions out of common.h

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

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

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

common: Move get_ticks() function out of common.h

This function belongs in time.h so move it over and add a comment.

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

# f0c16cd6 11-Jul-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Add new dfu usb distro boot command

This patch adds new dfu usb distro boot command to look for bootscript
from dfu-util and runs it.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>

# 3d865acb 25-Jun-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Add new jtag distro boot command

This patch adds new jtag distro boot command to look for bootscript file
in DDR and execute it first incase of jtag bootmode.
This patch also updates scriptaddr to 512MB as there is high of script
corruption incase of bigger kernel image.

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

# aef149e9 29-Apr-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Enable memory mapping via DT

Code reads DT and setup MMU table based on memory node. This will ensure
that only DT needs to be changed.

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

# 085201c2 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Set initrd_high to as high as possible

This patch is setting up the initrd_high to as high as possible by leaving
max stack size for u-boot so that bigger rootfs can also be loaded by
u-boot for booting kernel.

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

# 26e054c9 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: fpga: Add PL bit stream load support

This patch adds PL bitstream load support for Versal platform. The PL
bitstream is loaded by making an SMC to ATF which in turn communicates
with platform firmware which configures and loads PL bitstream on to PL.

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

# bfd092f9 31-Jan-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Define board_late_init for versal

Define board_late_init which performs bootmode detection
and prepares corresponding distro boot commaand sequence.

Also disable it for mini platforms because simply there is no need to have
it enabled.
But also disable it for virtual platform because Qemu is not modelling this
register space that's why travis testing would fail. This configuration
should be reverted when mainline Qemu is updated.

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

# 47a766f9 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig

Move hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up
for different platforms.

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

# fb771793 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Remove one level of indentation in board_early_init_r()

Simplify code indentation.

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

# ec48b6c9 22-Aug-2018 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
Engines with leading-edge memory and interfacing technologies to deliver
powerful heterogeneous acceleration for any application. The Versal AI
Core series has five devices, offering 128 to 400 AI Engines. The series
includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
than 1,900 DSP engines optimized for high-precision floating point with
low latency.

The patch is adding necessary infrastructure in place without enabling
platform which is done in separate patch.

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

# d61728c8 03-Aug-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: board: Read the whole eeprom not just offset

Starts to use new way how eeproms should be referenced.
Reference is done via nvmem alias nodes. When this new way is specified
code itself read the eeprom and decode xilinx legacy format and fill struct
xilinx_board_description. Then based on information present there board_*
variables are setup.
If variables are saved and content can't be changed information is just
shown on console.

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

# 62b96262 27-Jul-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Add support for ENV_VARS_UBOOT_RUNTIME_CONFIG

Start to use ENV_VARS_UBOOT_RUNTIME_CONFIG to enable/disable updating
variables with run time information.

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

# 22b6bb6c 09-Jul-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: versal: Use lowest memory for U-Boot

Find and use the lowest memory for Versal to make sure that we keep u-boot
as low as possible and never use memory above u-boot's maximum VA mapping.

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

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

common: Drop log.h from common header

Move this header out of the common header.

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

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

command: Remove the cmd_tbl_t typedef

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

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

This requires quite a few header-file additions.

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

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

common: Drop net.h from common header

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

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

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

# 51f6c52e 08-Apr-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Move bootmode detection to separate function

Create special function for reading bootmode on Versal and ZynqMP.
Zynq is using specific function (without mask) already.
Future patches will be calling this function from different location too.

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

# a29511ee 08-Apr-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Move initrd_high setup to common location

Moving to common location initrd_high is also setup for Zynq which hasn't
done in run time code.

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

# 80fdef12 30-Mar-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Introduce board_late_init_xilinx()

This function should keep common shared late configurations for Xilinx
SoCs.

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

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

common: Move reset_cpu() to the CPU header

Move this function out of common.h and into a relevant header file.

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

# 53c69dec 18-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

board: xilinx: Add support for user configurable boot script offset

Currently "script_offset_f" env variable is hardcoded, this variable
specifies from which offset of the flash boot.scr should be read/write.
As flashes are of different sizes having a fixed offset makes it
difficult to load other images into the flash which may overwrite the
boot script or cannot utilize the full memory. This current fix
creates a new config "CONFIG_BOOT_SCRIPT_OFFSET" which holds the
offset address, overwrites the "script_offset_f" variable.
Also removed existing variable with default values, as the default
values are held by CONFIG_BOOT_SCRIPT_OFFSET

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c5b7bb1 16-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Fix emmc boot mode boot_target issue

Emmc boot devcie is mounted to sdhci@f1050000 controller on versal, while
in emmc boot mode, boot tragets are set to mmc0. So removed mmc0 and using
the dev seq number from the sdhci@f1050000 controller.
Dev seq number is setup based on DT aliases that's why needs to be setup at
run time.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

common: Move some board functions out of common.h

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

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

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

common: Move get_ticks() function out of common.h

This function belongs in time.h so move it over and add a comment.

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

# f0c16cd6 11-Jul-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Add new dfu usb distro boot command

This patch adds new dfu usb distro boot command to look for bootscript
from dfu-util and runs it.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>

# 3d865acb 25-Jun-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Add new jtag distro boot command

This patch adds new jtag distro boot command to look for bootscript file
in DDR and execute it first incase of jtag bootmode.
This patch also updates scriptaddr to 512MB as there is high of script
corruption incase of bigger kernel image.

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

# aef149e9 29-Apr-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Enable memory mapping via DT

Code reads DT and setup MMU table based on memory node. This will ensure
that only DT needs to be changed.

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

# 085201c2 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Set initrd_high to as high as possible

This patch is setting up the initrd_high to as high as possible by leaving
max stack size for u-boot so that bigger rootfs can also be loaded by
u-boot for booting kernel.

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

# 26e054c9 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: fpga: Add PL bit stream load support

This patch adds PL bitstream load support for Versal platform. The PL
bitstream is loaded by making an SMC to ATF which in turn communicates
with platform firmware which configures and loads PL bitstream on to PL.

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

# bfd092f9 31-Jan-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Define board_late_init for versal

Define board_late_init which performs bootmode detection
and prepares corresponding distro boot commaand sequence.

Also disable it for mini platforms because simply there is no need to have
it enabled.
But also disable it for virtual platform because Qemu is not modelling this
register space that's why travis testing would fail. This configuration
should be reverted when mainline Qemu is updated.

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

# 47a766f9 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig

Move hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up
for different platforms.

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

# fb771793 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Remove one level of indentation in board_early_init_r()

Simplify code indentation.

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

# ec48b6c9 22-Aug-2018 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
Engines with leading-edge memory and interfacing technologies to deliver
powerful heterogeneous acceleration for any application. The Versal AI
Core series has five devices, offering 128 to 400 AI Engines. The series
includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
than 1,900 DSP engines optimized for high-precision floating point with
low latency.

The patch is adding necessary infrastructure in place without enabling
platform which is done in separate patch.

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

# 62b96262 27-Jul-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Add support for ENV_VARS_UBOOT_RUNTIME_CONFIG

Start to use ENV_VARS_UBOOT_RUNTIME_CONFIG to enable/disable updating
variables with run time information.

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

# 22b6bb6c 09-Jul-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: versal: Use lowest memory for U-Boot

Find and use the lowest memory for Versal to make sure that we keep u-boot
as low as possible and never use memory above u-boot's maximum VA mapping.

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

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

common: Drop log.h from common header

Move this header out of the common header.

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

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

command: Remove the cmd_tbl_t typedef

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

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

This requires quite a few header-file additions.

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

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

common: Drop net.h from common header

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

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

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

# 51f6c52e 08-Apr-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Move bootmode detection to separate function

Create special function for reading bootmode on Versal and ZynqMP.
Zynq is using specific function (without mask) already.
Future patches will be calling this function from different location too.

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

# a29511ee 08-Apr-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Move initrd_high setup to common location

Moving to common location initrd_high is also setup for Zynq which hasn't
done in run time code.

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

# 80fdef12 30-Mar-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Introduce board_late_init_xilinx()

This function should keep common shared late configurations for Xilinx
SoCs.

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

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

common: Move reset_cpu() to the CPU header

Move this function out of common.h and into a relevant header file.

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

# 53c69dec 18-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

board: xilinx: Add support for user configurable boot script offset

Currently "script_offset_f" env variable is hardcoded, this variable
specifies from which offset of the flash boot.scr should be read/write.
As flashes are of different sizes having a fixed offset makes it
difficult to load other images into the flash which may overwrite the
boot script or cannot utilize the full memory. This current fix
creates a new config "CONFIG_BOOT_SCRIPT_OFFSET" which holds the
offset address, overwrites the "script_offset_f" variable.
Also removed existing variable with default values, as the default
values are held by CONFIG_BOOT_SCRIPT_OFFSET

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c5b7bb1 16-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Fix emmc boot mode boot_target issue

Emmc boot devcie is mounted to sdhci@f1050000 controller on versal, while
in emmc boot mode, boot tragets are set to mmc0. So removed mmc0 and using
the dev seq number from the sdhci@f1050000 controller.
Dev seq number is setup based on DT aliases that's why needs to be setup at
run time.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

common: Move some board functions out of common.h

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

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

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

common: Move get_ticks() function out of common.h

This function belongs in time.h so move it over and add a comment.

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

# f0c16cd6 11-Jul-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Add new dfu usb distro boot command

This patch adds new dfu usb distro boot command to look for bootscript
from dfu-util and runs it.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>

# 3d865acb 25-Jun-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Add new jtag distro boot command

This patch adds new jtag distro boot command to look for bootscript file
in DDR and execute it first incase of jtag bootmode.
This patch also updates scriptaddr to 512MB as there is high of script
corruption incase of bigger kernel image.

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

# aef149e9 29-Apr-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Enable memory mapping via DT

Code reads DT and setup MMU table based on memory node. This will ensure
that only DT needs to be changed.

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

# 085201c2 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Set initrd_high to as high as possible

This patch is setting up the initrd_high to as high as possible by leaving
max stack size for u-boot so that bigger rootfs can also be loaded by
u-boot for booting kernel.

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

# 26e054c9 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: fpga: Add PL bit stream load support

This patch adds PL bitstream load support for Versal platform. The PL
bitstream is loaded by making an SMC to ATF which in turn communicates
with platform firmware which configures and loads PL bitstream on to PL.

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

# bfd092f9 31-Jan-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Define board_late_init for versal

Define board_late_init which performs bootmode detection
and prepares corresponding distro boot commaand sequence.

Also disable it for mini platforms because simply there is no need to have
it enabled.
But also disable it for virtual platform because Qemu is not modelling this
register space that's why travis testing would fail. This configuration
should be reverted when mainline Qemu is updated.

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

# 47a766f9 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig

Move hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up
for different platforms.

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

# fb771793 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Remove one level of indentation in board_early_init_r()

Simplify code indentation.

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

# ec48b6c9 22-Aug-2018 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
Engines with leading-edge memory and interfacing technologies to deliver
powerful heterogeneous acceleration for any application. The Versal AI
Core series has five devices, offering 128 to 400 AI Engines. The series
includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
than 1,900 DSP engines optimized for high-precision floating point with
low latency.

The patch is adding necessary infrastructure in place without enabling
platform which is done in separate patch.

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

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

common: Drop log.h from common header

Move this header out of the common header.

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

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

command: Remove the cmd_tbl_t typedef

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

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

This requires quite a few header-file additions.

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

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

common: Drop net.h from common header

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

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

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

# 51f6c52e 08-Apr-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Move bootmode detection to separate function

Create special function for reading bootmode on Versal and ZynqMP.
Zynq is using specific function (without mask) already.
Future patches will be calling this function from different location too.

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

# a29511ee 08-Apr-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Move initrd_high setup to common location

Moving to common location initrd_high is also setup for Zynq which hasn't
done in run time code.

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

# 80fdef12 30-Mar-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Introduce board_late_init_xilinx()

This function should keep common shared late configurations for Xilinx
SoCs.

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

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

common: Move reset_cpu() to the CPU header

Move this function out of common.h and into a relevant header file.

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

# 53c69dec 18-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

board: xilinx: Add support for user configurable boot script offset

Currently "script_offset_f" env variable is hardcoded, this variable
specifies from which offset of the flash boot.scr should be read/write.
As flashes are of different sizes having a fixed offset makes it
difficult to load other images into the flash which may overwrite the
boot script or cannot utilize the full memory. This current fix
creates a new config "CONFIG_BOOT_SCRIPT_OFFSET" which holds the
offset address, overwrites the "script_offset_f" variable.
Also removed existing variable with default values, as the default
values are held by CONFIG_BOOT_SCRIPT_OFFSET

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c5b7bb1 16-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Fix emmc boot mode boot_target issue

Emmc boot devcie is mounted to sdhci@f1050000 controller on versal, while
in emmc boot mode, boot tragets are set to mmc0. So removed mmc0 and using
the dev seq number from the sdhci@f1050000 controller.
Dev seq number is setup based on DT aliases that's why needs to be setup at
run time.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

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

common: Move some board functions out of common.h

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

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 1045315d 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move get_ticks() function out of common.h

This function belongs in time.h so move it over and add a comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f0c16cd6 11-Jul-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Add new dfu usb distro boot command

This patch adds new dfu usb distro boot command to look for bootscript
from dfu-util and runs it.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>

# 3d865acb 25-Jun-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Add new jtag distro boot command

This patch adds new jtag distro boot command to look for bootscript file
in DDR and execute it first incase of jtag bootmode.
This patch also updates scriptaddr to 512MB as there is high of script
corruption incase of bigger kernel image.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# aef149e9 29-Apr-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Enable memory mapping via DT

Code reads DT and setup MMU table based on memory node. This will ensure
that only DT needs to be changed.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 085201c2 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Set initrd_high to as high as possible

This patch is setting up the initrd_high to as high as possible by leaving
max stack size for u-boot so that bigger rootfs can also be loaded by
u-boot for booting kernel.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 26e054c9 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: fpga: Add PL bit stream load support

This patch adds PL bitstream load support for Versal platform. The PL
bitstream is loaded by making an SMC to ATF which in turn communicates
with platform firmware which configures and loads PL bitstream on to PL.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# bfd092f9 31-Jan-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Define board_late_init for versal

Define board_late_init which performs bootmode detection
and prepares corresponding distro boot commaand sequence.

Also disable it for mini platforms because simply there is no need to have
it enabled.
But also disable it for virtual platform because Qemu is not modelling this
register space that's why travis testing would fail. This configuration
should be reverted when mainline Qemu is updated.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 47a766f9 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig

Move hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up
for different platforms.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# fb771793 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Remove one level of indentation in board_early_init_r()

Simplify code indentation.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# ec48b6c9 22-Aug-2018 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
Engines with leading-edge memory and interfacing technologies to deliver
powerful heterogeneous acceleration for any application. The Versal AI
Core series has five devices, offering 128 to 400 AI Engines. The series
includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
than 1,900 DSP engines optimized for high-precision floating point with
low latency.

The patch is adding necessary infrastructure in place without enabling
platform which is done in separate patch.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 51f6c52e 08-Apr-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Move bootmode detection to separate function

Create special function for reading bootmode on Versal and ZynqMP.
Zynq is using specific function (without mask) already.
Future patches will be calling this function from different location too.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# a29511ee 08-Apr-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Move initrd_high setup to common location

Moving to common location initrd_high is also setup for Zynq which hasn't
done in run time code.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 80fdef12 30-Mar-2020 Michal Simek <michal.simek@xilinx.com>

xilinx: Introduce board_late_init_xilinx()

This function should keep common shared late configurations for Xilinx
SoCs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 9a3b4ceb 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move reset_cpu() to the CPU header

Move this function out of common.h and into a relevant header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 53c69dec 18-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

board: xilinx: Add support for user configurable boot script offset

Currently "script_offset_f" env variable is hardcoded, this variable
specifies from which offset of the flash boot.scr should be read/write.
As flashes are of different sizes having a fixed offset makes it
difficult to load other images into the flash which may overwrite the
boot script or cannot utilize the full memory. This current fix
creates a new config "CONFIG_BOOT_SCRIPT_OFFSET" which holds the
offset address, overwrites the "script_offset_f" variable.
Also removed existing variable with default values, as the default
values are held by CONFIG_BOOT_SCRIPT_OFFSET

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c5b7bb1 16-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Fix emmc boot mode boot_target issue

Emmc boot devcie is mounted to sdhci@f1050000 controller on versal, while
in emmc boot mode, boot tragets are set to mmc0. So removed mmc0 and using
the dev seq number from the sdhci@f1050000 controller.
Dev seq number is setup based on DT aliases that's why needs to be setup at
run time.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 5255932f 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move some board functions out of common.h

A number of board function belong in init.h with the others. Move them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 1045315d 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move get_ticks() function out of common.h

This function belongs in time.h so move it over and add a comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f0c16cd6 11-Jul-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Add new dfu usb distro boot command

This patch adds new dfu usb distro boot command to look for bootscript
from dfu-util and runs it.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>

# 3d865acb 25-Jun-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Add new jtag distro boot command

This patch adds new jtag distro boot command to look for bootscript file
in DDR and execute it first incase of jtag bootmode.
This patch also updates scriptaddr to 512MB as there is high of script
corruption incase of bigger kernel image.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# aef149e9 29-Apr-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Enable memory mapping via DT

Code reads DT and setup MMU table based on memory node. This will ensure
that only DT needs to be changed.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 085201c2 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Set initrd_high to as high as possible

This patch is setting up the initrd_high to as high as possible by leaving
max stack size for u-boot so that bigger rootfs can also be loaded by
u-boot for booting kernel.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 26e054c9 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: fpga: Add PL bit stream load support

This patch adds PL bitstream load support for Versal platform. The PL
bitstream is loaded by making an SMC to ATF which in turn communicates
with platform firmware which configures and loads PL bitstream on to PL.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# bfd092f9 31-Jan-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Define board_late_init for versal

Define board_late_init which performs bootmode detection
and prepares corresponding distro boot commaand sequence.

Also disable it for mini platforms because simply there is no need to have
it enabled.
But also disable it for virtual platform because Qemu is not modelling this
register space that's why travis testing would fail. This configuration
should be reverted when mainline Qemu is updated.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 47a766f9 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig

Move hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up
for different platforms.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# fb771793 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Remove one level of indentation in board_early_init_r()

Simplify code indentation.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# ec48b6c9 22-Aug-2018 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
Engines with leading-edge memory and interfacing technologies to deliver
powerful heterogeneous acceleration for any application. The Versal AI
Core series has five devices, offering 128 to 400 AI Engines. The series
includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
than 1,900 DSP engines optimized for high-precision floating point with
low latency.

The patch is adding necessary infrastructure in place without enabling
platform which is done in separate patch.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 9a3b4ceb 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move reset_cpu() to the CPU header

Move this function out of common.h and into a relevant header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 53c69dec 18-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

board: xilinx: Add support for user configurable boot script offset

Currently "script_offset_f" env variable is hardcoded, this variable
specifies from which offset of the flash boot.scr should be read/write.
As flashes are of different sizes having a fixed offset makes it
difficult to load other images into the flash which may overwrite the
boot script or cannot utilize the full memory. This current fix
creates a new config "CONFIG_BOOT_SCRIPT_OFFSET" which holds the
offset address, overwrites the "script_offset_f" variable.
Also removed existing variable with default values, as the default
values are held by CONFIG_BOOT_SCRIPT_OFFSET

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c5b7bb1 16-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Fix emmc boot mode boot_target issue

Emmc boot devcie is mounted to sdhci@f1050000 controller on versal, while
in emmc boot mode, boot tragets are set to mmc0. So removed mmc0 and using
the dev seq number from the sdhci@f1050000 controller.
Dev seq number is setup based on DT aliases that's why needs to be setup at
run time.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 5255932f 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move some board functions out of common.h

A number of board function belong in init.h with the others. Move them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 1045315d 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move get_ticks() function out of common.h

This function belongs in time.h so move it over and add a comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f0c16cd6 11-Jul-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Add new dfu usb distro boot command

This patch adds new dfu usb distro boot command to look for bootscript
from dfu-util and runs it.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>

# 3d865acb 25-Jun-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Add new jtag distro boot command

This patch adds new jtag distro boot command to look for bootscript file
in DDR and execute it first incase of jtag bootmode.
This patch also updates scriptaddr to 512MB as there is high of script
corruption incase of bigger kernel image.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# aef149e9 29-Apr-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Enable memory mapping via DT

Code reads DT and setup MMU table based on memory node. This will ensure
that only DT needs to be changed.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 085201c2 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Set initrd_high to as high as possible

This patch is setting up the initrd_high to as high as possible by leaving
max stack size for u-boot so that bigger rootfs can also be loaded by
u-boot for booting kernel.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 26e054c9 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: fpga: Add PL bit stream load support

This patch adds PL bitstream load support for Versal platform. The PL
bitstream is loaded by making an SMC to ATF which in turn communicates
with platform firmware which configures and loads PL bitstream on to PL.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# bfd092f9 31-Jan-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Define board_late_init for versal

Define board_late_init which performs bootmode detection
and prepares corresponding distro boot commaand sequence.

Also disable it for mini platforms because simply there is no need to have
it enabled.
But also disable it for virtual platform because Qemu is not modelling this
register space that's why travis testing would fail. This configuration
should be reverted when mainline Qemu is updated.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 47a766f9 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig

Move hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up
for different platforms.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# fb771793 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Remove one level of indentation in board_early_init_r()

Simplify code indentation.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# ec48b6c9 22-Aug-2018 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
Engines with leading-edge memory and interfacing technologies to deliver
powerful heterogeneous acceleration for any application. The Versal AI
Core series has five devices, offering 128 to 400 AI Engines. The series
includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
than 1,900 DSP engines optimized for high-precision floating point with
low latency.

The patch is adding necessary infrastructure in place without enabling
platform which is done in separate patch.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 53c69dec 18-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

board: xilinx: Add support for user configurable boot script offset

Currently "script_offset_f" env variable is hardcoded, this variable
specifies from which offset of the flash boot.scr should be read/write.
As flashes are of different sizes having a fixed offset makes it
difficult to load other images into the flash which may overwrite the
boot script or cannot utilize the full memory. This current fix
creates a new config "CONFIG_BOOT_SCRIPT_OFFSET" which holds the
offset address, overwrites the "script_offset_f" variable.
Also removed existing variable with default values, as the default
values are held by CONFIG_BOOT_SCRIPT_OFFSET

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 7c5b7bb1 16-Dec-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Fix emmc boot mode boot_target issue

Emmc boot devcie is mounted to sdhci@f1050000 controller on versal, while
in emmc boot mode, boot tragets are set to mmc0. So removed mmc0 and using
the dev seq number from the sdhci@f1050000 controller.
Dev seq number is setup based on DT aliases that's why needs to be setup at
run time.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 5255932f 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move some board functions out of common.h

A number of board function belong in init.h with the others. Move them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 1045315d 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move get_ticks() function out of common.h

This function belongs in time.h so move it over and add a comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f0c16cd6 11-Jul-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Add new dfu usb distro boot command

This patch adds new dfu usb distro boot command to look for bootscript
from dfu-util and runs it.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>

# 3d865acb 25-Jun-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Add new jtag distro boot command

This patch adds new jtag distro boot command to look for bootscript file
in DDR and execute it first incase of jtag bootmode.
This patch also updates scriptaddr to 512MB as there is high of script
corruption incase of bigger kernel image.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# aef149e9 29-Apr-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Enable memory mapping via DT

Code reads DT and setup MMU table based on memory node. This will ensure
that only DT needs to be changed.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 085201c2 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Set initrd_high to as high as possible

This patch is setting up the initrd_high to as high as possible by leaving
max stack size for u-boot so that bigger rootfs can also be loaded by
u-boot for booting kernel.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 26e054c9 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: fpga: Add PL bit stream load support

This patch adds PL bitstream load support for Versal platform. The PL
bitstream is loaded by making an SMC to ATF which in turn communicates
with platform firmware which configures and loads PL bitstream on to PL.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# bfd092f9 31-Jan-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Define board_late_init for versal

Define board_late_init which performs bootmode detection
and prepares corresponding distro boot commaand sequence.

Also disable it for mini platforms because simply there is no need to have
it enabled.
But also disable it for virtual platform because Qemu is not modelling this
register space that's why travis testing would fail. This configuration
should be reverted when mainline Qemu is updated.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 47a766f9 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig

Move hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up
for different platforms.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# fb771793 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Remove one level of indentation in board_early_init_r()

Simplify code indentation.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# ec48b6c9 22-Aug-2018 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
Engines with leading-edge memory and interfacing technologies to deliver
powerful heterogeneous acceleration for any application. The Versal AI
Core series has five devices, offering 128 to 400 AI Engines. The series
includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
than 1,900 DSP engines optimized for high-precision floating point with
low latency.

The patch is adding necessary infrastructure in place without enabling
platform which is done in separate patch.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 5255932f 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move some board functions out of common.h

A number of board function belong in init.h with the others. Move them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 1045315d 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move get_ticks() function out of common.h

This function belongs in time.h so move it over and add a comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f0c16cd6 11-Jul-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Add new dfu usb distro boot command

This patch adds new dfu usb distro boot command to look for bootscript
from dfu-util and runs it.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>

# 3d865acb 25-Jun-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Add new jtag distro boot command

This patch adds new jtag distro boot command to look for bootscript file
in DDR and execute it first incase of jtag bootmode.
This patch also updates scriptaddr to 512MB as there is high of script
corruption incase of bigger kernel image.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# aef149e9 29-Apr-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Enable memory mapping via DT

Code reads DT and setup MMU table based on memory node. This will ensure
that only DT needs to be changed.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 085201c2 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Set initrd_high to as high as possible

This patch is setting up the initrd_high to as high as possible by leaving
max stack size for u-boot so that bigger rootfs can also be loaded by
u-boot for booting kernel.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 26e054c9 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: fpga: Add PL bit stream load support

This patch adds PL bitstream load support for Versal platform. The PL
bitstream is loaded by making an SMC to ATF which in turn communicates
with platform firmware which configures and loads PL bitstream on to PL.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# bfd092f9 31-Jan-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Define board_late_init for versal

Define board_late_init which performs bootmode detection
and prepares corresponding distro boot commaand sequence.

Also disable it for mini platforms because simply there is no need to have
it enabled.
But also disable it for virtual platform because Qemu is not modelling this
register space that's why travis testing would fail. This configuration
should be reverted when mainline Qemu is updated.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 47a766f9 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig

Move hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up
for different platforms.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# fb771793 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Remove one level of indentation in board_early_init_r()

Simplify code indentation.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# ec48b6c9 22-Aug-2018 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
Engines with leading-edge memory and interfacing technologies to deliver
powerful heterogeneous acceleration for any application. The Versal AI
Core series has five devices, offering 128 to 400 AI Engines. The series
includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
than 1,900 DSP engines optimized for high-precision floating point with
low latency.

The patch is adding necessary infrastructure in place without enabling
platform which is done in separate patch.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# f0c16cd6 11-Jul-2019 T Karthik Reddy <t.karthik.reddy@xilinx.com>

arm64: versal: Add new dfu usb distro boot command

This patch adds new dfu usb distro boot command to look for bootscript
from dfu-util and runs it.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>

# 3d865acb 25-Jun-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Add new jtag distro boot command

This patch adds new jtag distro boot command to look for bootscript file
in DDR and execute it first incase of jtag bootmode.
This patch also updates scriptaddr to 512MB as there is high of script
corruption incase of bigger kernel image.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# aef149e9 29-Apr-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Enable memory mapping via DT

Code reads DT and setup MMU table based on memory node. This will ensure
that only DT needs to be changed.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 085201c2 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Set initrd_high to as high as possible

This patch is setting up the initrd_high to as high as possible by leaving
max stack size for u-boot so that bigger rootfs can also be loaded by
u-boot for booting kernel.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 26e054c9 05-Aug-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: fpga: Add PL bit stream load support

This patch adds PL bitstream load support for Versal platform. The PL
bitstream is loaded by making an SMC to ATF which in turn communicates
with platform firmware which configures and loads PL bitstream on to PL.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# bfd092f9 31-Jan-2019 Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

arm64: versal: Define board_late_init for versal

Define board_late_init which performs bootmode detection
and prepares corresponding distro boot commaand sequence.

Also disable it for mini platforms because simply there is no need to have
it enabled.
But also disable it for virtual platform because Qemu is not modelling this
register space that's why travis testing would fail. This configuration
should be reverted when mainline Qemu is updated.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 47a766f9 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig

Move hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up
for different platforms.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# fb771793 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Remove one level of indentation in board_early_init_r()

Simplify code indentation.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# ec48b6c9 22-Aug-2018 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
Engines with leading-edge memory and interfacing technologies to deliver
powerful heterogeneous acceleration for any application. The Versal AI
Core series has five devices, offering 128 to 400 AI Engines. The series
includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
than 1,900 DSP engines optimized for high-precision floating point with
low latency.

The patch is adding necessary infrastructure in place without enabling
platform which is done in separate patch.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# 47a766f9 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig

Move hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up
for different platforms.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# fb771793 28-Jan-2019 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Remove one level of indentation in board_early_init_r()

Simplify code indentation.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# ec48b6c9 22-Aug-2018 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
Engines with leading-edge memory and interfacing technologies to deliver
powerful heterogeneous acceleration for any application. The Versal AI
Core series has five devices, offering 128 to 400 AI Engines. The series
includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
than 1,900 DSP engines optimized for high-precision floating point with
low latency.

The patch is adding necessary infrastructure in place without enabling
platform which is done in separate patch.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>

# ec48b6c9 22-Aug-2018 Michal Simek <michal.simek@xilinx.com>

arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine
Scalar Processing Engines, Adaptable Hardware Engines, and Intelligent
Engines with leading-edge memory and interfacing technologies to deliver
powerful heterogeneous acceleration for any application. The Versal AI
Core series has five devices, offering 128 to 400 AI Engines. The series
includes dual-core Arm Cortex™-A72 application processors, dual-core Arm
Cortex-R5 real-time processors, 256KB of on-chip memory with ECC, more
than 1,900 DSP engines optimized for high-precision floating point with
low latency.

The patch is adding necessary infrastructure in place without enabling
platform which is done in separate patch.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>