platform/kernel/u-boot.git
2 years agosunxi: use boot source for determining environment location
Andre Przywara [Tue, 11 Jan 2022 12:46:04 +0000 (12:46 +0000)]
sunxi: use boot source for determining environment location

Currently we only support to load the environment from raw MMC or FAT
locations on Allwinner boards. With the advent of SPI flash we probably
also want to support using the environment there, so we need to become
a bit more flexible.

Change the environment priority function to take the boot source into
account. When booted from eMMC or SD card, we use FAT or MMC, if
configured, as before.
If we are booted from SPI flash, we try to use the environment from
there, if possible. The same is true for NAND flash booting, although
this is somewhat theoretical right now (as untested).

This way we can use the same image for SD and SPI flash booting, which
allows us to simply copy a booted image from SD card to the SPI flash,
for instance.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2 years agoenv: sunxi: Define location in SPI flash
Andre Przywara [Tue, 11 Jan 2022 12:46:03 +0000 (12:46 +0000)]
env: sunxi: Define location in SPI flash

To allow loading and storing the environment from SPI flash, adjust the
raw offset variables for Allwinner boards to make sense there.

U-Boot (including SPL and other blobs) is loaded from the beginning of
SPI flash, so move the environment location as far back as possible, to
not create unnecessary limits. As those offsets are shared with (now
mostly unused) raw MMC environment, we should respect the common one
megabyte limit, which also makes sense on SPI flash.

So limit the environment for those raw locations to 64KB, and place it
just below 1MB (@960KB).

Those values are currently unused, unless someone forcibly enables the
raw MMC environment. In this case it would break as of now, as the
current offset of 544KB is far too low for the current (arm64) U-Boot
proper.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2 years agosunxi: Kconfig: Fix up SPI configuration
Andre Przywara [Tue, 11 Jan 2022 12:46:02 +0000 (12:46 +0000)]
sunxi: Kconfig: Fix up SPI configuration

Commit 7945caf22c44 ("arm: sunxi: Enable SPI/SPI-FLASH support for A64")
selected CONFIG_SPI by default on all Allwinner A64 boards, even though
only 4 out of the 14 A64 boards have a SPI flash chip. All other SoCs
had to manually select DM_SPI and friends, even though they are a
platform property (the sunxi SPI driver is DM_SPI only).

Clean this up to allow easy selection of SPI flash support in U-Boot
proper, by selecting DM_SPI and DM_SPI_FLASH *if* CONFIG_SPI is
selected, for *all* Allwinner SoCs. This simplifies the defconfig for
two Libretech boards already.

Also remove the forced CONFIG_SPI from the A64 Kconfig, instead let the
four boards which allow SPI booting select this explicitly.

Any board wishing to support SPI flash in U-Boot proper now just defines
CONFIG_SPI and CONFIG_SPI_FLASH_<vendor> in its defconfig, Kconfig takes
care of the rest.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2 years agodriver: spi: add bcm iproc qspi support
Rayagonda Kokatanur [Wed, 9 Feb 2022 22:16:13 +0000 (14:16 -0800)]
driver: spi: add bcm iproc qspi support

IPROC qspi driver supports both BSPI and MSPI modes.

Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
Signed-off-by: Bharat Gooty <bharat.gooty@broadcom.com>
Acked-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
Signed-off-by: Roman Bacik <roman.bacik@broadcom.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2 years agospi: dw: Fix broken dw_spi_mem_ops()
Niklas Cassel [Tue, 8 Feb 2022 22:52:43 +0000 (22:52 +0000)]
spi: dw: Fix broken dw_spi_mem_ops()

The driver is currently using sizeof(op->cmd.opcode) in the op_len
calculation. Commit d15de623013c ("spi: spi-mem: allow specifying a
command's extension") changed op->cmd.opcode from one byte to two.

Instead, a new struct member op->cmd.nbytes is supposed to be used.
For regular commands op->cmd.nbytes will be one.

Commit d15de623013c ("spi: spi-mem: allow specifying a command's
extension") did update some drivers that overload the generic mem_ops()
implementation, but forgot to update dw_spi_mem_ops().

Calculating op_len incorrectly causes dw_spi_mem_ops() to misbehave, since
op_len is used to determine how many bytes that should be read/written.

On the canaan k210 board, this causes the probe of the SPI flash to fail.

Fix the op_len calculation in dw_spi_mem_ops(). Doing so results in
working SPI flash on the canaan k210 board.

Fixes: d15de623013c ("spi: spi-mem: allow specifying a command's extension")
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2 years agospi: cadence-qspi: Make reset control optional
Christian Gmeiner [Tue, 22 Feb 2022 16:23:25 +0000 (17:23 +0100)]
spi: cadence-qspi: Make reset control optional

In the TI am65 device tree files there is no reset defined. Also
the Linux kernel driver uses devm_reset_control_get_optional_exclusive(..)
to get the reset.

Lets do the same as the kernel does and make thr reset optinal.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Wed, 23 Feb 2022 18:34:14 +0000 (13:34 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-usb

- OMAP EHCI updates

2 years agoMerge tag 'dm-pull-22222' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Wed, 23 Feb 2022 17:28:54 +0000 (12:28 -0500)]
Merge tag 'dm-pull-22222' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm

binman fixes/improvements to FIT generator
binman SPL fixes
moveconfig support regex matches

2 years agoconfigs: omap various: Remove OMAP_EHCI_PHY from defconfigs
Adam Ford [Sat, 19 Feb 2022 23:08:47 +0000 (17:08 -0600)]
configs: omap various: Remove OMAP_EHCI_PHY from defconfigs

With the Kconfig options being deleted, the references to
OMAP_EHCI_PHY are useless.  Remove them from the various
defconfigs.

Signed-off-by: Adam Ford <aford173@gmail.com>
2 years agousb: ehci-omap: Remove OMAP_EHCI_PHYx_RESET_GPIO from Kconfig
Adam Ford [Sat, 19 Feb 2022 23:08:46 +0000 (17:08 -0600)]
usb: ehci-omap: Remove OMAP_EHCI_PHYx_RESET_GPIO from Kconfig

With the omap-ehci driver now using the phy subsystem to enable
and disable reset, the driver no longer needs to know which
GPIO's are used, and they can be removed from Kconfig.

Signed-off-by: Adam Ford <aford173@gmail.com>
2 years agousb: ehci-omap: Use PHY system to manage phy resets
Adam Ford [Sat, 19 Feb 2022 23:08:45 +0000 (17:08 -0600)]
usb: ehci-omap: Use PHY system to manage phy resets

There are a few boards that use hard-coded GPIO definitions in
their respective defconfig files.  If the GPIO's are listed
in their device trees, the nop-phy can toggle the GPIO's,
so the EHCI driver does not need to know anything about the
GPIO's. Add functions for getting the phys and remove the GPIO
toggles since the phy will now do that.

Signed-off-by: Adam Ford <aford173@gmail.com>
2 years agousb: ehci-omap: Make Kconfig select PHY if USB_EHCI_OMAP
Adam Ford [Sat, 19 Feb 2022 23:08:44 +0000 (17:08 -0600)]
usb: ehci-omap: Make Kconfig select PHY if USB_EHCI_OMAP

The USB_EHCI_OMAP driver currently has a series of Kconfig options
which let users specify a GPIO for the reset pin.  Some devices
may have only one reset, while others might have more.

Since there is a nop phy driver, let's selct enable the PHY
system, and imply the nop phy driver.  The nop phy driver can now
toggle the reset pins when putting the phy in and out of reset.

If the gpio is listed under the phy, it will get toggled and
the hard-coded config options specifying the GPIO numbers can
eventually go away.

Signed-off-by: Adam Ford <aford173@gmail.com>
2 years agophy: nop-phy: Fix enabling reset
Adam Ford [Sat, 19 Feb 2022 23:08:43 +0000 (17:08 -0600)]
phy: nop-phy: Fix enabling reset

The reset function should place the phy into reset, while the
init function should take the phy out of reset.  Currently the
reset function takes it out of reset, and the init calls the
reset.

Signed-off-by: Adam Ford <aford173@gmail.com>
2 years agousb: ehci-omap: Move omap_ehci_hcd_init to omap_ehci_probe
Adam Ford [Sat, 19 Feb 2022 23:08:42 +0000 (17:08 -0600)]
usb: ehci-omap: Move omap_ehci_hcd_init to omap_ehci_probe

The OMAP3 hierarchy has the ehci node as a sub-node of the
usbhshost. The usbhshost node contains an ohci and an ehci
subnode.  The configuration of the ehci belongs in the
EHCI node and not its parent.  Move it to the proper probe.

usb start
  starting USB...
  Bus ehci@48064800: USB EHCI 1.00
  Bus usb_otg_hs@480ab000: Port not available.
  scanning bus ehci@48064800 for devices... 3 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found

Signed-off-by: Adam Ford <aford173@gmail.com>
2 years agousb: ehci-omap: Drop dead code
Adam Ford [Sat, 19 Feb 2022 23:08:41 +0000 (17:08 -0600)]
usb: ehci-omap: Drop dead code

omap_ehci_hcd_stop appears to be dead code, and omap_ehci_hcd_init
is only called by the probe function, so it can be static to that
function.  Remove both from the header along with some additional
checking for DM_USB.

Signed-off-by: Adam Ford <aford173@gmail.com>
2 years agoscripts: dtc: libfdt: fdt_ro.c: always define fdt_check_full
Philippe Reynes [Wed, 9 Feb 2022 17:01:24 +0000 (18:01 +0100)]
scripts: dtc: libfdt: fdt_ro.c: always define fdt_check_full

On some configs (like stm32mp15_dhcom_basic_defconfig), if configs
SPL_LOAD_FIT_FULL and SPL_FIT_FULL_CHECK are enabled. Then the compilatio
fails with the following error:

arm-linux-gnueabi-ld.bfd: boot/image-fit.o: in function `fit_check_format':
<PATH>/uboot/u-boot-stm/boot/image-fit.c:1641: undefined reference to `fdt_check_full'
scripts/Makefile.spl:509: recipe for target 'spl/u-boot-spl' failed

This issue happens because the function fdt_check_full is only defined if
"!defined(FDT_ASSUME_MASK) || FDT_ASSUME_MASK != 0xff". But this function
may be called even if this condition are not verified. To avoid this issue,
the function fdt_check_full is always defined.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agophy: phy-uclass: check the parents for phys
Angus Ainslie [Thu, 3 Feb 2022 18:08:38 +0000 (10:08 -0800)]
phy: phy-uclass: check the parents for phys

The port/hub leaf nodes don't contain the phy definitions in some dts
files so check the parents.

Signed-off-by: Angus Ainslie <angus@akkea.ca>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Allow different operations in FIT generator nodes
Simon Glass [Tue, 8 Feb 2022 18:50:03 +0000 (11:50 -0700)]
binman: Allow different operations in FIT generator nodes

At present we only support expanding out FDT nodes. Make the operation
into an @operation property, so that others can be supported.

Re-arrange and tidy up the documentation so that it has separate
headings for each topic.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Tidy up the docs a little with fit
Simon Glass [Tue, 8 Feb 2022 18:50:02 +0000 (11:50 -0700)]
binman: Tidy up the docs a little with fit

Add a few quotes and clarify the data property.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: fit: Refactor to reduce function size
Simon Glass [Tue, 8 Feb 2022 18:50:01 +0000 (11:50 -0700)]
binman: fit: Refactor to reduce function size

Split subnode and property processing into separate functions to make
the _AddNode() function a little smaller. Tweak a few comments.

This does not change any functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Move entry-data collection into a Entry method
Simon Glass [Tue, 8 Feb 2022 18:50:00 +0000 (11:50 -0700)]
binman: Move entry-data collection into a Entry method

Collecting the data from a list of entries and putting it in a file is
a useful operation that will be needed by other entry types. Put this into
a method in the Entry class.

Add some documentation about how to collect data for an entry type.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Add a ELF test file with disjoint text sections
Simon Glass [Tue, 8 Feb 2022 18:49:59 +0000 (11:49 -0700)]
binman: Add a ELF test file with disjoint text sections

Add a file that has two text sections at different addresses, so we can
test this behaviour in binman, once added.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Support a list of strings with the mkimage etype
Simon Glass [Tue, 8 Feb 2022 18:49:58 +0000 (11:49 -0700)]
binman: Support a list of strings with the mkimage etype

At present the 'args' property of the mkimage entry type is a string. This
makes it difficult to include CONFIG options in that property. In
particular, this does not work:

   args = "-n CONFIG_SYS_SOC -E"

since the preprocessor does not operate within strings, nor does this:

   args = "-n" CONFIG_SYS_SOC" "-E"

since the device tree compiler does not understand string concatenation.

With this new feature, we can do:

   args = "-n", CONFIG_SYS_SOC, "-E";

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Add to the TODO
Simon Glass [Tue, 8 Feb 2022 18:49:57 +0000 (11:49 -0700)]
binman: Add to the TODO

Add some ideas that have come to mind recently.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Add support for TEE BL32
Roger Quadros [Sat, 19 Feb 2022 18:50:04 +0000 (20:50 +0200)]
binman: Add support for TEE BL32

Add an entry for OP-TEE Trusted OS 'BL32' payload.
This is required by platforms using Cortex-A cores with TrustZone
technology.

Signed-off-by: Roger Quadros <rogerq@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Add missing-blob-help, renumber the test file, update entry-docs:
Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoelf: Add a way to read segment information from an ELF file
Simon Glass [Tue, 8 Feb 2022 18:49:55 +0000 (11:49 -0700)]
elf: Add a way to read segment information from an ELF file

Add a function which reads the segments and the entry address.

Also fix a comment nit in the tests while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Update docs to indicate mkimage is supported
Simon Glass [Tue, 8 Feb 2022 18:49:54 +0000 (11:49 -0700)]
binman: Update docs to indicate mkimage is supported

Now that there is a mkimage entry-type, update the docs to remove the
future reference.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agodtoc: Support reading a list of arguments
Simon Glass [Tue, 8 Feb 2022 18:49:53 +0000 (11:49 -0700)]
dtoc: Support reading a list of arguments

It is helpful to support a string or stringlist containing a list of
space-separated arguments, for example:

   args = "-n fred", "-a", "123";

This resolves to the list:

   -n fred -a 123

which can be passed to a program as arguments.

Add a helper to do the required processing.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agodtoc: Allow deleting nodes and adding them in the same sync
Simon Glass [Tue, 8 Feb 2022 18:49:52 +0000 (11:49 -0700)]
dtoc: Allow deleting nodes and adding them in the same sync

This does not work at present, since the current algorithm assumes that
either there are no nodes or all nodes have an offset. If a node is new,
but an old node is still in the tree, then syncing fails due to this
assumption.

Fix it and add a test.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agodtoc: Support deleting a node
Simon Glass [Tue, 8 Feb 2022 18:49:51 +0000 (11:49 -0700)]
dtoc: Support deleting a node

Add a function to delete a node. This is synced to the tree when
requested.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agodtoc: Support adding a string list to a device tree
Simon Glass [Tue, 8 Feb 2022 18:49:50 +0000 (11:49 -0700)]
dtoc: Support adding a string list to a device tree

Add a new function to add a string list.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agospl: Allow disabling binman symbols in SPL
Simon Glass [Tue, 8 Feb 2022 18:49:48 +0000 (11:49 -0700)]
spl: Allow disabling binman symbols in SPL

When CONFIG_SPL_FIT is enabled we do not access U-Boot directly in
the image, since it is embedded in a FIT which is parsed at runtime.

Provide a CONFIG option to drop the symbols in this case.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agospl: x86: Correct the binman symbols for SPL
Simon Glass [Tue, 8 Feb 2022 18:49:47 +0000 (11:49 -0700)]
spl: x86: Correct the binman symbols for SPL

These symbols are incorrect, meaning that binman cannot find the
associated entry. This leads to errors like:

binman: Section '/binman/simple-bin': Symbol '_binman_spl_prop_size'
   in entry '/binman/simple-bin/u-boot-spl/u-boot-spl-nodtb':
   Entry 'spl' not found in list (mkimage,u-boot-spl-nodtb,
   u-boot-spl-bss-pad,u-boot-spl-dtb,u-boot-spl,u-boot-img,main-section)

Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agomoveconfig: Allow regex matches when finding combinations
Simon Glass [Tue, 8 Feb 2022 18:49:46 +0000 (11:49 -0700)]
moveconfig: Allow regex matches when finding combinations

It is useful to be able to search for CONFIG options that match a regex,
such as this, which lists boards which define SPL_FIT_GENERATOR and
anything not starting with ROCKCHIP:

   ./tools/moveconfig.py -f SPL_FIT_GENERATOR ~ROCKCHIP.*

Add support for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agomoveconfig: Show the config name rather than the defconfig
Simon Glass [Tue, 8 Feb 2022 18:49:45 +0000 (11:49 -0700)]
moveconfig: Show the config name rather than the defconfig

The _defconfig suffix is unnecessary when showing matching boards. Drop
it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Correct the error message for a bad hash algorithm
Simon Glass [Tue, 8 Feb 2022 17:59:44 +0000 (10:59 -0700)]
binman: Correct the error message for a bad hash algorithm

This shows an internal type at present, rather than the algorithm name.
Fix it and update the test to catch this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2 years agobinman: Update image positions of FIT subentries
Alper Nebi Yasak [Mon, 7 Feb 2022 22:08:08 +0000 (01:08 +0300)]
binman: Update image positions of FIT subentries

Binman keeps track of positions of each entry in the final image, but
currently this data is wrong for things included in FIT entries,
especially since a previous patch makes FIT a subclass of Section and
inherit its implementation.

There are three ways to put data into a FIT image. It can be directly
included as a "data" property, or it can be external to the FIT image
represented by an offset-size pair of properties. This external offset
is either "data-position" from the start of the FIT or "data-offset"
from the end of the FIT, and the size is "data-size" for both. However,
binman doesn't use the "data-offset" method while building FIT entries.

According to the Section docstring, its subclasses should calculate and
set the correct offsets and sizes in SetImagePos() method. Do this for
FIT subentries for the three ways mentioned above, and add tests for the
two ways binman can pack them in.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Skip processing "hash" subnodes of FIT subsections
Alper Nebi Yasak [Wed, 9 Feb 2022 19:02:35 +0000 (22:02 +0300)]
binman: Skip processing "hash" subnodes of FIT subsections

Binman's FIT entry type can have image subentries with "hash" subnodes
intended to be processed by mkimage, but not binman. However, the Entry
class and any subclass that reuses its implementation tries to process
these unconditionally. This can lead to an error when boards specify
hash algorithms that binman doesn't support, but mkimage supports.

Let entries skip processing these "hash" subnodes based on an instance
variable, and set this instance variable for FIT subsections. Also
re-enable processing of calculated and missing properties of FIT entries
which was disabled to mitigate this issue.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoMerge branch '2022-02-21-platform-updates'
Tom Rini [Mon, 21 Feb 2022 13:53:24 +0000 (08:53 -0500)]
Merge branch '2022-02-21-platform-updates'

- Assorted updates / fixes for Apple, TI and Aspeed platforms

2 years agoti: i2c: fix probe_chip() return value
Nikita Yushchenko [Tue, 15 Feb 2022 18:10:09 +0000 (21:10 +0300)]
ti: i2c: fix probe_chip() return value

Per documentation, dm_i2c_ops.probe_chip() shall return -EREMOTEIO if
probe fails.

Currently, omap_i2c_probe_chip() returns 1 instead. Fix that.

Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
2 years agocrypto: aspeed: fix polling RSA status wrong issue
Neal Liu [Tue, 15 Feb 2022 10:14:40 +0000 (18:14 +0800)]
crypto: aspeed: fix polling RSA status wrong issue

Check interrupt status to see if RSA engine is completed. After completion
of the task, write-clear the status to finish operation.
Add missing register base for completion.

Fixes: 89c36cca0b6 ("crypto: aspeed: Add AST2600 ACRY support")
Signed-off-by: Neal Liu <neal_liu@aspeedtech.com>
Reviewed-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
2 years agoarm: dts: k3-j7200: Fix up MAIN R5FSS cluster mode back to Split-mode
Suman Anna [Sun, 13 Feb 2022 18:48:48 +0000 (12:48 -0600)]
arm: dts: k3-j7200: Fix up MAIN R5FSS cluster mode back to Split-mode

The default U-Boot environment variables and design are all set up for
the MAIN R5FSS cluster to be in Split-mode. This is the setting used
when the dts nodes were originally added in v2021.01 U-Boot and the
dt nodes are synched with the kernel binding property names in
commit 468ec2f3ef8f ("remoteproc: k3_r5: Sync to upstreamed kernel DT
property names") merged in v2021.04-rc2.

The modes for the MAIN R5FSS cluster got switched back to LockStep mode
by mistake in commit fa09b12dc5f6 ("arm: ti: k3: Resync dts files and
bindings with Linux Kernel v5.14") in v2022.01-rc1. This throws the
following warning messages when early-booting the cores using default
env variables,

k3_r5f_rproc r5f@5d00000: Invalid op: Trying to start secondary core 7 in lockstep mode
Load Remote Processor 3 with data@addr=0x82000000 83148 bytes: Failed!

Fix this by switching back both the clusters to the expected Split-mode.
Make this mode change in the u-boot specific dtsi file to avoid such
sync overrides in the future until the kernel dts is also switched to
Split-mode by default.

Fixes: fa09b12dc5f6 ("arm: ti: k3: Resync dts files and bindings with Linux Kernel v5.14")
Signed-off-by: Suman Anna <s-anna@ti.com>
2 years agoarm: omap3: Make some memory functions static and clean headers
Adam Ford [Sat, 12 Feb 2022 12:12:41 +0000 (06:12 -0600)]
arm: omap3: Make some memory functions static and clean headers

There are a few memory functions for both the emif4 (AM3517)
and sdrc (OMAP35/DM37) code that can be defined as static,
because those functions are not used externally. Make them
static and clean up some of the corresponding headers.

Signed-off-by: Adam Ford <aford173@gmail.com>
2 years agoarm: omap3: Cleanup sys_info to fit OMAP3 booting with LTO
Adam Ford [Sat, 12 Feb 2022 12:12:40 +0000 (06:12 -0600)]
arm: omap3: Cleanup sys_info to fit OMAP3 booting with LTO

With LTO enabled, some functions appear to be optimized in a
way that causes hanging on some OMAP3 boards after some
unrelated patches were applied.  The solution appears to make
several functions __used.  There also appears be to be some
dead code, so remove it while cleaning this up.

This has been tested on a general purpose OMAP3530, DM3730,
and AM3517.

Signed-off-by: Adam Ford <aford173@gmail.com>
2 years agoarm: dts: k3-j721e-r5-common-proc-board: tps659413: Correct the min/max voltages...
Keerthy [Thu, 10 Feb 2022 03:55:58 +0000 (09:25 +0530)]
arm: dts: k3-j721e-r5-common-proc-board: tps659413: Correct the min/max voltages of VDD_CPU

Correct the min/max voltages of VDD_CPU. As per data sheet the VDD_CPU
minimum voltage is .6V & maximum voltage is .9V.

Correct the same. While at it fix the comment to reflect VDD_CPU
instead of VDD_MPU.

Link: https://www.ti.com/lit/gpn/dra829v
Signed-off-by: Keerthy <j-keerthy@ti.com>
2 years agoiommu: Add M1 Pro/Max support to Apple DART driver
Janne Grunau [Tue, 8 Feb 2022 21:27:49 +0000 (22:27 +0100)]
iommu: Add M1 Pro/Max support to Apple DART driver

For the purpose of this driver (activating bypass mode) t6000-dart
and t8103-dart are fully compatible.

Signed-off-by: Janne Grunau <j@jannau.net>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
2 years agodoc: board: apple: Update Apple M1 documentation
Mark Kettenis [Mon, 14 Feb 2022 21:09:26 +0000 (22:09 +0100)]
doc: board: apple: Update Apple M1 documentation

U-Boot now supports NVMe storage and on the laptop models, the
SPI keyboard.  Since we now disable the debug console by default
provide instructions on how the enable the debug console including
a table listing the appropriate UART base address for each of the
supported SoCs.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
2 years agoarm: apple: Disable debug UART
Mark Kettenis [Mon, 14 Feb 2022 21:09:25 +0000 (22:09 +0100)]
arm: apple: Disable debug UART

The address of the debug UART varies differs between the M1 and
the M1 Pro/Max SoCs.  So we have to disable it to make a single
U-Boot binary that works on all SoC generations.  Leave the
settings for the base address and clock rate of the M1 in place
to make it easier to re-enable the debug UART when needed.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
2 years agoarm: apple: Add M1 Pro/Max support
Mark Kettenis [Tue, 8 Feb 2022 21:00:09 +0000 (22:00 +0100)]
arm: apple: Add M1 Pro/Max support

Choose the memory map based on the compatible property from the
device tree passed to us by m1n1. Since DRAM on the M1 Pro/Max
starts at a different address avoid hardcoding the top of usable
memory. Also make sure that the addresses entered into the memory
map are page aligned such that we don't crash in dcache_enable().

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Tested on: Macbook M1 Max
Tested-by: Janne Grunau <j@jannau.net>
2 years agoMerge tag 'xilinx-for-v2022.04-rc3' of https://gitlab.denx.de/u-boot/custodians/u...
Tom Rini [Mon, 21 Feb 2022 13:32:02 +0000 (08:32 -0500)]
Merge tag 'xilinx-for-v2022.04-rc3' of https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze

Xilinx changes for v2022.04-rc3

microblaze:
- Fix exception handler

zynqmp:
- Show information about secure images
- DT changes (som u-boot file removal)
- Fix zynqmp_pm_cfg_obj_convert.py
- Fix platform boot

xilinx:
- Fix bootm_size calculation
- Remove GPIO_EXTRA_HEADER selection

power:
- Add zynqmp power management driver

scsi:
- Add phy support to ceva driver

zynq qspi:
- Fix unaligned accesses and check baudrate setup
- Add support for spi memory operations

net:
- Fix 64bit calculation in axi_emac

video:
- Add missing gpio dependency for seps driver

2 years agoarm64: zynqmp: Remove additional gpio header from dlc21
Michal Simek [Tue, 15 Feb 2022 07:57:52 +0000 (08:57 +0100)]
arm64: zynqmp: Remove additional gpio header from dlc21

This header shouldn't be in this file and there is already pointer to
dt-bindings/gpio/gpio.h.

Fixes: d2d14383bae4 ("arm64: zynqmp: Add support for DLC21 (Smartlynq+) board")
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/266bc91073f1149f3f60b1c9c0ba509c48470e2e.1644911870.git.michal.simek@xilinx.com
2 years agoarm64: zynqmp: Fix debug uart initialization
Michal Simek [Thu, 17 Feb 2022 13:28:42 +0000 (14:28 +0100)]
arm64: zynqmp: Fix debug uart initialization

The commit 0dba45864b2a ("arm: Init the debug UART") calls
debug_uart_init() from crt0.S but it won't work because SOC is not
configured yet. That's why create board_debug_uart_init() which calls
psu_init() via new psu_uboot_init() earlier before the first access to UART
in SPL. In full U-Boot call psu_uboot_init() only when
CONFIG_ZYNQMP_PSU_INIT_ENABLED is enabled.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/878dc2daaa8685346f889989fbfb98b2e44da7fb.1645104518.git.michal.simek@xilinx.com
2 years agoARM: zynq: Fix debug uart initialization
Michal Simek [Thu, 17 Feb 2022 13:28:41 +0000 (14:28 +0100)]
ARM: zynq: Fix debug uart initialization

The commit 0dba45864b2a ("arm: Init the debug UART") calls
debug_uart_init() from crt0.S but it won't work because SOC is not
configured yet. That's why create board_debug_uart_init() which calls
ps7_init() earlier before the first access to UART.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/18e67e02a0c7190839a1ef3a11f3fd6babcf34cc.1645104518.git.michal.simek@xilinx.com
2 years agoarm64: zynqmp: Fix dependencies around ZYNQMP_PSU_INIT_ENABLED
Michal Simek [Thu, 17 Feb 2022 13:28:40 +0000 (14:28 +0100)]
arm64: zynqmp: Fix dependencies around ZYNQMP_PSU_INIT_ENABLED

ZYNQMP_PSU_INIT_ENABLED is called only when BOARD_EARLY_INIT_F is defined
that's why cover this dependency in Kconfig.
 board_early_init_f() is only part related to
CONFIG_ZYNQMP_PSU_INIT_ENABLED which is disabled now that's why disable
BOARD_EARLY_INIT_F and also build board_early_init_f() only when
CONFIG_BOARD_EARLY_INIT_F is enabled.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/d89253ec1590cd513dcd4bfbedebae618bd6d605.1645104518.git.michal.simek@xilinx.com
2 years agoarm64: zynqmp: Build psu_spl_init for SPL all the time
Michal Simek [Thu, 17 Feb 2022 13:28:39 +0000 (14:28 +0100)]
arm64: zynqmp: Build psu_spl_init for SPL all the time

ZYNQMP_PSU_INIT_ENABLED specifically saying that has connection to full
U-Boot not SPL that's why build psu_spl_init for SPL all the time.

Also disable ZYNQMP_PSU_INIT_ENABLED because it ends up in situation that
psu_init() is called twice which is wrong. By default only SPL should call
it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/bf1e5d9a163f8853c7d951ad42965114ab0b1f50.1645104518.git.michal.simek@xilinx.com
2 years agoxilinx: Enable OF_BOARD for zynq and zynqmp boards
Michal Simek [Thu, 17 Feb 2022 13:28:38 +0000 (14:28 +0100)]
xilinx: Enable OF_BOARD for zynq and zynqmp boards

The commit 985503439762 ("fdt: Don't call board_fdt_blob_setup() without
OF_BOARD") forced to enable OF_BOARD for platforms which provide DT
externally. Zynq/ZynqMP boards are using this feature for a long time
that's why there is a need to enable it by default.

Also code expects to return error in case of error that's why also fill it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/9f11bbffe2849f4da7d72712082d579262fe8fd8.1645104518.git.michal.simek@xilinx.com
2 years agoMerge tag 'u-boot-imx-20220220' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
Tom Rini [Sun, 20 Feb 2022 13:09:08 +0000 (08:09 -0500)]
Merge tag 'u-boot-imx-20220220' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx

u-boot-imx-20220220
-------------------

CI : https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/11037

- ESDHC fixes
- imx8mq : MNT Reform 2 board
- imx8m: add support for Advantech RSB-3720
- fixes for imx8mn-ddr4-evk
- fixes gateworks boards
- doc : fix build for imx8mn_beacon
- fuses: compare and read functions
- imx8mn-ddr4-evk: boot from SD and Ethernet support

2 years agoARM: imx: imx8mn-ddr4-evk: Add ethernet support
Marek Vasut [Sat, 19 Feb 2022 16:13:54 +0000 (17:13 +0100)]
ARM: imx: imx8mn-ddr4-evk: Add ethernet support

Add support for ethernet on the imx8mn-ddr4-evk.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
2 years agokontron-pitx-imx8m: fix board_mmc_getcd()
Heiko Thiery [Wed, 16 Feb 2022 14:58:10 +0000 (15:58 +0100)]
kontron-pitx-imx8m: fix board_mmc_getcd()

The function wrongly will return the card detection status of the SD card
(USDHC2) for the eMMC (USDHC1). Thus booting from eMMC without an inserted
SD card will fail.

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
2 years agokontron-sl-mx8mm: change environment address variables
Heiko Thiery [Wed, 16 Feb 2022 12:25:14 +0000 (13:25 +0100)]
kontron-sl-mx8mm: change environment address variables

Currently the space between kernel_addr_r and the fdt_addr_r is only 32MB.
To have enought space to load kernel images bigger than 32MB change the
variables to a feasible value.

The new environment variables layout is based on the scheme from
"include/configs/ti_armv7_common.h".

The CONFIG_SYS_LOAD_ADDR value is set to 0x42000000. With that we have
the same value as for the kernel_addr_r.

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Reviewed-by: Michael Walle <michael@walle.cc>
2 years agocolibri-imx6ull: improve env badblock management
Francesco Dolcini [Thu, 3 Feb 2022 17:41:24 +0000 (18:41 +0100)]
colibri-imx6ull: improve env badblock management

Use the complete 512kb (4 blocks) nand partition reserved for u-boot
environment instead of just the first block, this allows the module to
have a working environment even if 3 blocks are bad.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2 years agoimx8m: Drop unused function env_get_offset
Michael Trimarchi [Wed, 17 Nov 2021 14:34:56 +0000 (15:34 +0100)]
imx8m: Drop unused function env_get_offset

This function is used in nxp u-boot tree.

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoxea: defconfig: Update defconfig to support mtd partitions r/w by name
Lukasz Majewski [Mon, 27 Dec 2021 10:46:39 +0000 (11:46 +0100)]
xea: defconfig: Update defconfig to support mtd partitions r/w by name

After this change it would be possible to use 'mtd' command to get access
to XEA's SPI-NOR partitions by name (e.g. SPL), not by offsets.

To enable this feature the CONFIG_SPI_FLASH_MTD needs to be defined in the
Kconfig, not in xea.h.

=> mtd list
=> mtd read spl-boot-data1 ${loadaddr} 0x0 4
=> md.l ${loadaddr} 1

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2 years agoARM: imx: imx8mn-ddr4-evk: Fix boot from SD card
Marek Vasut [Sun, 13 Feb 2022 23:36:16 +0000 (00:36 +0100)]
ARM: imx: imx8mn-ddr4-evk: Fix boot from SD card

Enable missing config options to make the board boot from SD card.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
2 years agoboard: gateworks: venice: config file cleanups
Tim Harvey [Fri, 11 Feb 2022 18:52:06 +0000 (10:52 -0800)]
board: gateworks: venice: config file cleanups

Clean up config file:
 - remove unnecessary IMX_FEC_BASE
 - remove unnecessary comment
 - remove ipaddr/serverip from env

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoboard: gateworks: venice: add imx8mn-gw7902 support
Tim Harvey [Fri, 11 Feb 2022 18:48:56 +0000 (10:48 -0800)]
board: gateworks: venice: add imx8mn-gw7902 support

The GW7902 is based on the i.MX 8M Mini / Nano SoC featuring:
 - LPDDR4 DRAM
 - eMMC FLASH
 - Gateworks System Controller
 - LTE CAT M1 modem
 - USB 2.0 HUB
 - M.2 Socket with USB2.0, PCIe, and dual-SIM
 - IMX8M FEC
 - PCIe based GbE
 - RS232/RS485/RS422 serial transceiver
 - GPS
 - CAN bus
 - WiFi / Bluetooth
 - MIPI header (DSI/CSI/GPIO/PWM/I2S)
 - PMIC

To add support for the i.MX8M Nano GW7902:
 - Add imx8mn-venice dts/defconfig/include
 - Add imx8mn-gw7902 dts
 - Add imx8mn-2gb lpddr4 dram configs
 - Add misc support for IMX8M Nano SoC
 - rename imx8mm-venice.c to venice.c as it is no longer imx8mm specific
 - update README with differences for IMX8MN vs IMX8MM

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agommc: fsl_esdhc_imx: correct the actual card clock
Haibo Chen [Fri, 11 Feb 2022 11:16:57 +0000 (19:16 +0800)]
mmc: fsl_esdhc_imx: correct the actual card clock

The original code logic can not show the correct card clock, and also
has one risk when the div is 0. Because there is div -=1 before.

So move the operation before div -=1, and also involve ddr_pre_div
to get the correct value.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Marek Vasut <marex@denx.de>
2 years agommc: fsl_esdhc_imx: remove redundant ARCH_MXC
Haibo Chen [Fri, 11 Feb 2022 11:16:56 +0000 (19:16 +0800)]
mmc: fsl_esdhc_imx: remove redundant ARCH_MXC

Now original fsl_esdhc.c are split as fsl_esdhc.c and fsl_esdhc_imx.c.
fsl_esdhc_imx.c only cover i.MX SoC. So ARCH_MXC is redundant.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Marek Vasut <marex@denx.de>
2 years agoarm: imx8m: add support for Advantech RSB-3720
Ying-Chun Liu (PaulLiu) [Tue, 8 Feb 2022 01:22:38 +0000 (09:22 +0800)]
arm: imx8m: add support for Advantech RSB-3720

Add initial support for Advantech RSB-3720 board.
The initial support includes:
 - MMC
 - eMMC
 - I2C
 - FEC
 - Serial console

Signed-off-by: Darren Huang <darren.huang@advantech.com.tw>
Signed-off-by: Kevin12.Chen <Kevin12.Chen@advantech.com.tw>
Signed-off-by: Phill.Liu <Phill.Liu@advantech.com.tw>
Signed-off-by: Tim Liang <tim.liang@advantech.com.tw>
Signed-off-by: wei.zeng <wei.zeng@advantech.com.cn>
Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Cc: uboot-imx <uboot-imx@nxp.com>
Cc: Peng Fan (OSS) <peng.fan@oss.nxp.com>
2 years agoconfigs/*imx8mn*: remove [SPL_]CLK_COMPOSITE_CCF
Heiko Thiery [Sun, 30 Jan 2022 06:37:08 +0000 (07:37 +0100)]
configs/*imx8mn*: remove [SPL_]CLK_COMPOSITE_CCF

This option is selected implicitly when [SPL_]CLK_IMX8MN is selected.

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
2 years agoclk: imx: select [SPL_]CLK_COMPOSITE_CCF for imx8mn
Heiko Thiery [Sun, 30 Jan 2022 06:37:06 +0000 (07:37 +0100)]
clk: imx: select [SPL_]CLK_COMPOSITE_CCF for imx8mn

The clock composite is required when using the clock framework. So
select it automatically.

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
2 years agoimx8mm_beacon/imx8mn_beacon: Update build instructions
Adam Ford [Sat, 22 Jan 2022 20:48:40 +0000 (14:48 -0600)]
imx8mm_beacon/imx8mn_beacon: Update build instructions

With binman generating flash.bin, it's not longer necessary to
specify either the location of ATF nor is it necessary to
specify building flash.bin, so let's update the build instructions
to remove those.  While in here, update the revision of ATF and
DDR firmware so both Mini and Nano reference the same revision.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agommc: fsl_esdhc_imx: Use esdhc_soc_data flags to set host caps
Adam Ford [Wed, 12 Jan 2022 13:53:56 +0000 (07:53 -0600)]
mmc: fsl_esdhc_imx: Use esdhc_soc_data flags to set host caps

The Linux driver automatically can detect and enable UHS, HS200, HS400
and HS400_ES automatically without extra flags being placed into the
device tree.

Right now, for U-Boot to use UHS, HS200 or HS400, the extra flags are
needed in the device tree.  Instead, go through the esdhc_soc_data
flags and enable the host caps where applicable to automatically
enable higher speeds.

Suggested-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Adam Ford <aford173@gmail.com>
2 years agoarm: dts: imx8mq: add MNT Reform 2
Patrick Wildt [Sat, 8 Jan 2022 15:04:55 +0000 (16:04 +0100)]
arm: dts: imx8mq: add MNT Reform 2

Device tree taken from Linux v5.16-rc5.

Signed-off-by: Patrick Wildt <patrick@blueri.se>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agofreescale: imx8mm_evk: Use IS_ENABLED instead of #ifdef
Tommaso Merciai [Sun, 26 Dec 2021 17:23:11 +0000 (18:23 +0100)]
freescale: imx8mm_evk: Use IS_ENABLED instead of #ifdef

Use IS_ENABLED(CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG) to make the code
more readable and fix checkpatch.pl warning

Signed-off-by: Tommaso Merciai <tomm.merciai@gmail.com>
2 years agoEnable Fastboot(UUU) for O4-iMX6ULL-NANO boards
Oleh Kravchenko [Mon, 20 Dec 2021 14:00:01 +0000 (16:00 +0200)]
Enable Fastboot(UUU) for O4-iMX6ULL-NANO boards

Make O4-iMX6ULL-NANO-based board compatible with Yocto layer meta-out4 and
fix device flashing by UUU (aka MFG Tools).

Signed-off-by: Oleh Kravchenko <oleg@kaa.org.ua>
2 years agoimx: spl: Fix typo BMODE_EMI -> BMODE_EIM
Harald Seiler [Wed, 1 Dec 2021 09:02:54 +0000 (10:02 +0100)]
imx: spl: Fix typo BMODE_EMI -> BMODE_EIM

The interface for NOR/OneNAND is called "EIM" not "EMI".  Fix this.

Signed-off-by: Harald Seiler <hws@denx.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agocmd: fuse: Add a command to read fuses to memory
Angus Ainslie [Sun, 28 Nov 2021 16:02:53 +0000 (08:02 -0800)]
cmd: fuse: Add a command to read fuses to memory

With the fuse values in memory we can use some of the other u-boot shell
conditonal operators to do tests.

Signed-off-by: Angus Ainslie <angus@akkea.ca>
2 years agocmd: fuse: add a fuse comparison function
Angus Ainslie [Sun, 28 Nov 2021 16:02:52 +0000 (08:02 -0800)]
cmd: fuse: add a fuse comparison function

Compare a hexval to the fuse value and return pass or fail.

Signed-off-by: Angus Ainslie <angus@akkea.ca>
2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Thu, 17 Feb 2022 16:03:50 +0000 (11:03 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- a37xx: pci: Cleanup and minor fix for root port check (Pali)
- pci: mvebu: Ensure that root port is always on root zero bus (Pali)
- kwbimage: Fix dumping DATA registers for v0 images (Pali)
- kwbimage: Support for parsing extended v0 format (Pali)
- a37xx: Fix code and update DTS files to upstream version (Pali)
- a37xx: Fix and extend building memory map (Pali)
- ddr: marvell: a38x: fix BYTE_HOMOGENEOUS_SPLIT_OUT decision (Marek)
- mvebu: Optionally reset board on DDR training failure (Marek)

2 years agoarm: mvebu: turris_omnia: Reset the board immediately on DDR training failure
Marek Behún [Thu, 17 Feb 2022 12:54:43 +0000 (13:54 +0100)]
arm: mvebu: turris_omnia: Reset the board immediately on DDR training failure

The state of the current DDR training code for Armada 38x is such that
we cannot be sure it will always train successfully - although after the
last change we were yet unable to find a board that failed DDR training,
from experience in the last 2 years we know that it is possible.

The experience also tells us that in many cases the board fails training
only sometimes, and after a reset the training is successful.

Enable the new option that makes the board reset itself on DDR training
failure immediately. Until now we called hang() in such a case, which
meant that the board was reset by the MCU after 120 seconds.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
2 years agoarm: mvebu: spl: Add option to reset the board on DDR training failure
Marek Behún [Thu, 17 Feb 2022 12:54:42 +0000 (13:54 +0100)]
arm: mvebu: spl: Add option to reset the board on DDR training failure

Some boards may occacionally fail DDR training. Currently we hang() in
this case. Add an option that makes the board do an immediate reset in
such a case, so that a new training is tried as soon as possible,
instead of hanging and possibly waiting for watchdog to reset the board.

(If the DDR training fails while booting the image via UART, we will
 still hang - it doesn't make sense to reset in such a case, because
 after reset the board will try booting from another medium, and the
 UART booting utility does not expect that.)

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwbimage: Add me as an author of kwbimage
Pali Rohár [Thu, 17 Feb 2022 09:43:40 +0000 (10:43 +0100)]
tools: kwbimage: Add me as an author of kwbimage

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwbimage: Fix help how to extract DDR3 training code
Pali Rohár [Thu, 17 Feb 2022 09:43:39 +0000 (10:43 +0100)]
tools: kwbimage: Fix help how to extract DDR3 training code

First binary executable header is extracted by '-p 1' argument.

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwbimage: Add support for NAND_BLKSZ and NAND_BADBLK_LOCATION for v0 images
Pali Rohár [Thu, 17 Feb 2022 09:43:38 +0000 (10:43 +0100)]
tools: kwbimage: Add support for NAND_BLKSZ and NAND_BADBLK_LOCATION for v0 images

These two commands are currently not processed when generating v0 images.

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwbimage: Do not show mkimage error message in dumpimage
Pali Rohár [Thu, 17 Feb 2022 09:43:37 +0000 (10:43 +0100)]
tools: kwbimage: Do not show mkimage error message in dumpimage

When pflag is set then kwbimage was invoked by dumpimage and not mkimage.
So do not show mkimage error message in this case.

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwbimage: Add support for dumping extended and binary v0 headers
Pali Rohár [Thu, 17 Feb 2022 09:43:36 +0000 (10:43 +0100)]
tools: kwbimage: Add support for dumping extended and binary v0 headers

dumpimage is now able to successfully parse and dump content of the Dove
bootloader image.

Note that support for generating these extended parts of v0 images is not
included yet.

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwbimage: Fix calculating size of kwbimage v0 header
Pali Rohár [Thu, 17 Feb 2022 09:43:35 +0000 (10:43 +0100)]
tools: kwbimage: Fix calculating size of kwbimage v0 header

Extended and binary headers are optional and are part of the image header.

Fixes kwboot to determinate correct length of Dove images.

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwbimage: Define structures for extended kwbimage v0 headers
Pali Rohár [Thu, 17 Feb 2022 09:43:34 +0000 (10:43 +0100)]
tools: kwbimage: Define structures for extended kwbimage v0 headers

They are used by Marvell Dove 88AP510 BootROM.

After the main header is a list of optional extended headers and after that
is a list of optional binary executable headers. Between each two extended
headers is additional 0x20 byte long padding.

Original Kirkwood SoCs support only one extended header and no binary
executable header.

Extension of struct ext_hdr_v0 is backward compatible with the old
definition. Only reserved[] fields are changed.

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoddr: marvell: a38x: fix BYTE_HOMOGENEOUS_SPLIT_OUT decision
Marek Behún [Thu, 17 Feb 2022 00:08:37 +0000 (01:08 +0100)]
ddr: marvell: a38x: fix BYTE_HOMOGENEOUS_SPLIT_OUT decision

In commit 3fc92a215b69 ("ddr: marvell: a38x: fix SPLIT_OUT_MIX state
decision") I ported a cleaned up and changed version of patch
  mv_ddr: a380: fix SPLIT_OUT_MIX state decision

In the port we removed checking for BYTE_HOMOGENEOUS_SPLIT_OUT bit,
because:
- the fix seemed to work without it
- the bit was checked for only at one place out of two, while the second
  bit, BYTE_SPLIT_OUT_MIX, was checked for in both cases
- without the removal it didn't work on Allied Telesis' x530 board

We recently had a chance to test on more boards, and it seems that the
change needs to be opposite: instead of removing the check for
BYTE_HOMOGENEOUS_SPLIT_OUT from the first if() statement, the check
needs to be added also to the second one - it needs to be at both
places.

With this change all the Turris Omnia boards I have had available to
test seem to work, I didn't encounter not even one failed DDR training.

As last time, I am noting that I do not understand what this code is
actually doing, I haven't studied the DDR training algorithm and
I suspect that no one will be able to explain it to U-Boot contributors,
so we are left with this blind poking in the code with testing whether
it works on several boards and hoping it doesn't break anything for
anyone :-(.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Tested-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: a37xx: Fix comment with name of the function
Pali Rohár [Wed, 16 Feb 2022 10:18:45 +0000 (11:18 +0100)]
arm: mvebu: a37xx: Fix comment with name of the function

Function is named build_mem_map, not a3700_build_mem_map.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
2 years agoarm: mvebu: a37xx: Map CCI-400 and AP BootROM address space
Pali Rohár [Wed, 16 Feb 2022 10:18:44 +0000 (11:18 +0100)]
arm: mvebu: a37xx: Map CCI-400 and AP BootROM address space

In function build_mem_map() prepare also mapping for CCI-400 and
BootROM windows.

BootROM window is 1 MB long and by default starts at address 0xfff00000.
A53 AP BootROM is 16 kB long and repeats in this BootROM window 64 times.
RVBAR_EL3 register is set to value 0xffff0000, so by default A53 AP BootROM
is accessed via range 0xffff0000-0xffff3fff.

CCI-400 window when new TF-A version is used, starts at address 0xfe000000
and when old TF-A version is used, starts at address 0xd8000000.

Physical addresses are read directly from mvebu registers, so if TF-A
remaps it in future (again) then it would not cause any issue for U-Boot.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: a37xx: Fix calling build_mem_map()
Pali Rohár [Wed, 16 Feb 2022 10:18:43 +0000 (11:18 +0100)]
arm: mvebu: a37xx: Fix calling build_mem_map()

Function build_mem_map() modifies global variable mem_map. This variable is
used by the get_page_table_size() function which is called by function
arm_reserve_mmu() (as aliased macro PGTABLE_SIZE). Function
arm_reserve_mmu() is called earlier than enable_caches() which calls
build_mem_map(). So arm_reserve_mmu() does not calculate reserved memory
correctly.

Fix this issue by calling build_mem_map() from a3700_dram_init() which is
called before arm_reserve_mmu().

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
2 years agopci: mvebu: Ensure that root port is always on root zero bus
Pali Rohár [Tue, 15 Feb 2022 10:34:01 +0000 (11:34 +0100)]
pci: mvebu: Ensure that root port is always on root zero bus

Writing to the PCI_PRIMARY_BUS register of the root port should not change
bus number on which is root port present.

Same change and exactly same fix as was done in commit for pci-aardvark.c.

Fixes: a7b61ab58d5d ("pci: pci_mvebu: Properly configure and use PCI Bridge (PCIe Root Port)")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: a37xx: pci: Update comment about Command/Direct mode
Pali Rohár [Tue, 15 Feb 2022 10:23:37 +0000 (11:23 +0100)]
arm: a37xx: pci: Update comment about Command/Direct mode

Code is changing PCIe controller from Command mode to Direct mode.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: a37xx: pci: Register controller also when no PCIe card is connected
Pali Rohár [Tue, 15 Feb 2022 10:23:36 +0000 (11:23 +0100)]
arm: a37xx: pci: Register controller also when no PCIe card is connected

Allow access to config space of PCIe Root Port (which is always present on
the root bus) even when PCIe link is down or no card is connected.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: a37xx: pci: Do not try to access other buses when link is down
Pali Rohár [Tue, 15 Feb 2022 10:23:35 +0000 (11:23 +0100)]
arm: a37xx: pci: Do not try to access other buses when link is down

If a PIO request is executed while link-down, the whole controller gets
stuck in a non-functional state, and even after link comes up again, PIO
requests won't work anymore, and a reset of the whole PCIe controller is
needed. Therefore we need to prevent sending PIO requests while the link
is down.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: a37xx: Update DTS files to version from upstream Linux kernel
Pali Rohár [Mon, 14 Feb 2022 10:34:30 +0000 (11:34 +0100)]
arm: a37xx: Update DTS files to version from upstream Linux kernel

This change updates all Armada 37xx DTS files to version which is used by
Linux kernel v5.18.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: a37xx: espressobin: Explicitly enable eMMC node in -u-boot.dtsi
Pali Rohár [Mon, 14 Feb 2022 10:34:29 +0000 (11:34 +0100)]
arm: a37xx: espressobin: Explicitly enable eMMC node in -u-boot.dtsi

Official DT bindings for Espressobin have disabled eMMC node.

As U-Boot requires to have this node enabled by default, do it in
armada-3720-espressobin-u-boot.dtsi DTS file.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: a37xx: espressobin: Move U-Boot specific partitions node to -u-boot.dtsi
Pali Rohár [Mon, 14 Feb 2022 10:34:28 +0000 (11:34 +0100)]
arm: a37xx: espressobin: Move U-Boot specific partitions node to -u-boot.dtsi

U-Boot specific changes should be in armada-3720-espressobin-u-boot.dtsi DTS file.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>