]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
3 years agoarm: dts: ls1028a: move the PCI I/O window to match
Michael Walle [Wed, 13 Oct 2021 16:14:24 +0000 (18:14 +0200)]
arm: dts: ls1028a: move the PCI I/O window to match

To make the synchronization of the u-boot device tree with the one from
linux easier, move the I/O window to the one which is specified in the
linux device tree. The actual value shouldn't matter as long as it
mapped to the corresponding memory window of the PCIe controller which
is a 32GiB window at 80_0000_0000h (first controller) or 88_0000_0000h
(second controller).

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoarm: dts: ls1028a: remove num-lanes in the PCIe controller nodes
Michael Walle [Wed, 13 Oct 2021 16:14:23 +0000 (18:14 +0200)]
arm: dts: ls1028a: remove num-lanes in the PCIe controller nodes

This property is unused in the layerscape PCIe controller driver and not
present in the linux device tree. Remove it to be similarly.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agopci: layerscape: add official ls1028a binding support
Michael Walle [Wed, 13 Oct 2021 16:14:22 +0000 (18:14 +0200)]
pci: layerscape: add official ls1028a binding support

The official bindind of the PCIe controller of the ls1028a has the
following compatible string:
  compatible = "fsl,ls1028a-pcie";

Additionally, the resource names and count are different. Update the
driver to support this binding and change the entry in the ls1028a
device tree.

Cc: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agousb: xhci: fsl: add new compatible fsl,ls1028a-dwc3
Michael Walle [Wed, 13 Oct 2021 16:14:21 +0000 (18:14 +0200)]
usb: xhci: fsl: add new compatible fsl,ls1028a-dwc3

The official ls1028a binding of the driver uses the following as
compatibles:
  compatible = "fsl,ls1028a-dwc3", "snps,dwc3";

Change the ls1028a device tree and add this new compatible to the fsl
specific xhci driver, otherwise the generic dwc3 driver will be used
with the compatibles above.

Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoscsi: ceva: rename the resource name to match the linux kernel one
Michael Walle [Wed, 13 Oct 2021 16:14:20 +0000 (18:14 +0200)]
scsi: ceva: rename the resource name to match the linux kernel one

The driver will look for a named resource "ecc-addr", but this isn't the
official binding. In fact, the official device tree binding
documentation doesn't mention any resource names at all. But it is safe
to assume that it's the linux ones we have to use if we want to be
compatible with the linux device tree. Thus rename "ecc-addr" to
"sata-ecc" and convert all the users in u-boot.

While at it, also rename "sata-base" to "ahci" although its not used at
all.

This change doesn't affect the SATA controller on the ZynqMP.

Cc: Michal Simek <monstr@monstr.eu>
Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoserial: lpuart: add new compatible fsl, ls1028a-lpuart
Michael Walle [Wed, 13 Oct 2021 16:14:19 +0000 (18:14 +0200)]
serial: lpuart: add new compatible fsl, ls1028a-lpuart

The official ls1028a binding of the driver uses the following as
compatibles:
  compatible = "fsl,ls1028a-lpuart";

Add the missing compatible to the driver and update the device tree.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agospi: fsl_dspi: rename num-cs to spi-num-chipselects
Michael Walle [Wed, 13 Oct 2021 16:14:18 +0000 (18:14 +0200)]
spi: fsl_dspi: rename num-cs to spi-num-chipselects

The official devicetree bindings specifies spi-num-chipselects as the
name. Use it.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agospi: fsl_dspi: add new compatible fsl, ls1021a-v1.0-dspi
Michael Walle [Wed, 13 Oct 2021 16:14:17 +0000 (18:14 +0200)]
spi: fsl_dspi: add new compatible fsl, ls1021a-v1.0-dspi

The official ls1028a binding of the driver uses the following as
compatibles:
  compatible = "fsl,ls1028a-dspi", "fsl,ls1021a-v1.0-dspi";

Add the missing compatible to the driver and update the device tree.
We can use the fallback "fsl,ls1021a-v1.0-dspi", because the endianness
is determined by the little-endian property and not by the compatible
string itself. Further, we won't need and specific details on the DMA
configuration (which is different on the LS1021A). If it's ever needed,
we can later add the more specific "fsl,ls1028a-dspi" compatible to the
driver.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agowatchdog: sp805_wdt: use correct compatible string
Michael Walle [Wed, 13 Oct 2021 16:14:16 +0000 (18:14 +0200)]
watchdog: sp805_wdt: use correct compatible string

According to the linux device tree specification the compatible string
is:
  compatible = "arm,sp805", "arm,primecell";

Fix all users in u-boot.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoarm: dts: ls1028a: update the labels
Michael Walle [Wed, 13 Oct 2021 16:14:15 +0000 (18:14 +0200)]
arm: dts: ls1028a: update the labels

Update the labels of the nodes to match the kernel ones.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoarm: dts: ls1028a: move the iRC node and its devices into /soc
Michael Walle [Wed, 13 Oct 2021 16:14:14 +0000 (18:14 +0200)]
arm: dts: ls1028a: move the iRC node and its devices into /soc

While inserting them into the new location, keep them sorted by the
register base offset just like in the linux kernel device tree.

While at it fix the indentation.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoarm: dts: ls1028a: move the watchdog node into /soc
Michael Walle [Wed, 13 Oct 2021 16:14:13 +0000 (18:14 +0200)]
arm: dts: ls1028a: move the watchdog node into /soc

While inserting it into the new location, keep it sorted by the
register base offset just like in the linux kernel device tree.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoarm: dts: ls1028a: move the PCIe controller nodes into /soc
Michael Walle [Wed, 13 Oct 2021 16:14:12 +0000 (18:14 +0200)]
arm: dts: ls1028a: move the PCIe controller nodes into /soc

While inserting them into the new location, keep them sorted by the
register base offset just like in the linux kernel device tree.

While at it fix the indentation.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoarm: dts: ls1028a: move SATA and USB controller nodes into /soc
Michael Walle [Wed, 13 Oct 2021 16:14:11 +0000 (18:14 +0200)]
arm: dts: ls1028a: move SATA and USB controller nodes into /soc

While inserting them into the new location, keep them sorted by the
register base offset just like in the linux kernel device tree.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoarm: dts: ls1028a: move the GPIO controller nodes into /soc
Michael Walle [Wed, 13 Oct 2021 16:14:10 +0000 (18:14 +0200)]
arm: dts: ls1028a: move the GPIO controller nodes into /soc

While inserting them into the new location, keep them sorted by the
register base offset just like in the linux kernel device tree.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoarm: dts: ls1028a: move the low-power UART nodes into /soc
Michael Walle [Wed, 13 Oct 2021 16:14:09 +0000 (18:14 +0200)]
arm: dts: ls1028a: move the low-power UART nodes into /soc

While inserting them into the new location, keep them sorted by the
register base offset just like in the linux kernel device tree.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoarm: dts: ls1028a: move the UART controller nodes into /soc
Michael Walle [Wed, 13 Oct 2021 16:14:08 +0000 (18:14 +0200)]
arm: dts: ls1028a: move the UART controller nodes into /soc

While inserting them into the new location, keep them sorted by the
register base offset just like in the linux kernel device tree.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoarm: dts: ls1028a: move the SPI and eSDHC controller nodes into /soc
Michael Walle [Wed, 13 Oct 2021 16:14:07 +0000 (18:14 +0200)]
arm: dts: ls1028a: move the SPI and eSDHC controller nodes into /soc

While inserting them into the new location, keep them sorted by the
register base offset just like in the linux kernel device tree.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoarm: dts: ls1028a: move the FlexSPI controller node
Michael Walle [Wed, 13 Oct 2021 16:14:06 +0000 (18:14 +0200)]
arm: dts: ls1028a: move the FlexSPI controller node

While inserting it into the new location, keep it sorted by the
register base offset just like in the linux kernel device tree.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoarm: dts: ls1028a: move I2C controller nodes into /soc
Michael Walle [Wed, 13 Oct 2021 16:14:05 +0000 (18:14 +0200)]
arm: dts: ls1028a: move I2C controller nodes into /soc

While inserting them into the new location, keep them sorted by the
register base offset just like in the linux kernel device tree.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoarm: dts: ls1028a: move the clockgen node into /soc
Michael Walle [Wed, 13 Oct 2021 16:14:04 +0000 (18:14 +0200)]
arm: dts: ls1028a: move the clockgen node into /soc

Populate the /soc node with the first device node.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoarm: dts: ls1028a: add an empty /soc
Michael Walle [Wed, 13 Oct 2021 16:14:03 +0000 (18:14 +0200)]
arm: dts: ls1028a: add an empty /soc

To keep the device tree similar to the linux kernel one, we need to move
all CCSR related devices into the /soc node. To keep the patches easy to
review, we initially add an empty /soc node and populate it piece by
piece.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoarm: dts: ls1028a-{rdb, qds}: remove dm-pre-reloc property
Michael Walle [Wed, 13 Oct 2021 16:14:02 +0000 (18:14 +0200)]
arm: dts: ls1028a-{rdb, qds}: remove dm-pre-reloc property

Nowadays, both boards boot using the TF-A BL1/BL2 and SPL isn't used at
all. The property is not needed, remove it.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoarm: dts: ls1028a: remove /memory node
Michael Walle [Wed, 13 Oct 2021 16:14:01 +0000 (18:14 +0200)]
arm: dts: ls1028a: remove /memory node

This node is some hodgepodge between the ddr controller node at SoC
offset 0x1080000 and some static memory size of 2GiB. Remove this bogus
node because it doesn't seem to be used at all.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoarmv8: ls1028a: use the official compatible string for the GPU
Michael Walle [Wed, 13 Oct 2021 16:14:00 +0000 (18:14 +0200)]
armv8: ls1028a: use the official compatible string for the GPU

There is no "fsl,ls1028a-gpu" compatible string. It is solely for the
proprietary driver which will never be open source. Lately, linux gained
support for the open source etnaviv driver for the GPU (although there
is still support for the DisplayPort PHY missing to get actual graphics
output). Thus, instead of supporting some proprietary driver, switch
over to the open source one, which also have an official device tree
binding.

Cc: Andy Tang <andy.tang@nxp.com>
Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agodrivers: ddr: lc_common_dimm_params.c : Fix Divison by zero issue
Maninder Singh [Sun, 10 Oct 2021 16:12:16 +0000 (09:12 -0700)]
drivers: ddr: lc_common_dimm_params.c : Fix Divison by zero issue

Adds check for memory clock variable before calculating caslat_actual.

Set mclk_ps to slowest DIMM supported if mclk_ps is found zero.

Signed-off-by: Maninder Singh <maninder.singh_1@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agodrivers: net: fsl-mc: add a command which dumps the MC log
Cosmin-Florin Aluchenesei [Thu, 7 Oct 2021 10:07:44 +0000 (13:07 +0300)]
drivers: net: fsl-mc: add a command which dumps the MC log

Extended fsl_mc command adding an extra option dump_log

Signed-off-by: Cosmin-Florin Aluchenesei <aluchenesei.cosmin-florin@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoppc: mpc8xx: Drop -mstring from PLATFORM_CPPFLAGS
Tom Rini [Mon, 4 Oct 2021 18:01:34 +0000 (14:01 -0400)]
ppc: mpc8xx: Drop -mstring from PLATFORM_CPPFLAGS

This has not been supported by toolchains for some time and has been
putting out a warning.  Drop this.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoarm: dts: ls1088a: Update qspi node properties
Kuldeep Singh [Fri, 1 Oct 2021 10:54:24 +0000 (16:24 +0530)]
arm: dts: ls1088a: Update qspi node properties

Remove "num-cs" property from device-tree as it is no longer used by
qspi driver anymore.

Also, specify status as "disabled" and enable qspi support in respective
board dts files. This will also help in aligning node properties with
other board properties.

Signed-off-by: Kuldeep Singh <kuldeep.singh@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoboard: sl28: add update image documentation
Michael Walle [Wed, 29 Sep 2021 11:39:13 +0000 (13:39 +0200)]
board: sl28: add update image documentation

Document the update image and how to use the EFI UpdateCapsule.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agodoc: board: kontron: sl28: Reduce section levels and change title
Frieder Schrempf [Wed, 29 Sep 2021 11:39:12 +0000 (13:39 +0200)]
doc: board: kontron: sl28: Reduce section levels and change title

In order to add other Kontron boards to the docs alongside the existing sl28 board,
we need to reduce the levels of the sections and change the title.

Cc: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Acked-by: Michael Walle <michael@walle.cc>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoboard: sl28: enable EFI UpdateCapsule support
Michael Walle [Tue, 9 Nov 2021 09:18:51 +0000 (14:48 +0530)]
board: sl28: enable EFI UpdateCapsule support

Enable support for update over EFI UpdateCapsule mechanism. This board
doesn't support setting EFI variables after ExitBootservices().
Therefore, we are also enabling EFI_IGNORE_OSINDICATIONS.

Signed-off-by: Michael Walle <michael@walle.cc>
[Rebased]
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoboard: sl28: generate FIT update image
Michael Walle [Wed, 29 Sep 2021 11:39:10 +0000 (13:39 +0200)]
board: sl28: generate FIT update image

Generate a FIT update image during build. The image will be called
"u-boot.update" and can be used to build an EFI UpdateCapsule or during
DFU mode. Although, the latter isn't supported because there is no USB
OTG driver yet.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoboard: sl28: enable EFI_SET_TIME support
Michael Walle [Wed, 29 Sep 2021 11:39:09 +0000 (13:39 +0200)]
board: sl28: enable EFI_SET_TIME support

Allow EFI to actually set the time before ExitBootServices().

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoboard: freescale: lx216x : increase fdt blob size
Wasim Khan [Mon, 20 Sep 2021 13:45:33 +0000 (15:45 +0200)]
board: freescale: lx216x : increase fdt blob size

Increase fdt blob size for lx2160 and lx2162 series
to fix below errors/warnings during device tree fixup.

Unable to update property /soc/spi@2100000:status, err=FDT_ERR_NOSPACE
Unable to update property /soc/spi@2110000:status, err=FDT_ERR_NOSPACE
Unable to update property /soc/spi@2120000:status, err=FDT_ERR_NOSPACE
WARNING: could not set reg FDT_ERR_NOSPACE.
WARNING unable to set iommus: FDT_ERR_NOSPACE

Signed-off-by: Wasim Khan <wasim.khan@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoboard: fsl_validate: Fix Double free Issue
Kshitiz Varshney [Sun, 19 Sep 2021 15:09:53 +0000 (17:09 +0200)]
board: fsl_validate: Fix Double free Issue

Remove Double free issue from calc_img_key_hash() and
calc_esbchdr_esbc_hash() function.
Verified the secure boot changes using lx2162aqds board.

Signed-off-by: Kshitiz Varshney <kshitiz.varshney@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoconfigs: lx2162a: Enable CONFIG_SPI_FLASH_MT35XU for lx2162a-qds
Kuldeep Singh [Wed, 15 Sep 2021 10:04:12 +0000 (15:34 +0530)]
configs: lx2162a: Enable CONFIG_SPI_FLASH_MT35XU for lx2162a-qds

LX2162A-QDS has micron mt35xu512aba flash which requires flag
CONFIG_SPI_FLASH_MT35XU on to probe flash successfully.

Signed-off-by: Kuldeep Singh <kuldeep.singh@nxp.com>
Reviewed-by: Wasim Khan <wasim.khan@nxp.com>
Tested-by: Wasim Khan <wasim.khan@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoarmv8: fsl-layerscape: Erratum A010315 needs PCIE support
Alban Bedel [Mon, 6 Sep 2021 14:32:56 +0000 (16:32 +0200)]
armv8: fsl-layerscape: Erratum A010315 needs PCIE support

Disabling PCIE support currently lead to a crash because the code for
erratum A010315 is still run. Add a conditional to only select
CONFIG_SYS_FSL_ERRATUM_A010315 when CONFIG_PCIE_LAYERSCAPE is enabled.

Signed-off-by: Alban Bedel <alban.bedel@aerq.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agolx2162a : Rename emmc boot command variable
Meenakshi Aggarwal [Thu, 26 Aug 2021 10:39:24 +0000 (16:09 +0530)]
lx2162a : Rename emmc boot command variable

Rename emmc_bootcmd environment variable to sd2_bootcmd
to fix emmc boot on lx2162aqds board.

Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoboard: freescale: t104xrdb: Set popts->cpo_sample to 0x54 for DDR3
Priyanka Singh [Thu, 19 Aug 2021 07:07:31 +0000 (12:37 +0530)]
board: freescale: t104xrdb: Set popts->cpo_sample to 0x54 for DDR3

Set popts->cpo_sample to 0x54 in t104xrdb/ddr.c to optimize cpo

Signed-off-by: Priyanka Singh <priyanka.singh@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agodrivers: ddr: main.c: Fix Bad Shift operator issue
Priyanka Singh [Thu, 19 Aug 2021 06:09:03 +0000 (11:39 +0530)]
drivers: ddr: main.c: Fix Bad Shift operator issue

Fix Bad Shift operator issue in step_to_string function
by adding an if check

Signed-off-by: Priyanka Singh <priyanka.singh@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agodrivers: ddr: fsl_ddr_gen4.c: Fix divide by zero issue
Priyanka Singh [Thu, 19 Aug 2021 06:09:02 +0000 (11:39 +0530)]
drivers: ddr: fsl_ddr_gen4.c: Fix divide by zero issue

Fix possible divide by zero issue in fsl_ddr_set_memctl_regs
by adding an if check

Signed-off-by: Priyanka Singh <priyanka.singh@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agodrivers: ddr: util.c: Fix divide by zero issue
Priyanka Singh [Thu, 19 Aug 2021 06:09:01 +0000 (11:39 +0530)]
drivers: ddr: util.c: Fix divide by zero issue

Fix possible divide by zero issue in get_memory_clk_period_ps
by adding a check

Signed-off-by: Priyanka Singh <priyanka.singh@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoMerge tag 'efi-2022-01-rc2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Mon, 8 Nov 2021 04:00:29 +0000 (23:00 -0500)]
Merge tag 'efi-2022-01-rc2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2022-01-rc2

Documentation:
* improve description of mmc rescan
* remove obsolete PPC documenation

UEFI
* Provide unit test for the EFI_TCG2_PROTOCOL
* Implement add EFI_TCG2_PROTOCOL.SubmitCommand
* Start the implementation of a 64 bit EFI app
* Reduce rcar3_salvator-x image size

3 years agodfu: newline after updating
Heinrich Schuchardt [Fri, 5 Mar 2021 17:36:37 +0000 (18:36 +0100)]
dfu: newline after updating

Currently output of dfu commands ends on a line with leading hash signs
('#'). The succeeding output should be placed on a new line.

After writing updates via dfu print a new line.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
3 years agoARM: renesas: reduce rcar3_salvator-x image size
Heinrich Schuchardt [Sat, 14 Aug 2021 19:07:47 +0000 (21:07 +0200)]
ARM: renesas: reduce rcar3_salvator-x image size

rcar3_salvator-x u-boot.img is very close to the 0x100000 size limit.

Disable support for Unicode capitalization.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_selftest: add selftest for EFI_TCG2_PROTOCOL and Measured Boot
Masahisa Kojima [Thu, 4 Nov 2021 10:45:46 +0000 (19:45 +0900)]
efi_selftest: add selftest for EFI_TCG2_PROTOCOL and Measured Boot

This commit adds the missing EFI_TCG2_PROTOCOL selftest
and Measured Boot selftest in lib/efi_selftest.

This selftest includes PE/COFF image measurement test, some PCR values are
different in each architecture. With that, this commit also adds pre-built
versions of lib/efi_selftest/efi_miniapp_file_image_exit.c for PE/COFF
image measurement test for 32-bit arm, arm64, ia32, x86_64, riscv32 and
riscv64. Prebuilding avoids the problem of reproducible builds.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Make the test 'onrequest'.
Add code comments to the includes with the binaries.
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi: Add video support to the app
Simon Glass [Thu, 4 Nov 2021 03:09:10 +0000 (21:09 -0600)]
efi: Add video support to the app

The current EFI video driver only works when running in the stub. In that
case the stub calls boot services (before jumping to U-Boot proper) and
copies the graphics info over to the efi table. This is necessary because
the stub exits boot services before jumping to U-Boot.

The app maintains access to boot services throughout its life, so does not
need to do this. Update the driver to support calling boot services
directly.

Enable video output for the app. Note that this uses the
EFI_GRAPHICS_OUTPUT_PROTOCOL protocol, even though it mentions vesa.

A sample qemu command-line for this case is:

   qemu-system-x86_64 -bios /usr/share/edk2.git/ovmf-ia32/OVMF-pure-efi.fd
   -drive id=disk,file=try.img,if=none,format=raw -nic none
   -device ahci,id=ahci -device ide-hd,drive=disk,bus=ahci.0

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi: Add a way to obtain boot services in the app
Simon Glass [Thu, 4 Nov 2021 03:09:09 +0000 (21:09 -0600)]
efi: Add a way to obtain boot services in the app

Add a function to return this information along with a stub for the
efi_info_get() function, since calling it otherwise hangs U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agox86: Don't duplicate global_ptr in 64-bit EFI app
Simon Glass [Thu, 4 Nov 2021 03:09:08 +0000 (21:09 -0600)]
x86: Don't duplicate global_ptr in 64-bit EFI app

This variable is already defined by the EFI code. Drop the duplicate
definition when building a 64-bit EFI app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi: Create a 64-bit app
Simon Glass [Thu, 4 Nov 2021 03:09:07 +0000 (21:09 -0600)]
efi: Create a 64-bit app

Most modern platforms use 64-bit EFI so it is useful to have a U-Boot app
that runs under that. Add a (non-functional) build for this.

Note that --whole-archive causes the gcc 9.2 linker to crash, so disable
this for now. Once this is resolved, things should work.

For now, avoid mentioning the documentation for the 64-bit app, since it
does not work.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agox86: Create a 32/64-bit selection for the app
Simon Glass [Thu, 4 Nov 2021 03:09:06 +0000 (21:09 -0600)]
x86: Create a 32/64-bit selection for the app

Most EFI implementations use 64-bit but U-Boot only supports running as
a 32-bit app at present. While efi-x86_payload64 does boot from 64-bit
UEFI it immediately changes back to 32-bit before starting U-Boot.

In order to support a 64-bit U-Boot app, update the Kconfig to add an
option for 32/64 bit. Update the prompt for the existing option so it is
clear it relates to the stub. Move both up to just under the choice that
controls them, since this looks better and the menu.

Use CONFIG_EFI_APP in the Makefile instead of CONFIG_TARGET_EFI_APP,
since the latter is specific to a single target and we will have two.

Memory size is set to 32MB for now so that it can run on qemu without
increasing the default memory size. We may need to increase the default
later.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi: Drop the OF_EMBED warning for EFI
Simon Glass [Thu, 4 Nov 2021 03:09:05 +0000 (21:09 -0600)]
efi: Drop the OF_EMBED warning for EFI

For the EFI app, we must embed the devicetree in the ELF file since that
is the only thing that is run by UEFI. Drop the warning to avoid
confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
3 years agoefi: Enable DM_ETH for the app
Simon Glass [Thu, 4 Nov 2021 03:09:04 +0000 (21:09 -0600)]
efi: Enable DM_ETH for the app

There is no need to avoid driver model for networking. Drop this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi: Add a script to build an image for testing on UEFI
Simon Glass [Thu, 4 Nov 2021 03:09:03 +0000 (21:09 -0600)]
efi: Add a script to build an image for testing on UEFI

It is quite complicated to run U-Boot on QEMU since we have four
different builds and they must use different versions of qemu and the
UEFI binaries.

Add a script to help. It requires U-Boot itself to be built. Once that
is done you can use this script to build an image for use with qemu and
optionally run it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoefi_loader: add EFI_TCG2_PROTOCOL.SubmitCommand
Masahisa Kojima [Thu, 4 Nov 2021 13:59:16 +0000 (22:59 +0900)]
efi_loader: add EFI_TCG2_PROTOCOL.SubmitCommand

This commit adds the EFI_TCG2_PROTOCOL.SubmitCommand
required in the TCG PC Client PFP spec.
SubmitCommand enables to send the raw command to the TPM device.

To implement this api, tpm2_submit_command() is added
into tpm-v2.c.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agoefi_loader: use byteshift unaligned access helper
Masahisa Kojima [Wed, 3 Nov 2021 02:04:09 +0000 (11:04 +0900)]
efi_loader: use byteshift unaligned access helper

Calling unaligned/access-ok.h version of put_unaligned_le64()
causes data abort in arm 32-bit QEMU.

The similar issue also occurs in linux kernel,
unaligned/access-ok.h is no longer used in linux kernel[1].

This commit uses the unaligned/be_byteshift.h and
unaligned/le_byteshift.h helper instead of unaligned/access-ok.h.

[1]https://lore.kernel.org/all/20210507220813.365382-8-arnd@kernel.org/

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
3 years agoefi_loader: capsule: drop __weak from efi_get_public_key_data()
AKASHI Takahiro [Tue, 2 Nov 2021 00:55:01 +0000 (09:55 +0900)]
efi_loader: capsule: drop __weak from efi_get_public_key_data()

As we discussed in ML, currently a device tree is the only place
to store public keys for capsule authentication. So __weak is not
necessary for now.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodoc: mmc rescan speed mode
Heinrich Schuchardt [Fri, 5 Nov 2021 15:35:44 +0000 (16:35 +0100)]
doc: mmc rescan speed mode

Provide human readable descriptions of the speed nodes instead of the name
of constants from the code.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
3 years agodoc: Remove the obsolete README.AMCC-eval-boards-cleanup file
Thomas Huth [Tue, 26 Oct 2021 06:13:04 +0000 (08:13 +0200)]
doc: Remove the obsolete README.AMCC-eval-boards-cleanup file

The related boards have been removed four years ago already, in
commit 98f705c9cefd ("powerpc: remove 4xx support"), so this README
file is not required anymore.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agodoc: Remove obsolete doc/README.nand-boot-ppc440
Stefan Roese [Thu, 21 Oct 2021 05:20:12 +0000 (07:20 +0200)]
doc: Remove obsolete doc/README.nand-boot-ppc440

The PPC440 support has been removed in commit 98f705c9ce
("powerpc: remove 4xx support"). This patch removes this obsolete
file as well.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Thomas Huth <thuth@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
3 years agoMerge branch '2021-11-05-Kconfig-syncs'
Tom Rini [Fri, 5 Nov 2021 19:38:46 +0000 (15:38 -0400)]
Merge branch '2021-11-05-Kconfig-syncs'

- An assortment of changes to finish migration of a number of symbols,
  and move YAFFS2 related options that we enable to Kconfig as well.

3 years agoconfigs: Resync with savedefconfig
Tom Rini [Fri, 5 Nov 2021 15:31:59 +0000 (15:31 +0000)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_BOARD_EARLY_INIT_F et al to Kconfig
Tom Rini [Sun, 31 Oct 2021 03:03:57 +0000 (23:03 -0400)]
Convert CONFIG_BOARD_EARLY_INIT_F et al to Kconfig

This converts the following to Kconfig:
   CONFIG_BOARD_EARLY_INIT_F
   CONFIG_BOARD_LATE_INIT
   CONFIG_DISPLAY_BOARDINFO
   CONFIG_DISPLAY_BOARDINFO_LATE

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_SPL_DRIVERS_MISC et al to Kconfig
Tom Rini [Sun, 31 Oct 2021 03:03:56 +0000 (23:03 -0400)]
Convert CONFIG_SPL_DRIVERS_MISC et al to Kconfig

This converts the following to Kconfig:
   CONFIG_SPL_DRIVERS_MISC
   CONFIG_SPL_ENV_SUPPORT
   CONFIG_SPL_GPIO
   CONFIG_SPL_I2C
   CONFIG_SPL_LDSCRIPT
   CONFIG_SPL_LIBCOMMON_SUPPORT
   CONFIG_SPL_LIBGENERIC_SUPPORT
   CONFIG_SPL_LOAD_FIT_ADDRESS
   CONFIG_SPL_MMC
   CONFIG_SPL_NAND_SUPPORT
   CONFIG_SPL_NO_CPU_SUPPORT
   CONFIG_SPL_OS_BOOT
   CONFIG_SPL_POWER
   CONFIG_SPL_STACK_R
   CONFIG_SPL_STACK_R_ADDR
   CONFIG_SPL_WATCHDOG
   CONFIG_SPL_TEXT_BASE

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_BMP_16BPP to Kconfig
Tom Rini [Sun, 31 Oct 2021 03:03:55 +0000 (23:03 -0400)]
Convert CONFIG_BMP_16BPP to Kconfig

This converts the following to Kconfig:
   CONFIG_BMP_16BPP

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_OF_EMBED to Kconfig
Tom Rini [Sun, 31 Oct 2021 03:03:54 +0000 (23:03 -0400)]
Convert CONFIG_OF_EMBED to Kconfig

This converts the following to Kconfig:
   CONFIG_OF_EMBED

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>
3 years agoConvert CONFIG_MCFUART to Kconfig
Tom Rini [Sun, 31 Oct 2021 03:03:53 +0000 (23:03 -0400)]
Convert CONFIG_MCFUART to Kconfig

This converts the following to Kconfig:
CONFIG_MCFUART

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_FEC_MXC to Kconfig
Tom Rini [Sun, 31 Oct 2021 03:03:52 +0000 (23:03 -0400)]
Convert CONFIG_FEC_MXC to Kconfig

This converts the following to Kconfig:
CONFIG_FEC_MXC

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_SUPPORT_EMMC_BOOT to Kconfig
Tom Rini [Sun, 31 Oct 2021 03:03:51 +0000 (23:03 -0400)]
Convert CONFIG_SUPPORT_EMMC_BOOT to Kconfig

This converts the following to Kconfig:
CONFIG_SUPPORT_EMMC_BOOT

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_SYS_TEXT_BASE to Kconfig
Tom Rini [Sun, 31 Oct 2021 03:03:50 +0000 (23:03 -0400)]
Convert CONFIG_SYS_TEXT_BASE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_TEXT_BASE

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_SYS_HZ to Kconfig
Tom Rini [Sun, 31 Oct 2021 03:03:49 +0000 (23:03 -0400)]
Convert CONFIG_SYS_HZ to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_HZ

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agospl: Make use of CONFIG_IS_ENABLED(OS_BOOT) in SPL/TPL common code paths
Tom Rini [Sun, 31 Oct 2021 03:03:48 +0000 (23:03 -0400)]
spl: Make use of CONFIG_IS_ENABLED(OS_BOOT) in SPL/TPL common code paths

When building a system that has both TPL and SPL_OS_BOOT, code which
tests for CONFIG_SPL_OS_BOOT will be built and enabled in TPL, which is
not correct.  While there is no CONFIG_TPL_OS_BOOT symbol at this time
(and likely will not ever be) we can use CONFIG_IS_ENABLED(OS_BOOT) in
these common paths to ensure we only compile these parts in the SPL
case.

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agofs: yaffs2: Finish Kconfig migration
Tom Rini [Wed, 20 Oct 2021 01:10:14 +0000 (21:10 -0400)]
fs: yaffs2: Finish Kconfig migration

For the symbols which are both hard-coded as enabled and used, move to
Kconfig.  The rest of the CONFIG_YAFFS namespace is unselected anywhere,
so we leave it as is.

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Thu, 4 Nov 2021 13:14:19 +0000 (09:14 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- Improved sysreset/watchdog uclass integration (Samuel)

3 years agosunxi: Use sysreset framework for poweroff/reset
Samuel Holland [Thu, 4 Nov 2021 03:55:16 +0000 (22:55 -0500)]
sunxi: Use sysreset framework for poweroff/reset

Instead of hardcoding the watchdog for reset, and the PMIC for poweroff,
use the sysreset framework to manage the available poweroff/reset
backends. This allows (as examples) using the PMIC to do a cold reset,
and using a GPIO to power off H3/H5 boards lacking a PMIC. Furthermore,
it removes the need to hardcode watchdog MMIO addresses, since the
sysreset backends can be discovered using the device tree.

Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agosunxi: Avoid duplicate reset_cpu with SYSRESET enabled
Samuel Holland [Thu, 4 Nov 2021 03:55:15 +0000 (22:55 -0500)]
sunxi: Avoid duplicate reset_cpu with SYSRESET enabled

The sysreset uclass unconditionally provides a definition of the
reset_cpu() function. So does the sunxi board code. Fix the build with
SYSRESET enabled by omitting the function from the board code in that
case. The code still needs to be kept around for use in SPL.

Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agowatchdog: Automatically register device with sysreset
Samuel Holland [Thu, 4 Nov 2021 03:55:14 +0000 (22:55 -0500)]
watchdog: Automatically register device with sysreset

Add an option to automatically register watchdog devices with the
wdt_reboot driver for use with sysreset. This allows sysreset to be a
drop-in replacement for platform-specific watchdog reset code, without
needing any device tree changes.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agosysreset: watchdog: Move watchdog reference to plat data
Samuel Holland [Thu, 4 Nov 2021 03:55:13 +0000 (22:55 -0500)]
sysreset: watchdog: Move watchdog reference to plat data

Currently, the wdt_reboot driver always gets its watchdog device
reference from an OF node. This prevents selecting a watchdog at
runtime. Move the watchdog device reference to the plat data, so
the driver can be bound with the reference pre-provided. The
reference will still be acquired from the OF node if it is not
already provided.

Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agosysreset: Mark driver probe functions as static
Samuel Holland [Thu, 4 Nov 2021 03:55:12 +0000 (22:55 -0500)]
sysreset: Mark driver probe functions as static

These driver probe functions are not (and should not be) called from
outside the respective driver source files. Therefore, the functions
should be marked static.

Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agosysreset: Add uclass Kconfig dependency to drivers
Samuel Holland [Thu, 4 Nov 2021 03:55:11 +0000 (22:55 -0500)]
sysreset: Add uclass Kconfig dependency to drivers

None of the sysreset drivers do anything beyond providing sysreset
uclass ops. They should depend on the sysreset uclass.

Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Wed, 3 Nov 2021 13:42:45 +0000 (09:42 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-usb

- usb: mtu3: flush cache for the first GPD when allocate GPD ring

3 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Wed, 3 Nov 2021 13:42:22 +0000 (09:42 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- pci_mvebu: Fix access to config space and PCIe Root Port (Pali)
- a37xx: pci: Program the data strobe for config read requests (Pali)
- kwboot: Misc improvements and fixes (Pali)

3 years agousb: mtu3: flush cache for the first GPD when allocate GPD ring
Chunfeng Yun [Thu, 21 Oct 2021 05:33:07 +0000 (13:33 +0800)]
usb: mtu3: flush cache for the first GPD when allocate GPD ring

When allocate the GPD ring, and tell its address to the controller, then
the driver starts or resumes the QMU, the controller will try to access
the first GPD, so need flush the first one to avoid wrong GPD status.

Reported-by: Xin Lin <Xin.Lin@mediatek.com>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
3 years agoarm: a37xx: pci: Program the data strobe for config read requests
Pali Rohár [Mon, 1 Nov 2021 09:12:51 +0000 (10:12 +0100)]
arm: a37xx: pci: Program the data strobe for config read requests

According to the Armada 3720 Functional Specification Data Strobe applies
for both read and write config requests.

Data strobe bits configure which bytes from the start address should be
returned for read request. Set value 0xf (all 4 bits) into Data Strobe
register to read all four bytes from specified 32-bit config space
register. Same value for Data Strobe register is programmed by Linux
pci-aardvark.c driver for config read requests.

Without this patch pci-aardvark driver sets data strobe register only
during config write operations. So any followup config read operations
could result with just partial datai returned (if previous write operation
was not 32-bit wide). This patch fixes it and ensures that config read
operations always read all bytes from requested register.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Do not send magic seq when changing baudrate back to 115200
Pali Rohár [Mon, 1 Nov 2021 13:00:02 +0000 (14:00 +0100)]
tools: kwboot: Do not send magic seq when changing baudrate back to 115200

After successful transfer of whole image only two things can happen:
- BootROM starts execution of data block, which changes UART baudrate
  back to 115200 Bd,
- board crashes and causes CPU reset

In both cases UART baudrate is reset to the default speed. So there is
no need to send special magic sequence to inform kwboot that baudrate is
going to be reset and kwboot does not need to wait for this event and
can do it immediately after BootROM acknowledges end of xmodem transfer.

Move ARM code for sending magic sequence from main baudrate change
section to binhdr_pre section which is executed only before changing
baudrate from the default value of 115200 Bd to some new value. Remove
kwboot code waiting for magic sequence after successful xmodem transfer.

Rationale: sometimes when using very high UART speeds, magic sequence is
damaged and kwboot fails at this last stage. Removal of this magic
sequence makes booting more stable.

Data transfer protocol (xmodem) is using checksums and retransmit, so it
already deals with possible errors on transfer line.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Do not use stack when setting baudrate back to default value
Pali Rohár [Wed, 27 Oct 2021 18:57:02 +0000 (20:57 +0200)]
tools: kwboot: Do not use stack when setting baudrate back to default value

The ARM code we inject into the image to change baudrate back to the
default value of 115200 Baud, which is run after successful UART transfer
of the whole image, cannot use stack as at this stage stack pointer is not
initialized yet.

Stack can only be used when BootROM is executing binary header, to
preserve state of registers, since BootROM expects that.

Change the ARM baudrate code to not use stack at all and put binary
header specific pre + post code (which stores and restores registers) into
separate arrays.

The baudrate change code now jumps at it's end and expects that there is
either code which returns to the BootROM or jumps to the original exec
address.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Replace ARM mov + movt instruction pair by mov + orr
Pali Rohár [Wed, 27 Oct 2021 18:57:01 +0000 (20:57 +0200)]
tools: kwboot: Replace ARM mov + movt instruction pair by mov + orr

Older Armada SoCs have custom ARMv5te compatible core which does not
support movt instruction. So replace mov + movt instruction pair used for
immediate move construction by mov + orr instructions which are supported
also by ARMv5te.

After this change kwboot ARM code should be compatible with any 32-bit ARM
core compatible by ARMv2 or new. At least GNU AS does not throw any error
or warning.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Increase delay after changing baudrate in ARM code
Pali Rohár [Wed, 27 Oct 2021 18:57:00 +0000 (20:57 +0200)]
tools: kwboot: Increase delay after changing baudrate in ARM code

Increase loop cycles from 600000 to 2998272, which should increase delay
from 1ms to about 5ms on 1200 MHz CPU.

The Number 2998272 was chosen as the nearest value around 3000000 which can
be encoded into one ARM mov instruction. It avoids usage of movt instruction
which is not supported by ARMv5te cores.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Do not call tcdrain() after each sent packet
Pali Rohár [Wed, 27 Oct 2021 18:56:59 +0000 (20:56 +0200)]
tools: kwboot: Do not call tcdrain() after each sent packet

Kwboot puts each xmodem packet to kernel queue, then waits until all bytes
of that packet are transmitted over UART and then waits for xmodem reply
until it is received into kernel queue.

If some reply is received during the time we are waiting until all bytes
are transmitted, then kernel puts them into the queue and returns it to
kwboot in next read() call.

So there is no need to wait (with tcdrain() function) until all bytes from
xmodem packet are transmitted over UART, since any reply received either
during that time or after is returned to kwboot with the next read().

Therefore do not call tcdrain() after each xmodem packet sent. Instead
directly wait for any reply after putting xmodem packet into write kernel
queue.

This change could speed up xmodem transfer in case tcdrain() function waits
for a longer time.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Fix sending retry of last header packet
Pali Rohár [Wed, 27 Oct 2021 18:56:58 +0000 (20:56 +0200)]
tools: kwboot: Fix sending retry of last header packet

After the trasfer of last header packet, it is possible that baudrate
change pattern is received, and also that NAK byte is received so that
the packet should be sent again.

Thus we should not clear the baudrate change state when sending retry
of that packet.

Move code for initializing state variables from kwboot_xm_recv_reply()
to kwboot_xm_sendblock().

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Resend first 3 xmodem retry packets immediately
Pali Rohár [Mon, 25 Oct 2021 13:13:04 +0000 (15:13 +0200)]
tools: kwboot: Resend first 3 xmodem retry packets immediately

Currently when kwboot receive some garbage reply which does not understand,
it waits 1s before it tries to resend packet again.

The most common error on UART is that receiver sees some bit flipped which
results in invalid reply.

This behavior slows down xmodem transfer over UART as basically on every
error kwboot is waiting one second.

To fix this, try to resend xmodem packet for first 3 attempts immediately
without any delay. If broken reply is received also after the 3 attempts,
continue retrying with 1s delay like it was before.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Change retry loop from decreasing to increasing
Pali Rohár [Mon, 25 Oct 2021 13:13:03 +0000 (15:13 +0200)]
tools: kwboot: Change retry loop from decreasing to increasing

This patch does not change behavior of the code, just allows to implement
new changes more easily.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Calculate real used space in kwbimage header when calling kwboot_img_g...
Pali Rohár [Mon, 25 Oct 2021 13:13:02 +0000 (15:13 +0200)]
tools: kwboot: Calculate real used space in kwbimage header when calling kwboot_img_grow_hdr()

Size of the header stored in kwbimage may be larger than real used size in
the kwbimage header. If there is unused space in kwbimage header then use
it for growing it. So update code to calculate used space of kwbimage
header.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Do not modify kwbimage header before increasing its size
Pali Rohár [Mon, 25 Oct 2021 13:13:01 +0000 (15:13 +0200)]
tools: kwboot: Do not modify kwbimage header before increasing its size

This ensures that kwboot_img_grow_hdr() function still sees valid kwbimage
header.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Simplify code for aligning image header
Pali Rohár [Mon, 25 Oct 2021 13:13:00 +0000 (15:13 +0200)]
tools: kwboot: Simplify code for aligning image header

Expression (hdrsz % KWBOOT_XM_BLKSZ) is non-zero therefore expression
(KWBOOT_XM_BLKSZ - hdrsz % KWBOOT_XM_BLKSZ) is always less than value
KWBOOT_XM_BLKSZ. So there is no need to add another modulo. Also rename
variable `offset` to `grow` which better describes what is stored in
this variable.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Show verbose message when waiting for baudrate change magic
Pali Rohár [Mon, 25 Oct 2021 13:12:59 +0000 (15:12 +0200)]
tools: kwboot: Show verbose message when waiting for baudrate change magic

It is hard to debug why kwboot is failing when the last message is
'Finishing transfer' and no additional output. So show verbose message when
kwboot finished transfer and is waiting for baudrate change magic sequence.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Correctly set configuration of UART for BootROM messages
Pali Rohár [Mon, 25 Oct 2021 13:12:58 +0000 (15:12 +0200)]
tools: kwboot: Correctly set configuration of UART for BootROM messages

For kwbimage v1, tell BootROM to send BootROM messages to UART port number
0 (used also for UART booting) with default baudrate (which should be
115200) and do not touch UART MPP configuration.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Recalculate 4-byte data checksum after injecting baudrate code
Pali Rohár [Mon, 25 Oct 2021 13:12:57 +0000 (15:12 +0200)]
tools: kwboot: Recalculate 4-byte data checksum after injecting baudrate code

If data part of image is modified, update 4-byte data checksum.

It looks like A385 BootROM does not verify this checksum for image
loaded via UART, but we do not know if other BootROMs are also ignoring
it. It is always better to provide correct checksum.

Signed-off-by: Pali Rohár <pali@kernel.org>
[ refactored ]
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Inject baudrate change back code after data part
Pali Rohár [Mon, 25 Oct 2021 13:12:56 +0000 (15:12 +0200)]
tools: kwboot: Inject baudrate change back code after data part

Some vendor U-Boot kwbimage binaries (e.g. those for A375) have load
address set to zero. Therefore it is not possible to inject code which
changes baudrate back to 115200 Bd before the data part.

So instead inject it after the data part and change kwbimage execution
address to that offset. Also store original execution address into
baudrate change code, so after it changes baudrate back to 115200 Bd, it
can jump to orignal address.

Signed-off-by: Pali Rohár <pali@kernel.org>
[ refactored ]
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>