]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
15 months agoMerge tag 'x86-pull-20230922' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Fri, 22 Sep 2023 15:16:22 +0000 (11:16 -0400)]
Merge tag 'x86-pull-20230922' of https://source.denx.de/u-boot/custodians/u-boot-x86 into next

- Add bootstd support to 64-bit efi payload
- Fix a bug of missing setting size of initrd in pxeboot
- Allow Python packages to be dropped
- Reland "x86: Move FACP table into separate functions"
- Fixes for chromebook_link64 and chromebook_samus_tpl
- Fixes and improvements for coreboot
- x86 documentation updates

15 months agox86: doc: coreboot: Mention 64-bit Linux distros
Simon Glass [Wed, 20 Sep 2023 03:00:21 +0000 (21:00 -0600)]
x86: doc: coreboot: Mention 64-bit Linux distros

Add a little more detail as to why coreboot64 is preferred for booting
Linux distros.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: doc: Split out manual booting into its own file
Simon Glass [Wed, 20 Sep 2023 03:00:20 +0000 (21:00 -0600)]
x86: doc: Split out manual booting into its own file

Move this out of the main file since for simple users it is easier to
rely on standard boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: doc: Update summaries and add links
Simon Glass [Thu, 21 Sep 2023 13:37:45 +0000 (07:37 -0600)]
x86: doc: Update summaries and add links

Refresh the summary information so it is more up-to-date. Add links to
the coreboot and slimbootloader docs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: doc: Move into its own directory
Simon Glass [Wed, 20 Sep 2023 03:00:18 +0000 (21:00 -0600)]
x86: doc: Move into its own directory

There is enough material that it makes sense to split this up into
several files. Create an x86/ directory for this purpose.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: coreboot: Record the position of the SMBIOS tables
Simon Glass [Wed, 20 Sep 2023 03:00:17 +0000 (21:00 -0600)]
x86: coreboot: Record the position of the SMBIOS tables

Make a note of where coreboot installed the SMBIOS tables so that we can
pass this on to EFI.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agoefi: Use the installed SMBIOS tables
Simon Glass [Wed, 20 Sep 2023 13:29:51 +0000 (07:29 -0600)]
efi: Use the installed SMBIOS tables

U-Boot should set up the SMBIOS tables during startup, as it does on x86.
Ensure that it does this correctly on non-x86 machines too, by creating
an event spy for last-stage init.

Tidy up the installation-condition code while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agoRecord the position of the SMBIOS tables
Simon Glass [Wed, 20 Sep 2023 03:00:15 +0000 (21:00 -0600)]
Record the position of the SMBIOS tables

Remember where these end up so that we can pass this information on to
the EFI layer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agobootstd: Keep track of use of usb stop
Simon Glass [Wed, 20 Sep 2023 13:29:49 +0000 (07:29 -0600)]
bootstd: Keep track of use of usb stop

When 'usb stop' is run, doing 'bootflow scan' does not run the USB hunter
again so does not see any devices. Fix this by telling bootstd about the
state of USB.

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agox86: smbios: Add a Kconfig indicating SMBIOS-table presence
Simon Glass [Wed, 20 Sep 2023 03:00:13 +0000 (21:00 -0600)]
x86: smbios: Add a Kconfig indicating SMBIOS-table presence

When booted from coreboot, U-Boot does not build the SMBIOS tables, but
it should still pass them on to the OS. Add a new option which indicates
whether SMBIOS tables are present, however they were built.

Flip the ordering so that the dependency is listed first, which is less
confusing.

Adjust GENERATE_SMBIOS_TABLE to depend on this new symbol.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agoefi: x86: Correct the condition for installing ACPI tables
Simon Glass [Wed, 20 Sep 2023 03:00:12 +0000 (21:00 -0600)]
efi: x86: Correct the condition for installing ACPI tables

It is not always the case that U-Boot builds the ACPI tables itself. For
example, when booting from coreboot, the ACPI tables are built by
coreboot.

Correct the Makefile condition so that U-Boot can pass on tables built
by a previous firmware stage.

Tidy up the installation-condition code while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: coreboot: Enable VIDEO_COPY
Simon Glass [Wed, 20 Sep 2023 03:00:11 +0000 (21:00 -0600)]
x86: coreboot: Enable VIDEO_COPY

At least on modern machines the write-back mechanism for the frame buffer
is quite slow when scrolling, since it must read the entire frame buffer
and write it back.

Enable the VIDEO_COPY feature to resolve this problem.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: coreboot: Align options between coreboot and coreboot64
Simon Glass [Wed, 20 Sep 2023 03:00:10 +0000 (21:00 -0600)]
x86: coreboot: Align options between coreboot and coreboot64

These two builds are similar but have some different options for not good
reason. Line them up to be as similar as possible.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: coreboot: Drop USB init on startup
Simon Glass [Thu, 21 Sep 2023 13:37:44 +0000 (07:37 -0600)]
x86: coreboot: Drop USB init on startup

This is very annoying as it is quite slow on many machines. Also, U-Boot
has an existing 'preboot' mechanism to enable this feature if desired.

Drop this code so that it is possible to choose whether to init USB or
not.

Use the existing USE_PREBOOT mechanism instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: coreboot: Enable CONFIG_SYS_NS16550_MEM32
Simon Glass [Wed, 20 Sep 2023 03:00:08 +0000 (21:00 -0600)]
x86: coreboot: Enable CONFIG_SYS_NS16550_MEM32

The debug UART on modern machines uses a 32-bit wide transfer. Without
this, setting debug output causes a hang or no output. It is not obvious
(when enabling CONFIG_DEBUG_UART) that this is needed.

Enable 32-bit access to avoid this trap.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: coreboot: Look for DBG2 UART in SPL too
Simon Glass [Wed, 20 Sep 2023 03:00:07 +0000 (21:00 -0600)]
x86: coreboot: Look for DBG2 UART in SPL too

If coreboot does not set up sysinfo for the UART, SPL currently hangs.
Use the DBG2 technique there as well. This allows coreboot64 to boot from
coreboot even if the console info is missing from sysinfo

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: Allow APCI in SPL
Simon Glass [Wed, 20 Sep 2023 03:00:06 +0000 (21:00 -0600)]
x86: Allow APCI in SPL

This is needed so we can find the DBG2 table provided by coreboot. Add a
Kconfig so it can be enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: Set the CPU vendor in SPL
Simon Glass [Wed, 20 Sep 2023 03:00:05 +0000 (21:00 -0600)]
x86: Set the CPU vendor in SPL

We don't read this information in 64-bit mode, since we don't have the
macros for doing it. Set it to Intel by default. This allows the TSC timer
to work correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: coreboot: Rearrange arch_cpu_init()
Simon Glass [Wed, 20 Sep 2023 03:00:04 +0000 (21:00 -0600)]
x86: coreboot: Rearrange arch_cpu_init()

Init errors in SPL are currently ignored by this function.

Change the code to init the CPU, reporting an error if something is wrong.
After that, look for the coreboot table.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: coreboot: Enable standard boot
Simon Glass [Wed, 20 Sep 2023 03:00:03 +0000 (21:00 -0600)]
x86: coreboot: Enable standard boot

Enable bootstd options and provide instructions on how to boot a linux
distro using coreboot.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: coreboot: Add IDE and SATA
Simon Glass [Wed, 20 Sep 2023 03:00:02 +0000 (21:00 -0600)]
x86: coreboot: Add IDE and SATA

Add these options to permit access to more disk types.

Add some documentation as well.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: Update cbmem driver
Simon Glass [Sun, 10 Sep 2023 19:13:02 +0000 (13:13 -0600)]
x86: Update cbmem driver

This driver is not actually built since a Kconfig was never created for
it.

Add a Kconfig (which is already implied by COREBOOT) and update the
implementation to avoid using unnecessary memory. Drop the #ifdef at the
top since we can rely on Kconfig to get that right.

To enable it (in addition to serial and video), use:

   setenv stdout serial,vidconsole,cbmem

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[Modified the comment about overflow a little bit]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: coreboot: Document cbmem console struct
Simon Glass [Sun, 10 Sep 2023 19:13:01 +0000 (13:13 -0600)]
x86: coreboot: Document cbmem console struct

Coreboot changed a few years ago to include an overflow flag. Update the
structure to match this.

This comes from coreboot commit:

   6f5ead14b4 ("mb/google/nissa/var/joxer: Update eMMC DLL settings")

Note: There are several implementations of this in coreboot. I have chosen
to follow the one in src/lib/cbmem_console.c

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: doc: Update the list of supported Chromebooks
Simon Glass [Thu, 7 Sep 2023 15:58:21 +0000 (09:58 -0600)]
x86: doc: Update the list of supported Chromebooks

One is missing, so add it. Also mention the SoC used in each.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: dm: Mark driver model as dead when disabling CAR
Simon Glass [Thu, 7 Sep 2023 15:58:20 +0000 (09:58 -0600)]
x86: dm: Mark driver model as dead when disabling CAR

When turning off CAR, set the flag to make sure that nothing tries to use
driver model in SPL before jumping to U-Bot proper, since its tables are
in CAR.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: broadwell: Set up MTRRs
Simon Glass [Thu, 7 Sep 2023 15:58:19 +0000 (09:58 -0600)]
x86: broadwell: Set up MTRRs

The current condition does not handle the samus_tpl case where it sets
up the RAM in SPL but needs to commit the MTRRs in U-Boot proper.

Add another case to handle this and update the comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: broadwell: Avoid initing the CPU twice
Simon Glass [Thu, 7 Sep 2023 15:58:18 +0000 (09:58 -0600)]
x86: broadwell: Avoid initing the CPU twice

When TPL has already set up the CPU, don't do it again. This existing
code actually has this backwards, so fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: spl: Change the condition for copying U-Boot to RAM
Simon Glass [Thu, 7 Sep 2023 15:58:17 +0000 (09:58 -0600)]
x86: spl: Change the condition for copying U-Boot to RAM

Make this depend on whether the address matches the offset, rather than
a particular board build. For samus_tpl we don't need to copy, for
example.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: samus_tpl: Correct text base and alloc sizes
Simon Glass [Thu, 7 Sep 2023 15:58:16 +0000 (09:58 -0600)]
x86: samus_tpl: Correct text base and alloc sizes

Make sure that CONFIG_X86_OFFSET_U_BOOT is the same as CONFIG_TEXT_BASE
as it is changing CONFIG_X86_OFFSET_U_BOOT

Samus boots into U-Boot proper in flash, not RAM. Also expand the SPL
malloc() size a little, to avoid an error.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: Add some log categories
Simon Glass [Thu, 7 Sep 2023 15:58:15 +0000 (09:58 -0600)]
x86: Add some log categories

Add some missing log categories to a few files.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: broadwell: Show the memory delay
Simon Glass [Thu, 7 Sep 2023 15:58:14 +0000 (09:58 -0600)]
x86: broadwell: Show the memory delay

Samus only takes 7 seconds but it is long enough to think it has hung. Add
a message about what it is doing, similar to the approach on coral.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agodm: core: Allow marking driver model as dead
Simon Glass [Thu, 7 Sep 2023 15:58:13 +0000 (09:58 -0600)]
dm: core: Allow marking driver model as dead

On x86 devices we use CAR (Cache-As-RAM) to hold the malloc() region in
SPL, since SDRAM is not set up yet. This means that driver model stores
its tables in this region.

When preparing to jump from SPL to U-Boot proper, we must disable CAR, so
that the CPU can uses the caches normally. This means that driver model
tables become inaccessible. From there until we jump to U-Boot proper, we
must avoid using driver model.

This is only a problem on boards which operate this way, for example
chromebook_link64

Add a flag to indicate that driver model is dead and should not be used.
It can be used in SPL to avoid hanging the machine.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: doc: Document the -cdrom issues I ran into
Simon Glass [Fri, 1 Sep 2023 18:08:23 +0000 (12:08 -0600)]
x86: doc: Document the -cdrom issues I ran into

Add a note about using -cdrom with QEMU.

Suggested-by: Bin Meng <bmeng@tinylab.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
15 months agox86: Prevent from missing the FADT chaining
Andy Shevchenko [Fri, 1 Sep 2023 17:27:10 +0000 (11:27 -0600)]
x86: Prevent from missing the FADT chaining

Recent approach with FADT writer shows that there is
a room for subtle errors. Prevent this from happening
again by introducing acpi_add_fadt() helper.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agoReland "x86: Move FACP table into separate functions""
Simon Glass [Fri, 1 Sep 2023 17:27:09 +0000 (11:27 -0600)]
Reland "x86: Move FACP table into separate functions""

Each board has its own way of creating this table. Rather than calling the
acpi_create_fadt() function for each one from a common acpi_write_fadt()
function, just move the writer into the board-specific code.

Co-developed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
15 months agox86: coreboot: Avoid a declaration after a label
Simon Glass [Thu, 31 Aug 2023 17:20:53 +0000 (11:20 -0600)]
x86: coreboot: Avoid a declaration after a label

Declare the global_data pointer at the top of the file, to avoid an
error:

   arch/x86/include/asm/global_data.h:143:35: error: a label can
      only be part of a statement and a declaration is not a statement
   board/coreboot/coreboot/coreboot.c:60:2: note: in expansion of macro
      ‘DECLARE_GLOBAL_DATA_PTR’

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
15 months agoAllow Python packages to be dropped
Simon Glass [Thu, 31 Aug 2023 17:20:52 +0000 (11:20 -0600)]
Allow Python packages to be dropped

When building in a portage chroot, we do not have the environment needed
to build pylibfdt. It is instead build as a separate package.

Provide a build option to tell U-Boot to skip this part of the build. We
still need it to use binman, etc. but don't need it to build its
dependencies.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
[s/build bytes/builds bytes in tools.rst]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: pxeboot: bugfix: Set variable for size of initrd
Thomas Mittelstaedt [Thu, 4 May 2023 13:42:55 +0000 (13:42 +0000)]
x86: pxeboot: bugfix: Set variable for size of initrd

The problem was, that zboot() didn't work because of missing
ramdisc size.

Signed-off-by: Thomas Mittelstaedt <thomas.mittelstaedt@de.bosch.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
15 months agox86: efi-payload64: Add bootstd support
Thomas Mittelstaedt [Thu, 4 May 2023 13:42:54 +0000 (13:42 +0000)]
x86: efi-payload64: Add bootstd support

Enable bootstd support for U-Boot at VirtualBox described at
https://source.denx.de/u-boot/u-boot/-/blob/master/doc/develop/bootstd.rst

This is used to boot system images at Virtualbox via
- distroboot (extlinux.conf)
- boot script

Signed-off-by: Thomas Mittelstaedt <thomas.mittelstaedt@bosch.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
[Added 'efi-payload64' tag]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: efi-payload64: Add support for SCSI devices
Thomas Mittelstaedt [Thu, 4 May 2023 13:42:53 +0000 (13:42 +0000)]
x86: efi-payload64: Add support for SCSI devices

U-Boot at VirtualBox must load Linux and boot configuration from disk devices.
Here the discs at AHCI (scsi) bus are used to load the needed boot data.

Signed-off-by: Thomas Mittelstaedt <thomas.mittelstaedt@de.bosch.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
[Added 'efi-payload64' tag and rebased on top of u-boot/master]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
15 months agox86: cpu: i386: cpu: only set pci_ram_top if CONFIG_IS_ENABLED(PCI)
Troy Kisky [Mon, 13 Mar 2023 21:31:43 +0000 (14:31 -0700)]
x86: cpu: i386: cpu: only set pci_ram_top if CONFIG_IS_ENABLED(PCI)

This avoids an error when ifdef CONFIG_PCI is changed to
if CONFIG_IS_ENABLED(PCI)

Signed-off-by: Troy Kisky <troykiskyboundary@gmail.com>
[Rebased on top of u-boot/master]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
15 months agoMerge tag 'xilinx-for-v2024.01-rc1-v2' of https://source.denx.de/u-boot/custodians...
Tom Rini [Thu, 21 Sep 2023 14:51:58 +0000 (10:51 -0400)]
Merge tag 'xilinx-for-v2024.01-rc1-v2' of https://source.denx.de/u-boot/custodians/u-boot-microblaze into next

Xilinx changes for v2024.01-rc1

clk:
- Dont return error when assigned-clocks is empty or missing

dm:
- Support reading a single indexed u64 value
- Add support for reading bootscript address/flash address from DT

cmd:
- Fix flash_is_unlocked API

fpga:
- Define fpga_load() for debug build

global:
- U-Boot project name cleanup (next2)

net:
- zynq_gem: Use generic_phy_valid() helper
- axienet: Convert to ofnode functions
- gmii2rgmii: Read bridge address from DT

pytest:
- skip tpm2_startup when env__tpm_device_test_skip=True

spi-nor:
- Add mx25u25635f support
- zynqmp_qspi: Tune cache behavior

trace:
- Fix flyrecord alignment issue

xilinx:
- Move scriptaddr to DT as bootscr-address
- Pick script_offset_f/script_size_f from DT as bootscr-flash-offset/size
- Do not generate distro boot variables if disabled

versal:
- Extend memory ranges to cover HBM
- Enable TPM, sha1sum and KASLRSEED
- Fix distroboot prioritization in connection to available devices
- Clean mini targets bootcommand
- Fix clock driver

versal-net:
- Enable TPM, sha1sum and KASLRSEED
- Fix distroboot prioritization in connection to available devices

zynqmp;
- Allow AES to run from SPL
- Enable CMD_KASLRSEED
- Add proper dependencies for USB and remove ZYNQMP_USB
- Fix user si570 default frequency for zcu* boards
- Cover SOM rev2 revision
- Various DT changes
- Add firmware and pinctrl support for tristate configuration
  (high impedance/output enable)
- Add output-enable pins to SOMs
- Fix distroboot prioritization in connection to available devices
- Read bootscript address/flash address from DT
- Fix pcap_prog address

15 months agoMerge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-riscv into...
Tom Rini [Thu, 21 Sep 2023 14:51:15 +0000 (10:51 -0400)]
Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-riscv into next

+ Add NVMe & USB boot devices for VisionFive2
+ Add StarFive SPL image support in mkimage tool

15 months agospi: zynqmp_qspi: Workaround for small data cache issue
Venkatesh Yadav Abbarapu [Fri, 15 Sep 2023 03:17:59 +0000 (08:47 +0530)]
spi: zynqmp_qspi: Workaround for small data cache issue

Cache related issues are seen with small sized data reads.
Due to this, proper data is not read. Also some times sf probe
fails randomly. To workaround this issue, invalidate dcache after read DMA
is triggered.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20230915031759.28889-3-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
15 months agospi: zynqmp_qspi: Change flush cache to invalidate cache
Ashok Reddy Soma [Fri, 15 Sep 2023 03:17:58 +0000 (08:47 +0530)]
spi: zynqmp_qspi: Change flush cache to invalidate cache

Before DMA read, ideally cache should be invalidated, so that data from
memory will be updated to cache after DMA is completed. But
flush_dcache_range is being used which is incorrect. Change
flush_dcache_range to invalidate_dcache_range.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20230915031759.28889-2-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
15 months agotrace: Fix alignment logic in flyrecord header
Michal Simek [Fri, 15 Sep 2023 12:12:05 +0000 (14:12 +0200)]
trace: Fix alignment logic in flyrecord header

Current alignment which is using 16 bytes is not correct in connection to
trace_clocks description and it's length.
That's why use start_addr variable and record proper size based on used
entries.

Fixes: be16fc81b2ed ("trace: Update proftool to use new binary format").
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/691dad64df80993ca4cfb6d0e33964ed26f50bee.1694779918.git.michal.simek@amd.com
15 months agotrace: Move trace_clocks description above record offset calculation
Michal Simek [Fri, 15 Sep 2023 12:12:04 +0000 (14:12 +0200)]
trace: Move trace_clocks description above record offset calculation

Flyrecord tracing data are page aligned that's why it is necessary to
calculate alignment properly. Because trace_clocks description is the part
of record length it is necessary to have information about length earlier.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/d3853d91b6fa7e3a1e5c24dd3c17335cf0041b5b.1694779918.git.michal.simek@amd.com
15 months agotrace: Use 64bit variable for start and len
Michal Simek [Fri, 15 Sep 2023 12:12:03 +0000 (14:12 +0200)]
trace: Use 64bit variable for start and len

tputq() requires variables to have 64bit width that's why make them 64bit
to clean alignment requirement.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/6edb34ef1f10010d2380f964fb6b4fb3dc257799.1694779918.git.michal.simek@amd.com
15 months agocmd: sf: Fix the flash_is_unlocked api size parameter
Venkatesh Yadav Abbarapu [Wed, 20 Sep 2023 02:54:50 +0000 (08:24 +0530)]
cmd: sf: Fix the flash_is_unlocked api size parameter

When flash erase is called with size parameter, code is checking
if sectors are locked or not. But for checking, the whole device
length minus offset is used instead of actual size which should
be erased. That's why when only some sectors are locked it is
not possible to erase unlocked sectors.

The length is calculated as "length = max_chipsize - offset",
flash_is_unlocked() api is getting updated with length which is
incorrect. Fix this flash_is_unlocked() api by passing the size
parameter.

ZynqMP> sf erase 0 100000
len=0x8000000 which is flash size
size=0x100000

We need to update the size in the flash_is_unlocked() api and not
the length.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Link: https://lore.kernel.org/r/20230920025450.6281-1-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
15 months agozynqmp: config: Add proper dependencies for USB
Venkatesh Yadav Abbarapu [Mon, 4 Sep 2023 03:15:28 +0000 (08:45 +0530)]
zynqmp: config: Add proper dependencies for USB

When CONFIG_CMD_USB and CONFIG_USB are disabled, still some compilation
errors are seen as below.

In file included from include/configs/xilinx_zynqmp.h:173,
                 from include/config.h:3,
                 from include/common.h:16,
                 from env/common.c:10:
include/config_distro_bootcmd.h:302:9: error: expected '}' before 'BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB'
  302 |         BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/config_distro_bootcmd.h:302:9: note: in definition of macro
'BOOTENV_DEV_NAME_USB'
  302 |         BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/configs/xilinx_zynqmp.h:77:41: note: in expansion of macro
'BOOTENV_DEV_NAME'
   77 | # define BOOT_TARGET_DEVICES_USB(func)  func(USB, usb, 0)
   func(USB, usb, 1)
      |                                         ^~~~
include/configs/xilinx_zynqmp.h:168:9: note: in expansion of macro
'BOOT_TARGET_DEVICES_USB'
  168 |         BOOT_TARGET_DEVICES_USB(func) \
      |         ^~~~~~~~~~~~~~~~~~~~~~~
include/config_distro_bootcmd.h:454:25: note: in expansion of macro
'BOOT_TARGET_DEVICES'
  454 |         "boot_targets=" BOOT_TARGET_DEVICES(BOOTENV_DEV_NAME) "\0"
      |                         ^~~~~~~~~~~~~~~~~~~
include/config_distro_bootcmd.h:474:9: note: in expansion of macro
'BOOTENV_BOOT_TARGETS'
  474 |         BOOTENV_BOOT_TARGETS \
      |         ^~~~~~~~~~~~~~~~~~~~
include/configs/xilinx_zynqmp.h:179:9: note: in expansion of macro
'BOOTENV'
  179 |         BOOTENV
      |         ^~~~~~~
include/env_default.h:120:9: note: in expansion of macro
'CFG_EXTRA_ENV_SETTINGS'
  120 |         CFG_EXTRA_ENV_SETTINGS
      |         ^~~~~~~~~~~~~~~~~~~~~~
In file included from env/common.c:32:
include/env_default.h:27:36: note: to match this '{'
   27 | const char default_environment[] = {
      |                                    ^
scripts/Makefile.build:256: recipe for target 'env/common.o' failed
make[1]: *** [env/common.o] Error 1
Makefile:1853: recipe for target 'env' failed
make: *** [env] Error 2
make: *** Waiting for unfinished jobs....

Add CONFIG_USB_STORAGE as dependency for USB related macro's such as
BOOT_TARGET_DEVICES_USB() and DFU_DEFAULT_POLL_TIMEOUT and
CONFIG_THOR_RESET_OFF.

Remove CONFIG_ZYNQMP_USB from Kconfig and also from defconfig since it
is not used anywhere else.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20230904031528.11817-3-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
15 months agocmd: thordown: Add proper dependency for CMD_THOR_DOWNLOAD
Venkatesh Yadav Abbarapu [Mon, 4 Sep 2023 03:15:27 +0000 (08:45 +0530)]
cmd: thordown: Add proper dependency for CMD_THOR_DOWNLOAD

When CONFIG_CMD_USB and CONFIG_USB are disabled some compilation errors are seen as below.

cmd/thordown.o: in function `usb_gadget_initialize':
include/linux/usb/gadget.h:981: undefined reference to `board_usb_init'
cmd/thordown.o: in function `do_thor_down':
cmd/thordown.c:68: undefined reference to `g_dnl_unregister'
cmd/thordown.o: in function `usb_gadget_release':
include/linux/usb/gadget.h:986: undefined reference to `board_usb_cleanup'
cmd/thordown.o: in function `do_thor_down':
cmd/thordown.c:41: undefined reference to `g_dnl_register'
cmd/thordown.c:48: undefined reference to `thor_init'
cmd/thordown.c:56: undefined reference to `thor_handle'
gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-ld.bfd: line 4:  8485
Segmentation fault      (core dumped) $CC --sysroot=$LIBC
--no-warn-rwx-segment "$@"
Makefile:1779: recipe for target 'u-boot' failed
make: *** [u-boot] Error 139
make: *** Deleting file 'u-boot'

Add dependency of USB_GADGET_DOWNLOAD for CONFIG_CMD_THOR_DOWNLOAD to fix the errors.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Link: https://lore.kernel.org/r/20230904031528.11817-2-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
15 months agoclk: versal: Fix the function versal_clock_ref
Venkatesh Yadav Abbarapu [Tue, 12 Sep 2023 03:30:55 +0000 (09:00 +0530)]
clk: versal: Fix the function versal_clock_ref

For reference clocks, PM_CLK_GET_PARENT call is not allowed.
PM_CLK_GET_PARENT only allowed for MUX clocks. Rename the
versal_clock_ref() with versal_clock_get_ref_rate() for better
readability. Fix the versal_clock_get_ref_rate function by
passing the parent_id, and check whether the parent_id
belongs to ref_clk or pl_alt_ref_clk.
Also adding the function versal_clock_get_fixed_factor_rate()
if the clk_id belongs to the fixed factor clock.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20230912033055.2549-1-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
15 months agoarm64: zynqmp: Update ECAM size to discover up to 256 buses
Thippeswamy Havalige [Mon, 11 Sep 2023 14:10:50 +0000 (16:10 +0200)]
arm64: zynqmp: Update ECAM size to discover up to 256 buses

Update ECAM size to discover up to 256 buses

Signed-off-by: Thippeswamy Havalige <thippeswamy.havalige@amd.com>
Acked-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/087391c3e1f60b0a765fca081d47ce632fda8f06.1694441445.git.michal.simek@amd.com
15 months agoarm64: zynqmp: Add resets property for CAN nodes
Srinivas Neeli [Mon, 11 Sep 2023 14:10:49 +0000 (16:10 +0200)]
arm64: zynqmp: Add resets property for CAN nodes

Added resets property for CAN nodes.

Signed-off-by: Srinivas Neeli <srinivas.neeli@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/c4efb7ac361eec591a2f775e161ec446c4dc04c1.1694441445.git.michal.simek@amd.com
15 months agoarm64: zynqmp: Fix i2c address for si570_user1 clock
Saeed Nowshadi [Mon, 11 Sep 2023 14:10:48 +0000 (16:10 +0200)]
arm64: zynqmp: Fix i2c address for si570_user1 clock

Correct the i2c address for si570 oscillator that generates the si570_user1
clock. i2c address was changed by commit b6a8c603d680 ("arm64: zynqmp: Fix
i2c addresses for vck190 SC") because address in node name wasn't aligned
with reg property. But actual 0x5f address is correct which is quite rare
because all other si570s are at 0x5d.

Signed-off-by: Saeed Nowshadi <saeed.nowshadi@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/6f31881b0e2dd657f0d4ff0869c009c2e1224f22.1694441445.git.michal.simek@amd.com
15 months agoarm64: versal: Add no-wp DT property in OSPI flash node
Amit Kumar Mahapatra [Mon, 11 Sep 2023 14:10:47 +0000 (16:10 +0200)]
arm64: versal: Add no-wp DT property in OSPI flash node

Added no-wp DT property in OSPI flash node for all board dts & dtsi files
on which the WP# signal of the OSPI flash device is not connected. If this
property is set, then the software will avoid setting the status register
write disable (SRWD) bit in status register during status register
write operation.

Signed-off-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/7e88dd7b9306bdf0738b2248bf9017e1997d25dc.1694441445.git.michal.simek@amd.com
15 months agoarm64: zynqmp: Rename xlnx, mio_bank to xlnx, mio-bank for DLC21
Michal Simek [Mon, 11 Sep 2023 14:10:46 +0000 (16:10 +0200)]
arm64: zynqmp: Rename xlnx, mio_bank to xlnx, mio-bank for DLC21

xlnx,mio_bank was used in past but it was renamed to xlnx,mio-bank because
'_' in property shoudln't be used. There is no impact on the platform
because if the properly is not defined bank 0 is default. Bank 0 and 1 have
the same configuration that's why there shouldn't be any issue.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/ace68d4b7701d1606a85cb18242409fce941b363.1694441445.git.michal.simek@amd.com
15 months agodm: core: ofnode: Fix error message in ofnode_read_bootscript_address/flash()
Michal Simek [Mon, 11 Sep 2023 13:30:01 +0000 (15:30 +0200)]
dm: core: ofnode: Fix error message in ofnode_read_bootscript_address/flash()

Missing u-boot node shouldn't be visible in bootlog without debug enabled
that's why change message from printf to debug.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/ff62e980237ab271cf05facfbc306e85914a8c6e.1694438999.git.michal.simek@amd.com
15 months agonet: phy: xilinx-gmii2rgmii: Removed hardcoded phy address 0 for bridge
Tejas Bhumkar [Fri, 15 Sep 2023 04:50:43 +0000 (10:20 +0530)]
net: phy: xilinx-gmii2rgmii: Removed hardcoded phy address 0 for bridge

Current code expects bridge phy address at 0 which is not correct
expectation because bridge phy address is configurable.
That's why update the code to read reg property to figure it out
where bridge is and use it in phy creation code.

Signed-off-by: Tejas Bhumkar <tejas.arvind.bhumkar@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20230915045043.4167628-1-tejas.arvind.bhumkar@amd.com
15 months agoarm64: zynqmp: Corrected pcap_prog register address
Lukas Funke [Fri, 15 Sep 2023 09:39:01 +0000 (11:39 +0200)]
arm64: zynqmp: Corrected pcap_prog register address

Currently the pcap_prog struct variable is pointing to 0x3004 which is
incorrect according to [1]. The variable should point to 0x3000.

[1] https://www.xilinx.com/htmldocs/registers/ug1087/ug1087-zynq-ultrascale-registers.html#csu___pcap_prog.html

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
Link: https://lore.kernel.org/r/20230915093901.1062825-1-lukas.funke-oss@weidmueller.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
15 months agoglobal: Use proper project name U-Boot (next2)
Michal Simek [Fri, 8 Sep 2023 07:11:31 +0000 (09:11 +0200)]
global: Use proper project name U-Boot (next2)

Use proper project name in README, rst and comment.
Done in connection to commit bb922ca3eb4b ("global: Use proper project name
U-Boot (next)").

Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexander Graf <graf@csgraf.de> (ppce500)
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/536af05e7061982f15b668e87f941cdabfa25392.1694157084.git.michal.simek@amd.com
15 months agonet: axi_emac: Convert to ofnode functions
Maxim Kochetkov [Fri, 11 Aug 2023 07:43:51 +0000 (10:43 +0300)]
net: axi_emac: Convert to ofnode functions

FDT functions is not working when OF_LIVE is enabled.
Convert fdt parsing functions to ofnode parsing functions.

Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>
Link: https://lore.kernel.org/r/20230811074351.26916-1-fido_max@inbox.ru
15 months agoarm64: xilinx: Guard distro boot variable generation
Michal Simek [Tue, 5 Sep 2023 11:30:07 +0000 (13:30 +0200)]
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
15 months agoarm64: versal: Do not define boot command for mini configurations
Michal Simek [Tue, 5 Sep 2023 08:23:36 +0000 (10:23 +0200)]
arm64: versal: Do not define boot command for mini configurations

Mini configuration is not design to boot anything that's why there is no
reason to setup boot command. CONFIG_DISTRO_DEFAULTS is disabled anyway.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/41ac52d946ac53d162c407094dc215e6a932af92.1693902205.git.michal.simek@amd.com
15 months agoxilinx: zynqmp: Do not setup boot_targets if driver is not enabled
Venkatesh Yadav Abbarapu [Mon, 4 Sep 2023 03:20:35 +0000 (08:50 +0530)]
xilinx: zynqmp: 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-4-venkatesh.abbarapu@amd.com
15 months agoxilinx: versal: Do not setup boot_targets if driver is not enabled
Venkatesh Yadav Abbarapu [Mon, 4 Sep 2023 03:20:34 +0000 (08:50 +0530)]
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
15 months agoxilinx: versal-net: Do not setup boot_targets if driver is not enabled
Venkatesh Yadav Abbarapu [Mon, 4 Sep 2023 03:20:33 +0000 (08:50 +0530)]
xilinx: versal-net: 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-2-venkatesh.abbarapu@amd.com
15 months agoxilinx: board: Add support to pick bootscr flash offset/size from DT
Michal Simek [Thu, 31 Aug 2023 07:04:28 +0000 (09:04 +0200)]
xilinx: board: Add support to pick bootscr flash offset/size from DT

Location of bootscript in flash can be specified via /options/u-boot DT
node by using bootscr-flash-offset and bootscr-flash-size properties.
Values should be saved to script_offset_f and script_size_f variables.
Variables are described in doc/develop/bootstd.rst as:
script_offset_f
    SPI flash offset from which to load the U-Boot script, e.g. 0xffe000

script_size_f
    Size of the script to load, e.g. 0x2000

Both of them are used by sf_get_bootflow() in drivers/mtd/spi/sf_bootdev.c
to identify bootscript location inside flash.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/60a84405f3fefabb8b48a4e1ce84431483a729f3.1693465465.git.michal.simek@amd.com
15 months agodm: core: ofnode: Add ofnode_read_bootscript_flash()
Michal Simek [Thu, 31 Aug 2023 07:04:27 +0000 (09:04 +0200)]
dm: core: ofnode: Add ofnode_read_bootscript_flash()

ofnode_read_bootscript_flash() reads bootscript address from
/options/u-boot DT node. bootscr-flash-offset and bootscr-flash-size
properties are read and values are filled. When bootscr-flash-size is not
defined, bootscr-flash-offset property is unusable that's why cleaned.
Both of these properties should be defined to function properly.

Also add test to cover this new function.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/08a3e6c09cce13287c69ad370e409e7f1766b406.1693465465.git.michal.simek@amd.com
15 months agoarm64: zynqmp: Add output-enable pins to SOMs
Neal Frager [Thu, 31 Aug 2023 14:27:53 +0000 (16:27 +0200)]
arm64: zynqmp: Add output-enable pins to SOMs

Now that the zynqmp pinctrl driver supports the tri-state registers, make
sure that the pins requiring output-enable are configured appropriately for
SOMs.

Without it, all tristate setting for MIOs, which are not related to SOM
itself, are using default configuration which is not correct setting.
It means SDs, USBs, ethernet, etc. are not working properly.

In past it was fixed through calling tristate configuration via bootcmd:
usb_init=mw 0xFF180208 2020
kv260_gem3=mw 0xFF18020C 0xFC0 && gpio toggle gpio@ff0a000038 && \
  gpio toggle gpio@ff0a000038

Signed-off-by: Neal Frager <neal.frager@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/7ecd98b2a302c5c6628e0234482f23c38e721fd6.1693492064.git.michal.simek@amd.com
15 months agoxilinx: board: Add support to pick bootscr address from DT
Algapally Santosh Sagar [Thu, 31 Aug 2023 06:59:06 +0000 (08:59 +0200)]
xilinx: board: Add support to pick bootscr address from DT

The bootscript is expected at a default address specific to each
platform.
When high speed memory like Programmable Logic Double Data Rate RAM
(PL DDR RAM) or Higher Bandwidth Memory RAM (HBM) is used the boot.scr
may be loaded at a different offset. The offset needs to be set through
setenv. Due to the default values in some cases the boot.scr is falling
in between the kernel partition.

The bootscript address or the bootscript offset is fetched directly from
the DT and updated in the environment making it easier for automated
flows.

Signed-off-by: Algapally Santosh Sagar <santoshsagar.algapally@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/fac7020b31e1f150b021d666f0d588579ea671ad.1693465140.git.michal.simek@amd.com
15 months agodm: core: ofnode: Add ofnode_read_bootscript_address()
Michal Simek [Thu, 31 Aug 2023 06:59:05 +0000 (08:59 +0200)]
dm: core: ofnode: Add ofnode_read_bootscript_address()

ofnode_read_bootscript_address() reads bootscript address from
/options/u-boot DT node. bootscr-address or bootscr-ram-offset properties
are read and values are filled. bootscr-address has higher priority than
bootscr-ram-offset and the only one should be described in DT.

Also add test to cover this new function.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/23be3838502efef61803c90ef6e8b32bbd6ede41.1693465140.git.michal.simek@amd.com
15 months agoclk: Dont return error when assigned-clocks is empty or missing
Ashok Reddy Soma [Wed, 30 Aug 2023 08:31:42 +0000 (10:31 +0200)]
clk: Dont return error when assigned-clocks is empty or missing

There is a chance that assigned-clock-rates is given and assigned-clocks
could be empty. Dont return error in that case, because the probe of the
corresponding driver will not be called at all if this fails.
Better to continue to look for it and return 0.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/a9a9d853e0ac396cd9b3577cce26279a75765711.1693384296.git.michal.simek@amd.com
15 months agoarm64: versal-net: Enable the config CMD_KASLRSEED
Venkatesh Yadav Abbarapu [Thu, 31 Aug 2023 03:16:58 +0000 (08:46 +0530)]
arm64: versal-net: Enable the config CMD_KASLRSEED

Kernel Address Space Layout Randomization (KASLR) is a hardening
feature that aims to make it more difficult to take advantage
of known exploits in the kernel, by placing kernel data
structures at a random address at each boot.The bootloader
supports randomizing the virtual address at which the kernel image
is loaded. The bootloader must provide entropy by passing a random
u64 value in the /chosen/kaslr-seed device tree node.
When we run "kaslrseed" command from U-Boot, the bootloader will
genarate the kaslr-seed and update the /chosen/kaslr-seed DT property.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20230831031658.2203-4-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
15 months agoarm64: versal-net: Enable sha1sum command
Venkatesh Yadav Abbarapu [Thu, 31 Aug 2023 03:16:57 +0000 (08:46 +0530)]
arm64: versal-net: Enable sha1sum command

Enable it for TPM usage.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20230831031658.2203-3-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
15 months agoarm64: versal-net: Enable TPM for xilinx platforms
Venkatesh Yadav Abbarapu [Thu, 31 Aug 2023 03:16:56 +0000 (08:46 +0530)]
arm64: versal-net: Enable TPM for xilinx platforms

TPMs are becoming popular that's why enable drivers and command for it.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20230831031658.2203-2-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
15 months agoarm64: versal: Enable the config CMD_KASLRSEED
Venkatesh Yadav Abbarapu [Thu, 31 Aug 2023 03:26:12 +0000 (08:56 +0530)]
arm64: versal: Enable the config CMD_KASLRSEED

Kernel Address Space Layout Randomization (KASLR) is a hardening
feature that aims to make it more difficult to take advantage
of known exploits in the kernel, by placing kernel data structures
at a random address at each boot.The bootloader supports randomizing
the virtual address at which the kernel image is loaded.
The bootloader must provide entropy by passing a random u64 value
in the /chosen/kaslr-seed device tree node.
When we run "kaslrseed" command from U-Boot, the bootloader will
genarate the kaslr-seed and update the /chosen/kaslr-seed DT property.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20230831032612.2729-4-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
15 months agoarm64: versal: Enable sha1sum command
Venkatesh Yadav Abbarapu [Thu, 31 Aug 2023 03:26:11 +0000 (08:56 +0530)]
arm64: versal: Enable sha1sum command

Enable it for TPM usage.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20230831032612.2729-3-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
15 months agoarm64: versal: Enable TPM for xilinx platforms
Venkatesh Yadav Abbarapu [Thu, 31 Aug 2023 03:26:10 +0000 (08:56 +0530)]
arm64: versal: Enable TPM for xilinx platforms

TPMs are becoming popular that's why enable drivers
and command for it.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20230831032612.2729-2-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
15 months agotest/py: tpm2: skip tpm2_startup when env__tpm_device_test_skip=True
Michal Simek [Wed, 30 Aug 2023 16:36:23 +0000 (18:36 +0200)]
test/py: tpm2: skip tpm2_startup when env__tpm_device_test_skip=True

All tpm2 tests should be possible to skip when
env__tpm_device_test_skip=True but test_tpm2_startup is missing it.

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/41f932e52bdd206b1b68d5ff313fc29b794a70e7.1693413381.git.michal.simek@amd.com
15 months agofpga: define dummy fpga_load function for debug build
Chanho Park [Thu, 31 Aug 2023 07:52:47 +0000 (16:52 +0900)]
fpga: define dummy fpga_load function for debug build

This fixes below build error when CC_OPTIMIZE_FOR_DEBUG is enabled and
CONFIG_FPGA or CONFIG_SPL_FPGA are not enabled.
When CC_OPTIMIZE_FOR_DEBUG is enabled, unused code will not be optimized
out. Hence, fpga_load function must have a dummy implementation to avoid
the build error.

../common/spl/spl_fit.c:591: undefined reference to `fpga_load'
collect2: error: ld returned 1 exit status

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
Link: https://lore.kernel.org/r/20230831075247.137501-1-chanho61.park@samsung.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
15 months agopinctrl: zynqmp: Add support for output-enable and bias-high-impedance
Ashok Reddy Soma [Fri, 11 Aug 2023 05:48:29 +0000 (23:48 -0600)]
pinctrl: zynqmp: Add support for output-enable and bias-high-impedance

Add support to handle 'output-enable' and 'bias-high-impedance'
configurations in pinctrl driver.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20230811054829.13162-4-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
15 months agopinctrl: zynqmp: Add version check for TRISTATE configuration
Ashok Reddy Soma [Fri, 11 Aug 2023 05:48:28 +0000 (23:48 -0600)]
pinctrl: zynqmp: Add version check for TRISTATE configuration

Support for configuring TRISTATE parameter is added in ZYNQMP PMUFW(Xilinx
ZynqMP Platform Management Firmware) Configuration Param Set version 2.0.
If the requested configuration is TRISTATE then check the version before
requesting Xilinx firmware to set the configuration.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20230811054829.13162-3-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
15 months agofirmware: zynqmp: Add support to check feature
Ashok Reddy Soma [Fri, 11 Aug 2023 05:48:27 +0000 (23:48 -0600)]
firmware: zynqmp: Add support to check feature

Add firmware API to check if given feature is supported.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20230811054829.13162-2-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
15 months agodm: core: support reading a single indexed u64 value
Michal Simek [Fri, 25 Aug 2023 09:37:46 +0000 (11:37 +0200)]
dm: core: support reading a single indexed u64 value

Add helper function to allow reading a single indexed u64 value from a
device-tree property containing multiple u64 values, that is an array of
u64's.

Co-developed-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/08043c8d204d0068f04c27de86afe78c75c50b69.1692956263.git.michal.simek@amd.com
15 months agoarm64: zynqmp: Add support for K26 rev2 boards
Michal Simek [Fri, 25 Aug 2023 08:10:07 +0000 (10:10 +0200)]
arm64: zynqmp: Add support for K26 rev2 boards

Revision 2 is SW compatible with revision 1 but it is necessary to reflect
it in model and compatible properties which are parsed by user space.
Rev 2 has improved a power on boot reset and MIO34 shutdown glich
improvement done via an additional filter in the GreenPak chip.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/6b9e68ebfb436da391daeb147f2a9985ac984c0c.1692951005.git.michal.simek@amd.com
15 months agoarm64: zynqmp: Setup default si570 frequency to 156.25MHz
Michal Simek [Fri, 25 Aug 2023 07:11:29 +0000 (09:11 +0200)]
arm64: zynqmp: Setup default si570 frequency to 156.25MHz

All si570 mgt chips have factory default 156.25MHz but DT changed it to
148.5MHz. After tracking it is pretty much c&p fault taken from Zynq
zc702/zc706 boards where 148.5MHz was setup as default because it was
requirement for AD7511 chip available on these boards.
ZynqMP board don't contain this chip that's why factory default frequency
can be used.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/c052ddf39e392e97f87f1c57ea06f3508733c672.1692947486.git.michal.simek@amd.com
15 months agodrivers/mtd/spi/spi-nor-ids.c: add mx25u25635f support
Neal Frager [Mon, 21 Aug 2023 12:45:02 +0000 (13:45 +0100)]
drivers/mtd/spi/spi-nor-ids.c: add mx25u25635f support

This patch adds support for the MX25U25635F QSPI Flash Memory.

Signed-off-by: Neal Frager <neal.frager@amd.com>
Link: https://lore.kernel.org/r/20230821124502.3308208-1-neal.frager@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
15 months agoarm64: zynqmp: Enable the config CMD_KASLRSEED
Venkatesh Yadav Abbarapu [Thu, 24 Aug 2023 03:27:12 +0000 (08:57 +0530)]
arm64: zynqmp: Enable the config CMD_KASLRSEED

Kernel Address Space Layout Randomization (KASLR) is a hardening
feature that aims to make it more difficult to take advantage
of known exploits in the kernel, by placing kernel data structures
at a random address at each boot.The bootloader supports randomizing
the virtual address at which the kernel image is loaded.
The bootloader must provide entropy by passing a random u64 value
in the /chosen/kaslr-seed device tree node.
When we run "kaslrseed" command from U-Boot, the bootloader will
genarate the kaslr-seed and update the /chosen/kaslr-seed DT property.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20230824032712.13399-1-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
15 months agoxilinx: Remove scriptaddr from config files and move it to DT
Michal Simek [Thu, 3 Aug 2023 12:51:53 +0000 (14:51 +0200)]
xilinx: Remove scriptaddr from config files and move it to DT

Define bootscript address in RAM via DT property and remove it from config
file. Adding default value to common DTSI. Platform DT description can
remove this property or rewrite it.

In Zynq case scriptaddr property was defined twice for no reason.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/d36ffeb00ed8f0ca4bb67d4983d1852d01ade637.1691067102.git.michal.simek@amd.com
15 months agoarm64: versal: Increase the number of DRAM banks to 36
Venkatesh Yadav Abbarapu [Wed, 2 Aug 2023 06:35:05 +0000 (08:35 +0200)]
arm64: versal: Increase the number of DRAM banks to 36

HBM stands for high bandwidth memory and is a type of memory interface used
in 3D-stacked DRAM (dynamic random access memory) in some AMD GPUs (aka
graphics cards), as well as the server, high-performance computing (HPC)
and networking and client space. High Bandwidth Memory(HBM) has total 16
channels, one channel is divided into two pseudo channels which makes its
32 banks each with some amount of memory.
And then we have DDR_LOW PS low, DDR_HIGH0 PS high, DDR_HIGH1 PS very high
and pretty much there should be also place for PL DDR. So maximum number of
memory banks will be 36, updating the CONFIG_NR_DRAM_BANKS to 36.

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/ed9eaf5c20501ee691d7d28a173511cd9a87f161.1690958095.git.michal.simek@amd.com
15 months agoxilinx: zynqmp: Extract aes operation into new file
Christian Taedcke [Tue, 25 Jul 2023 07:26:58 +0000 (09:26 +0200)]
xilinx: zynqmp: Extract aes operation into new file

This moves the aes operation that is performed by the pmu into a
separate file. This way it can be called not just from the shell
command, but also e.g. from board initialization code.

Signed-off-by: Christian Taedcke <christian.taedcke@weidmueller.com>
Link: https://lore.kernel.org/r/20230725072658.16341-1-christian.taedcke-oss@weidmueller.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
15 months agoriscv: dts: starfive: generate u-boot-spl.bin.normal.out
Heinrich Schuchardt [Sun, 17 Sep 2023 11:47:31 +0000 (13:47 +0200)]
riscv: dts: starfive: generate u-boot-spl.bin.normal.out

The StarFive VisionFive 2 board cannot load spl/u-boot-spl.bin but needs a
prefixed header. We have referring to a vendor tool (spl_tool) for this
task. 'mkimage -T sfspl' can generate the prefixed file.

Use binman to invoke mkimage for the generation of file
spl/u-boot-spl.bin.normal.out.

Update the documentation.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Tested-by: Milan P. Stanić <mps@arvanta.net>
15 months agotools: mkimage: Add StarFive SPL image support
Heinrich Schuchardt [Sun, 17 Sep 2023 11:47:30 +0000 (13:47 +0200)]
tools: mkimage: Add StarFive SPL image support

The StarFive JH7110 base boards require a header to be prefixed to the SPL
binary image. This has previously done with a vendor tool 'spl_tool'
published under a GPL-2-or-later license. Integrate this capability into
mkimage.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Tested-by: Chanho Park <chanho61.park@samsung.com>
Tested-by: Milan P. Stanić <mps@arvanta.net>
15 months agostarfive: visionfive2: add mmc0 and nvme boot targets
Milan P. Stanić [Mon, 18 Sep 2023 08:32:29 +0000 (10:32 +0200)]
starfive: visionfive2: add mmc0 and nvme boot targets

boot from SDIO3.0 (mmc sdcard) first if it is plugged.
If mmc is not plugged try to boot from emmc if it is plugged.
If emmc is not plugged then try to boot from nvme.

Signed-off-by: Milan P. Stanić <mps@arvanta.net>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
15 months agoconfigs: NVMe/USB target boot devices on VisionFive 2
Heinrich Schuchardt [Thu, 7 Sep 2023 13:53:36 +0000 (15:53 +0200)]
configs: NVMe/USB target boot devices on VisionFive 2

Make NVMe and USB target boot devices on the StarFive VisionFive 2 board.
The boot devices are sorted by decreasing device speed.

CONFIG_PCI_INIT_R=y is set via [1]. 'start usb' is added to CONFIG_PREBOOT
by the same patch.

[1] [PATCH v1 1/2] configs: starfive: Enable PCIE auto enum and NVME/USB stuff for Starfive Visionfive 2
    https://lore.kernel.org/u-boot/TY3P286MB2611C9AD6E5BB3756A959E89981FA@TY3P286MB2611.JPNP286.PROD.OUTLOOK.COM/

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
15 months agoriscv: set fdtfile on VisionFive 2
Heinrich Schuchardt [Thu, 7 Sep 2023 11:21:28 +0000 (13:21 +0200)]
riscv: set fdtfile on VisionFive 2

Multiple revisions of the StarFive VisionFive 2 board exist. They can be
identified by reading their EEPROM.

Linux uses two differently named device-tree files. To load the correct
device-tree we need to set $fdtfile to the device-tree file name that
matches the board revision.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
15 months agoMerge branch '2023-09-19-tidy-up-some-kconfig-options' into next
Tom Rini [Tue, 19 Sep 2023 21:44:18 +0000 (17:44 -0400)]
Merge branch '2023-09-19-tidy-up-some-kconfig-options' into next

- Re-organize and tidy up some of our Kconfig options

15 months agoboot: Join ARCH_FIXUP_FDT_MEMORY with related options
Simon Glass [Thu, 14 Sep 2023 16:55:59 +0000 (10:55 -0600)]
boot: Join ARCH_FIXUP_FDT_MEMORY with related options

Move this to be with the other devicetree-fixup options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
15 months agoboot: Drop CMD_MTDPARTS condition for FDT_FIXUP_PARTITIONS
Simon Glass [Thu, 14 Sep 2023 16:55:58 +0000 (10:55 -0600)]
boot: Drop CMD_MTDPARTS condition for FDT_FIXUP_PARTITIONS

This is not needed, so drop it. Also use a capital 'O' for the option,
while we are here.

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