]> git.baikalelectronics.ru Git - uboot.git/log
uboot.git
20 months agotools: kwboot: Fix parsing UART image without data checksum
Pali Rohár [Sun, 8 Jan 2023 12:38:27 +0000 (13:38 +0100)]
tools: kwboot: Fix parsing UART image without data checksum

The 32-bit data checksum in UART image is not checked by the BootROM and
also Marvell tools do not generate it.

So if data checksum stored in UART image does not match calculated checksum
from the image then treat those checksum bytes as part of the executable
image code (and not as the checksum) and for compatibility with the rest of
the code manually insert data checksum into the in-memory image after the
executable code, without overwriting it.

This should allow to boot UART images generated by Marvell tools.

Signed-off-by: Pali Rohár <pali@kernel.org>
20 months agotools: kwboot: Add image type documentation
Pali Rohár [Sat, 21 Jan 2023 18:57:28 +0000 (19:57 +0100)]
tools: kwboot: Add image type documentation

Add information of all available image types and where they should be
stored. Storage location offsets where documented from the disassembly of
the A385 BootROM image dump.

Signed-off-by: Pali Rohár <pali@kernel.org>
20 months agotools: kwboot: Add more documentation references
Pali Rohár [Sun, 8 Jan 2023 12:34:24 +0000 (13:34 +0100)]
tools: kwboot: Add more documentation references

Add reference to Avanta Boot Flow documentation, BobCat2, AlleyCat3 and
PONCat3 BootROM Firmware documentation and links to public Marvell tools:
hdrparser.c and doimage.c

Signed-off-by: Pali Rohár <pali@kernel.org>
20 months agoarm: mvebu: spl: Fix support for loading U-Boot proper from SD card
Pali Rohár [Sun, 8 Jan 2023 23:52:09 +0000 (00:52 +0100)]
arm: mvebu: spl: Fix support for loading U-Boot proper from SD card

Marvell BootROM loads MMC image from sector 0 (HW boot or data partition)
and SD image from sector 1.

So for SD card booting it is needed to not use constant CONFIG MMC options
and instead of them it is needed to define functions spl_mmc_boot_mode()
spl_mmc_get_uboot_raw_sector() which determinate offsets at SPL runtime
based on MMC or SD card.

Calculation of SD card sector expects following values:
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET=0
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0

Fixes: 3f0f1d263c27 ("arm: mvebu: Load U-Boot proper binary in SPL code based on kwbimage header")
Signed-off-by: Pali Rohár <pali@kernel.org>
20 months agospl: mmc: Allow to disable SYS_MMCSD_FS_BOOT_PARTITION
Pali Rohár [Sat, 21 Jan 2023 14:13:08 +0000 (15:13 +0100)]
spl: mmc: Allow to disable SYS_MMCSD_FS_BOOT_PARTITION

On some platforms is SYS_MMCSD_FS_BOOT_PARTITION unsupported. So allow to
completely disable MMC FS Boot support via new option SYS_MMCSD_FS_BOOT.

By default MMC FS Boot support is enabled (like it was before) except for
ARCH_MVEBU where MMC FS Boot supported is unsupported due to Marvell
BootROM limitations.

Signed-off-by: Pali Rohár <pali@kernel.org>
20 months agoarm: mvebu: spl: Load proper U-Boot from selected eMMC boot partition
Pali Rohár [Sun, 8 Jan 2023 12:31:41 +0000 (13:31 +0100)]
arm: mvebu: spl: Load proper U-Boot from selected eMMC boot partition

When eMMC boot is selected then BootROM loads kwbimage header (U-Boot SPL)
from the selected eMMC boot partition. So for eMMC boot ensure that U-Boot
SPL loads U-Boot proper (from kwbimage) also from the same selected eMMC
boot partition.

Fixes: 3f0f1d263c27 ("arm: mvebu: Load U-Boot proper binary in SPL code based on kwbimage header")
Signed-off-by: Pali Rohár <pali@kernel.org>
20 months agoarm: mvebu: spl: Remove checks for BOOT_DEVICE_MMC2 and BOOT_DEVICE_MMC2_2
Pali Rohár [Sun, 8 Jan 2023 12:27:07 +0000 (13:27 +0100)]
arm: mvebu: spl: Remove checks for BOOT_DEVICE_MMC2 and BOOT_DEVICE_MMC2_2

BOOT_DEVICE_MMC2 and BOOT_DEVICE_MMC2_2 are representing mmc dev 1 but all
Armada SoCs have only one mmc controller. So remove references to
non-existent second mmc controller.

Fixes: cea86a260cc8 ("arm: mvebu: Check that kwbimage blockid matches boot mode")
Signed-off-by: Pali Rohár <pali@kernel.org>
20 months agocmd: mvebu/bubt: Fix parsing SATA kwbimage
Pali Rohár [Sat, 21 Jan 2023 12:59:20 +0000 (13:59 +0100)]
cmd: mvebu/bubt: Fix parsing SATA kwbimage

Despite the official specification, Marvell BootROM does not interpret
srcaddr from SATA image as number of sectors the beginning of the hard
drive, but as number of sectors relative to the main header.

Reject invalid and accept valid SATA images.

Fixes: 433dcd954580 ("cmd: mvebu/bubt: Check for A38x image data checksum")
Signed-off-by: Pali Rohár <pali@kernel.org>
20 months agoarm: mvebu: spl: Fix parsing SATA kwbimage
Pali Rohár [Sat, 21 Jan 2023 12:47:45 +0000 (13:47 +0100)]
arm: mvebu: spl: Fix parsing SATA kwbimage

Despite the official specification, Marvell BootROM does not interpret
srcaddr from SATA image as number of sectors the beginning of the hard
drive, but as number of sectors relative to the main header.

To process SATA kwbimage and load U-Boot proper from it in the same way as
Marvell BootROM, it is needed to interpret srcaddr as relative offset to
the main header. This change fixes booting of U-Boot proper from SPL code
in SATA image.

Fixes: 3f0f1d263c27 ("arm: mvebu: Load U-Boot proper binary in SPL code based on kwbimage header")
Signed-off-by: Pali Rohár <pali@kernel.org>
20 months agotools: kwboot: Fix parsing SATA kwbimage
Pali Rohár [Sat, 21 Jan 2023 12:45:36 +0000 (13:45 +0100)]
tools: kwboot: Fix parsing SATA kwbimage

Despite the official specification, Marvell BootROM does not interpret
srcaddr from SATA image as number of sectors the beginning of the hard
drive, but as number of sectors relative to the main header.

To parse SATA kwbimage in the same way as Marvell BootROM, it is needed to
interpret srcaddr as relative offset to the main header. This change fixes
loading of SATA images via kwboot over UART.

Fixes: 90084caf87f8 ("tools: kwboot: Patch source address in image header")
Signed-off-by: Pali Rohár <pali@kernel.org>
20 months agotools: kwbimage: Fix generating, verifying and extracting SATA kwbimage
Pali Rohár [Sat, 21 Jan 2023 12:34:55 +0000 (13:34 +0100)]
tools: kwbimage: Fix generating, verifying and extracting SATA kwbimage

Despite the official specification, Marvell BootROM does not interpret
srcaddr from SATA image as number of sectors the beginning of the hard
drive, but as number of sectors relative to the main header.

The main header is stored at absolute sector number 1. So do not add or
subtract it when calculating with relative offsets to the main header.

Fixes: 524291a06058 ("tools: kwbimage: Fix generation of SATA, SDIO and PCIe images")
Fixes: 994f545998bf ("tools: kwbimage: Properly set srcaddr in kwbimage v0")
Fixes: 727cc2256b87 ("tools: kwbimage: Validate data checksum of v1 images")
Fixes: cd7773ade104 ("kwbimage: Add support for extracting images via dumpimage tool")
Signed-off-by: Pali Rohár <pali@kernel.org>
20 months agocmd: mvebu/bubt: Fix parsing SDIO kwbimage
Pali Rohár [Sun, 8 Jan 2023 12:18:39 +0000 (13:18 +0100)]
cmd: mvebu/bubt: Fix parsing SDIO kwbimage

Despite the official specification, Marvell BootROM does not interpret
srcaddr from SDIO image as offset in number of sectors (like for SATA
image), but as offset in bytes (like for all other images except SATA).

To ensure that we do not store invalid SDIO image to the boot location
(read by the Marvell BootROM), we need to check that image is valid
and srcaddr is intepreted in bytes, in the same way as it is done by
Marvell BootROM.

This fixes rejecting valid and accepting invalid SDIO images by bubt command.

Fixes: 433dcd954580 ("cmd: mvebu/bubt: Check for A38x image data checksum")
Signed-off-by: Pali Rohár <pali@kernel.org>
20 months agoarm: mvebu: spl: Fix parsing SDIO kwbimage
Pali Rohár [Sun, 8 Jan 2023 12:16:38 +0000 (13:16 +0100)]
arm: mvebu: spl: Fix parsing SDIO kwbimage

Despite the official specification, Marvell BootROM does not interpret
srcaddr from SDIO image as offset in number of sectors (like for SATA
image), but as offset in bytes (like for all other images except SATA).

To process SDIO kwbimage and load U-Boot proper from it in the same way as
Marvell BootROM, it is needed to interpret srcaddr in bytes. This change
fixes booting of U-Boot proper from SPL code stored in SDIO image.

Fixes: 3f0f1d263c27 ("arm: mvebu: Load U-Boot proper binary in SPL code based on kwbimage header")
Signed-off-by: Pali Rohár <pali@kernel.org>
20 months agotools: kwboot: Fix parsing SDIO kwbimage
Pali Rohár [Sun, 8 Jan 2023 12:20:20 +0000 (13:20 +0100)]
tools: kwboot: Fix parsing SDIO kwbimage

Despite the official specification, Marvell BootROM does not interpret
srcaddr from SDIO image as offset in number of sectors (like for SATA
image), but as offset in bytes (like for all other images except SATA).

To parse SDIO kwbimage in the same way as Marvell BootROM, it is needed to
interpret srcaddr in bytes. This change fixes loading of SDIO images via
kwboot over UART.

Fixes: 90084caf87f8 ("tools: kwboot: Patch source address in image header")
Signed-off-by: Pali Rohár <pali@kernel.org>
20 months agotools: kwbimage: Fix generating, verifying and extracting SDIO kwbimage
Pali Rohár [Sun, 8 Jan 2023 12:22:03 +0000 (13:22 +0100)]
tools: kwbimage: Fix generating, verifying and extracting SDIO kwbimage

Despite the official specification, Marvell BootROM does not interpret
srcaddr from SDIO image as offset in number of sectors (like for SATA
image), but as offset in bytes (like for all other images except SATA).

To generate SDIO kwbimage compatible with Marvell BootROM, it is needed to
have srcaddr in bytes. This change fixes SDIO images for Armada 38x SoCs.

Fixes: 524291a06058 ("tools: kwbimage: Fix generation of SATA, SDIO and PCIe images")
Fixes: 994f545998bf ("tools: kwbimage: Properly set srcaddr in kwbimage v0")
Fixes: 727cc2256b87 ("tools: kwbimage: Validate data checksum of v1 images")
Fixes: cd7773ade104 ("kwbimage: Add support for extracting images via dumpimage tool")
Signed-off-by: Pali Rohár <pali@kernel.org>
20 months agoMerge tag 'tpm-next-28022023' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Tue, 28 Feb 2023 14:50:16 +0000 (09:50 -0500)]
Merge tag 'tpm-next-28022023' of https://source.denx.de/u-boot/custodians/u-boot-tpm into next

TPM auto startup and testing:

Due to U-Boot's lazy binding we always relied on command line tools to
initialize the TPM subsystem and devices.  One exception is the EFI
subsystem.  When compiled with TCG2 measured boot support the TPM was
automatically initialized.

However that init was not complete.  The TCG specs [0] (and specifically
§12.3 Self-test modes) describe how self-tests on the device should be
performed.  This PR is adding an extra API function, that can be used to
initialize the TPM2.0 properly.

Simon added the equivalent for TPM1.2 and refactored the DM tests to
include the new funtion.

[0] https://trustedcomputinggroup.org/wp-content/uploads/TPM-Rev-2.0-Part-1-Architecture-01.07-2014-03-13.pdf

20 months agoMerge tag 'u-boot-nand-20230227' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Tue, 28 Feb 2023 14:46:07 +0000 (09:46 -0500)]
Merge tag 'u-boot-nand-20230227' of https://source.denx.de/u-boot/custodians/u-boot-nand-flash into next

Pull request for u-boot-nand-20230227

- mark reserved blocks from Ashok Reddy Soma
- backport BRCMNAND changes from Linux from Linus Walleij
- fix display of unknown raw ID from Patrice Chotard
- show reserved block in chip.erase from Michael Trimarchi

20 months agotpm: Implement tpm_auto_start() for TPMv1.2
Simon Glass [Tue, 21 Feb 2023 13:24:52 +0000 (06:24 -0700)]
tpm: Implement tpm_auto_start() for TPMv1.2

Add an implementation of this, moving the common call to tpm_init() up
into the common API implementation.

Add a test.

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
20 months agotpm: Separate out the TPM tests for v1 and v2
Simon Glass [Tue, 21 Feb 2023 13:24:51 +0000 (06:24 -0700)]
tpm: Separate out the TPM tests for v1 and v2

Currently there is only one test and it only works on TPM v2. Update it
to work on v1.2 as well, using a new function to pick up the required
TPM.

Update sandbox to include both a v1.2 and v2 TPM so that this works.
Split out the existing test into two pieces, one for init and one for
the v2-only report_state feature.

Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
20 months agotest: add a test for the new tpm_auto_start() function
Ilias Apalodimas [Sat, 18 Feb 2023 15:21:22 +0000 (17:21 +0200)]
test: add a test for the new tpm_auto_start() function

A prior patch adds a new API function for TPM2.0, which performs
the full startup sequence of the TPM.  Add a selftest for that.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
20 months agotpm: sandbox: Change the return code when device is already open
Ilias Apalodimas [Sat, 18 Feb 2023 15:18:49 +0000 (17:18 +0200)]
tpm: sandbox: Change the return code when device is already open

All the TPM drivers as well as out TCG TIS API for a TPM2.0 device
return -EBUSY if the device has already been opened.  Adjust
the sandbox TPM do return the same error code.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
20 months agoefi_loader: use tpm_auto_start for the tpm device
Ilias Apalodimas [Wed, 25 Jan 2023 11:06:03 +0000 (13:06 +0200)]
efi_loader: use tpm_auto_start for the tpm device

A previous commit is adding a new tpm startup functions which
initializes the TPMv2 and performs all the needed selftests.
Since the TPM selftests might be needed depending on the requested
algorithm or functional module use that instead.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
20 months agotpm: add a function that performs selftest + startup
Ilias Apalodimas [Wed, 25 Jan 2023 10:18:36 +0000 (12:18 +0200)]
tpm: add a function that performs selftest + startup

As described in [0] if a command requires use of an untested algorithm
or functional module, the TPM performs the test and then completes the
command actions.

Since we don't check for TPM_RC_NEEDS_TEST (which is the return code of
the TPM in that case) and even if we would, it would complicate our TPM
code for no apparent reason,  add a wrapper function that performs both
the selftest and the startup sequence of the TPM.

It's worth noting that this is implemented on TPMv2.0.  The code for
1.2 would look similar,  but I don't have a device available to test.

[0]
https://trustedcomputinggroup.org/wp-content/uploads/TPM-Rev-2.0-Part-1-Architecture-01.07-2014-03-13.pdf
§12.3 Self-test modes

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
20 months agoMerge tag 'v2023.04-rc3' into next
Tom Rini [Mon, 27 Feb 2023 22:28:21 +0000 (17:28 -0500)]
Merge tag 'v2023.04-rc3' into next

Prepare v2023.04-rc3

20 months agoDockerfile: Add missing "chmod" of u-boot-gen-combined
Tom Rini [Mon, 27 Feb 2023 15:49:54 +0000 (10:49 -0500)]
Dockerfile: Add missing "chmod" of u-boot-gen-combined

I had added this line locally, rebuild the image, but didn't ensure that
I had committed the correct version of the patch as well.

Fixes: 255f43b0ddc3 ("Dockerfile: download binaries for Nokia RX-51")
Signed-off-by: Tom Rini <trini@konsulko.com>
20 months agoPrepare v2023.04-rc3
Tom Rini [Mon, 27 Feb 2023 22:18:36 +0000 (17:18 -0500)]
Prepare v2023.04-rc3

Signed-off-by: Tom Rini <trini@konsulko.com>
20 months agomtd: nand: Show reserved block in chip.erase
Michael Trimarchi [Mon, 27 Feb 2023 15:01:43 +0000 (16:01 +0100)]
mtd: nand: Show reserved block in chip.erase

The "nand chip.erase" command always printed as bad blocks even in the
case of reserved blocks. Reserved blocks are used for storing bad block
tables. The patch displays "bbt reserved" when printing reserved blocks in
"nand chip.erase" command.

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
20 months agomtd: spinand: Fix display of unknown raw ID
Patrice Chotard [Mon, 13 Feb 2023 17:30:04 +0000 (18:30 +0100)]
mtd: spinand: Fix display of unknown raw ID

In case ID is not found in manufacturer table, the raw ID is
printed using %*phN format which is not supported by lib/vsprintf.c.
The information displayed doesn't reflect the raw ID return by the
unknown spi-nand.

Use %02x format instead, as done in spi-nor-core.c.

For example, before this patch:
  ERROR: spi-nand: spi_nand flash@0: unknown raw ID f74ec040
after
  ERROR: spi-nand: spi_nand flash@0: unknown raw ID 00 c2 26 03

Fixes: e5a603f2cd1d ("mtd: nand: Add core infrastructure to support SPI NANDs")
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Acked-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
20 months agomtd: rawnand: brcmnand: fix OOB R/W with Hamming ECC
Álvaro Fernández Rojas [Sat, 11 Feb 2023 15:29:09 +0000 (16:29 +0100)]
mtd: rawnand: brcmnand: fix OOB R/W with Hamming ECC

Hamming ECC doesn't cover the OOB data, so reading or writing OOB shall
always be done without ECC enabled.
This is a problem when adding JFFS2 cleanmarkers to erased blocks. If JFFS2
clenmarkers are added to the OOB with ECC enabled, OOB bytes will be changed
from ff ff ff to 00 00 00, reporting incorrect ECC errors.

Fixes: 27c5b17cd1b1 ("mtd: nand: add NAND driver "library" for Broadcom STB NAND controller")
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Acked-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20210224080210.23686-1-noltari@gmail.com
[Ported to U-Boot from the Linux kernel]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: William Zhang <william.zhang@broadcom.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
20 months agomtd: rawnand: brcmnand: support v2.1-v2.2 controllers
Álvaro Fernández Rojas [Sat, 11 Feb 2023 15:29:08 +0000 (16:29 +0100)]
mtd: rawnand: brcmnand: support v2.1-v2.2 controllers

v2.1: tested on Netgear DGND3700v1 (BCM6368)
v2.2: tested on Netgear DGND3700v2 (BCM6362)

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20200522121524.4161539-6-noltari@gmail.com
[Ported to U-Boot from the Linux kernel]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: William Zhang <william.zhang@broadcom.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
20 months agomtd: rawnand: brcmnand: rename page sizes
Álvaro Fernández Rojas [Sat, 11 Feb 2023 15:29:07 +0000 (16:29 +0100)]
mtd: rawnand: brcmnand: rename page sizes

Current pages sizes apply to controllers after v3.4

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20200522121524.4161539-4-noltari@gmail.com
[Ported to U-Boot from the Linux kernel]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: William Zhang <william.zhang@broadcom.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
20 months agomtd: rawnand: brcmnand: fix CS0 layout
Álvaro Fernández Rojas [Sat, 11 Feb 2023 15:29:06 +0000 (16:29 +0100)]
mtd: rawnand: brcmnand: fix CS0 layout

Only v3.3-v5.0 have a different CS0 layout.
Controllers before v3.3 use the same layout for every CS.

Fixes: 27c5b17cd1b1 ("mtd: nand: add NAND driver "library" for Broadcom STB NAND controller")
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20200522121524.4161539-3-noltari@gmail.com
[Ported to U-Boot from the Linux kernel]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Acked-by: William Zhang <william.zhang@broadcom.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
20 months agomtd: rawnand: brcmnand: rename v4 registers
Álvaro Fernández Rojas [Sat, 11 Feb 2023 15:29:05 +0000 (16:29 +0100)]
mtd: rawnand: brcmnand: rename v4 registers

These registers are also used on v3.3.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20200522121524.4161539-2-noltari@gmail.com
[Ported to U-Boot from the Linux kernel]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Acked-by: William Zhang <william.zhang@broadcom.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
20 months agomtd: rawnand: brcmnand: correctly verify erased pages
Álvaro Fernández Rojas [Sat, 11 Feb 2023 15:29:04 +0000 (16:29 +0100)]
mtd: rawnand: brcmnand: correctly verify erased pages

The current code checks that the whole OOB area is erased.
This is a problem when JFFS2 cleanmarkers are added to the OOB, since it will
fail due to the usable OOB bytes not being 0xff.
Correct this by only checking that data and ECC bytes aren't 0xff.

Fixes: 02b88eea9f9c ("mtd: brcmnand: Add check for erased page bitflips")
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20200512082451.771212-1-noltari@gmail.com
[Ported to U-Boot from the Linux kernel]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: William Zhang <william.zhang@broadcom.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
20 months agomtd: nand: brcmnand: Add support for flash-dma v0
Kamal Dasu [Sat, 11 Feb 2023 15:29:03 +0000 (16:29 +0100)]
mtd: nand: brcmnand: Add support for flash-dma v0

This change adds support for flash dma v0.0.

Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
[Ported to U-Boot from the Linux kernel]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: William Zhang <william.zhang@broadcom.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
20 months agomtd: rawnand: brcmnand: Fix ecc chunk calculation for erased page bitfips
Claire Lin [Sat, 11 Feb 2023 15:29:02 +0000 (16:29 +0100)]
mtd: rawnand: brcmnand: Fix ecc chunk calculation for erased page bitfips

In brcmstb_nand_verify_erased_page(), the ECC chunk pointer calculation
while correcting erased page bitflips is wrong, fix it.

Fixes: 02b88eea9f9c ("mtd: brcmnand: Add check for erased page bitflips")
Signed-off-by: Claire Lin <claire.lin@broadcom.com>
Reviewed-by: Ray Jui <ray.jui@broadcom.com>
Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
[Ported to U-Boot from the Linux kernel]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: William Zhang <william.zhang@broadcom.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
20 months agomtd: rawnand: brcmnand: Add support for v7.3 controller
Kamal Dasu [Sat, 11 Feb 2023 15:29:01 +0000 (16:29 +0100)]
mtd: rawnand: brcmnand: Add support for v7.3 controller

This change adds support for brcm NAND v7.3 controller. This controller
uses a newer version of flash_dma engine and change mostly implements
these differences.

Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
[Ported to U-Boot from the Linux kernel]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: William Zhang <william.zhang@broadcom.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
20 months agomtd: rawnand: brcmnand: Refactored code to introduce helper functions
Kamal Dasu [Sat, 11 Feb 2023 15:29:00 +0000 (16:29 +0100)]
mtd: rawnand: brcmnand: Refactored code to introduce helper functions

Refactored NAND ECC and CMD address configuration code to use helper
functions.

Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
[Ported to U-Boot from the Linux kernel]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Acked-by: William Zhang <william.zhang@broadcom.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
20 months agomtd: nand: Mark reserved blocks
Ashok Reddy Soma [Thu, 5 Jan 2023 09:46:20 +0000 (02:46 -0700)]
mtd: nand: Mark reserved blocks

Reserved blocks are used for storing bad block tables. With "nand bad"
command, these reserved blocks are shown as bad blocks. This is leading
to confusion when compared with Linux bad blocks. Hence, display
"bbt reserved" when printing reserved blocks with "nand bad" command.

To acheive this, return 2 which represents reserved from nand_isbad_bbt()
instead of 1 in case of reserved blocks and catch it in cmd/nand.c.

"nand bad" command display's hexadecimal numbers, so add "0x" prefix.

Example log will show up as below.

ZynqMP> nand bad

Device 0 bad blocks:
  0x00400000
  0x16800000
  0x16c00000
  0x17000000
  0x3d800000
  0x3e400000
  0xe8400000
  0xff000000  (bbt reserved)
  0xff400000  (bbt reserved)
  0xff800000  (bbt reserved)
  0xffc00000  (bbt reserved)
  0x116800000
  0x116c00000
  0x1ff000000  (bbt reserved)
  0x1ff400000  (bbt reserved)
  0x1ff800000  (bbt reserved)
  0x1ffc00000  (bbt reserved)

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Acked-By: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
20 months agoconfigs: Resync with savedefconfig
Tom Rini [Mon, 27 Feb 2023 14:11:57 +0000 (09:11 -0500)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
20 months agoMerge branch '2023-02-24-include-nx51-components-in-docker-for-testing' into next
Tom Rini [Sat, 25 Feb 2023 17:44:30 +0000 (12:44 -0500)]
Merge branch '2023-02-24-include-nx51-components-in-docker-for-testing' into next

- Merge in changes to our Dockerfile so that we build and download ahead
  of time all of the components required to run the nx51 test scripts.
  This will both speed up the specific job and address failures in Azure
  where the ipk files fail to download.

20 months agoCI: Update test/nokia_rx51_test.sh to use prebuilt images
Pali Rohár [Tue, 21 Feb 2023 16:22:29 +0000 (11:22 -0500)]
CI: Update test/nokia_rx51_test.sh to use prebuilt images

Now that the Dockerfile creates images which have the binaries we
require included, have CI make symlinks for them and update the existing
script to support this.

Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agoDockerfile: build qemu for Nokia n900
Heinrich Schuchardt [Fri, 13 Jan 2023 19:31:33 +0000 (20:31 +0100)]
Dockerfile: build qemu for Nokia n900

Using a pre-built QEMU saves a lot of time when testing.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
20 months agoDockerfile: download binaries for Nokia RX-51
Heinrich Schuchardt [Fri, 13 Jan 2023 18:25:01 +0000 (19:25 +0100)]
Dockerfile: download binaries for Nokia RX-51

Downloading files for a test may fail if the server is offline.
It is preferable to provide the files in our Docker image.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
21 months agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-tegra
Tom Rini [Thu, 23 Feb 2023 22:32:22 +0000 (17:32 -0500)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-tegra

21 months agoMerge branch '2023-02-23-assorted-fixes'
Tom Rini [Thu, 23 Feb 2023 22:30:49 +0000 (17:30 -0500)]
Merge branch '2023-02-23-assorted-fixes'

- btrfs bugfix, silence a bunch of gcc-12.2 linker warnings finally,
  relax one of the trace test time requirements (so CI doesn't fail due
  to test being slightly slow, but still correct), and correct env on
  MMC and checking for where GPT can be

21 months agoARM: tegra20: implement BCT patching
Svyatoslav Ryhel [Tue, 14 Feb 2023 17:35:38 +0000 (19:35 +0200)]
ARM: tegra20: implement BCT patching

This function allows updating bootloader from u-boot
on production devices without need in host PC.

Be aware! It works only with re-crypt BCT.

Tested-by: Robert Eckelmann <longnoserob@gmail.com> # ASUS TF101 T20
Signed-off-by: Ramin Khonsari <raminterex@yahoo.com>
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Tom <twarren@nvidia.com>
21 months agoARM: tegra30: implement BCT patching
Ramin Khonsari [Tue, 14 Feb 2023 17:35:37 +0000 (19:35 +0200)]
ARM: tegra30: implement BCT patching

This function allows updating bootloader from u-boot
on production devices without need in host PC.

Be aware! It works only with re-crypted BCT.

Tested-by: Andreas Westman Dorcsak <hedmoo@yahoo.com> # ASUS TF T30
Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # LG P895 T30
Signed-off-by: Ramin Khonsari <raminterex@yahoo.com>
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Tom <twarren@nvidia.com>
21 months agoARM: tegra: crypto: extend crypto functional
Svyatoslav Ryhel [Tue, 14 Feb 2023 17:35:36 +0000 (19:35 +0200)]
ARM: tegra: crypto: extend crypto functional

Add support for encryption, decryption and signinig with
non-zero key saving backward compatibility.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Tom <twarren@nvidia.com>
21 months agoARM: tegra: expose crypto module for all Tegra SoCs
Svyatoslav Ryhel [Tue, 14 Feb 2023 17:35:35 +0000 (19:35 +0200)]
ARM: tegra: expose crypto module for all Tegra SoCs

Move crypto module from T20 only into common Tegra dir.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Tom <twarren@nvidia.com>
21 months agoboard: tegra30: switch to updated pre-dm i2c write
Svyatoslav Ryhel [Tue, 14 Feb 2023 17:35:34 +0000 (19:35 +0200)]
board: tegra30: switch to updated pre-dm i2c write

Configure PMIC voltages for early stages using updated
early i2c write.

Tested-by: Thierry Reding <treding@nvidia.com> # Beaver T30
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom <twarren@nvidia.com>
21 months agoboard: tegra124: switch to updated pre-dm i2c write
Svyatoslav Ryhel [Tue, 14 Feb 2023 17:35:33 +0000 (19:35 +0200)]
board: tegra124: switch to updated pre-dm i2c write

Configure PMIC for early stages using updated i2c write.

Tested-by: Thierry Reding <treding@nvidia.com> # Jetson TK1 T124
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom <twarren@nvidia.com>
21 months agoARM: tegra: create common pre-dm i2c write
Svyatoslav Ryhel [Tue, 14 Feb 2023 17:35:32 +0000 (19:35 +0200)]
ARM: tegra: create common pre-dm i2c write

This implementation allows pwr i2c writing on early SPL
stages when DM is not yet setup.

Such writing is needed to configure main voltages of PMIC
on early SPL for bootloader to boot properly.

Tested-by: Andreas Westman Dorcsak <hedmoo@yahoo.com> # ASUS TF T30
Tested-by: Robert Eckelmann <longnoserob@gmail.com> # ASUS TF101 T20
Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # LG P895 T30
Tested-by: Thierry Reding <treding@nvidia.com> # T30 and T124
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Tom <twarren@nvidia.com>
21 months agoARM: tegra: add late init support
Svyatoslav Ryhel [Tue, 14 Feb 2023 17:35:31 +0000 (19:35 +0200)]
ARM: tegra: add late init support

Late init function allows passing values like identifiers and
perform device specific configurations of pre-boot stage.

Tested-by: Andreas Westman Dorcsak <hedmoo@yahoo.com> # ASUS TF T30
Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # LG P895 T30
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Tom <twarren@nvidia.com>
21 months agoARM: tegra: provide default USB gadget setup
Maxim Schwalm [Tue, 14 Feb 2023 17:35:30 +0000 (19:35 +0200)]
ARM: tegra: provide default USB gadget setup

All Nvidia boards use the same manufacturer, vendor ID and product ID
for the gadgets. Make them the defaults to remove some boilerplate from
the defconfigs.

Inspired by commit 7b09f5d03584 ("sunxi: provide default USB gadget
setup") which did the same for Allwinner boards.

Tested-by: Thierry Reding <treding@nvidia.com> # T30 and T124
Signed-off-by: Maxim Schwalm <maxim.schwalm@gmail.com>
Signed-off-by: Tom <twarren@nvidia.com>
21 months agospi: tegra20_slink: accept any word length
Svyatoslav Ryhel [Tue, 14 Feb 2023 17:35:29 +0000 (19:35 +0200)]
spi: tegra20_slink: accept any word length

Original t20 slink could work with commands only
fully divisible by 8. This patch removes such
restriction, so commands of any bitlength now
can be passed and processed.

Tested-by: Andreas Westman Dorcsak <hedmoo@yahoo.com> # ASUS TF600T T30
Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # LG P895 T30
Tested-by: Thierry Reding <treding@nvidia.com> # T30 and T124
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Tom <twarren@nvidia.com>
21 months agoARM: tegra: Fix Tegra PWM parent clock
Svyatoslav Ryhel [Tue, 14 Feb 2023 17:35:28 +0000 (19:35 +0200)]
ARM: tegra: Fix Tegra PWM parent clock

Default parent clock for the PWM on Tegra is a 32kHz clock and
is unable to support the requested PWM period.

Fix PWM support on Tegra20, Tegra30, Tegra114, Tegra124 and Tegra210 by
updating the parent clock for the PWM to be the PLL_P.

This commit is equivalent to Linux kernel commit:
https://lore.kernel.org/all/20221010100046.6477-1-jonathanh@nvidia.com/

Tested-by: Andreas Westman Dorcsak <hedmoo@yahoo.com> # ASUS TF T30
Tested-by: Robert Eckelmann <longnoserob@gmail.com> # ASUS TF101 T20
Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # ASUS TF201 T30
Tested-by: Thierry Reding <treding@nvidia.com> # T30 and T124
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Tom <twarren@nvidia.com>
21 months agoARM: tegra30: add PLLD to pll setup
Svyatoslav Ryhel [Tue, 14 Feb 2023 17:35:27 +0000 (19:35 +0200)]
ARM: tegra30: add PLLD to pll setup

On T30 unlike T20 dsi panels are wider used on devices
and PLLD is used as DISP1 parent more often, so lets
enable it as well for this cases.

Tested-by: Andreas Westman Dorcsak <hedmoo@yahoo.com> # ASUS TF700T T30
Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # HTC One X T30
Tested-by: Thierry Reding <treding@nvidia.com> # Beaver T30
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Tom <twarren@nvidia.com>
21 months agoARM: tegra: clock: add clock_decode_pair helper
Svyatoslav Ryhel [Tue, 14 Feb 2023 17:35:26 +0000 (19:35 +0200)]
ARM: tegra: clock: add clock_decode_pair helper

Get periph clock id and its parent from device tree.
This works by looking up the peripheral's 'clocks' node and
reading out the second and fourth cells, which are the
peripheral and PLL clock numbers.

Tested-by: Andreas Westman Dorcsak <hedmoo@yahoo.com> # ASUS TF T30
Tested-by: Robert Eckelmann <longnoserob@gmail.com> # ASUS TF101 T20
Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # HTC One X
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Tom <twarren@nvidia.com>
21 months agoARM: tegra: clock: add clk_id_to_pll_id helper
Svyatoslav Ryhel [Tue, 14 Feb 2023 17:35:25 +0000 (19:35 +0200)]
ARM: tegra: clock: add clk_id_to_pll_id helper

This function allows to convert a device tree clock ID to PLL ID.

Tested-by: Andreas Westman Dorcsak <hedmoo@yahoo.com> # ASUS TF T30
Tested-by: Robert Eckelmann <longnoserob@gmail.com> # ASUS TF101 T20
Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # HTC One X
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Tom <twarren@nvidia.com>
21 months agoARM: t20/t30: swap host1x and disp1 clock parents
Svyatoslav Ryhel [Tue, 14 Feb 2023 17:35:24 +0000 (19:35 +0200)]
ARM: t20/t30: swap host1x and disp1 clock parents

According to mainline clock tables and TRM HOST1X
parent is PLLC, while DISP1 usually uses PLLP as
parent clock.

Tested-by: Andreas Westman Dorcsak <hedmoo@yahoo.com> # ASUS TF T30
Tested-by: Robert Eckelmann <longnoserob@gmail.com> # ASUS TF101 T20
Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # LG P895 T30
Tested-by: Thierry Reding <treding@nvidia.com> # Beaver T30
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Tom <twarren@nvidia.com>
21 months agotegra30: clock: add EXTPERIPH
Svyatoslav Ryhel [Tue, 14 Feb 2023 17:35:23 +0000 (19:35 +0200)]
tegra30: clock: add EXTPERIPH

This mappings were missing for some reason.

Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # LG P895 T30
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom <twarren@nvidia.com>
21 months agoenv: mmc: Apply GPT only on eMMC user HW partition
Marek Vasut [Thu, 9 Feb 2023 12:30:10 +0000 (13:30 +0100)]
env: mmc: Apply GPT only on eMMC user HW partition

Apply the GPT U-Boot environment GUID type look up only on eMMC user
HW partition, do not apply the look up on eMMC boot HW partitions as
mmc_offset_try_partition() assumes either SD partitions or eMMC user
HW partition.

This fixes environment operation on systems where CONFIG_SYS_MMC_ENV_PART
is non-zero and CONFIG_SYS_REDUNDAND_ENVIRONMENT is set.

Fixes: 7b492406689 ("env: mmc: select GPT env partition by type guid")
Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
21 months agotrace: Relax test requirements
Simon Glass [Fri, 17 Feb 2023 22:45:16 +0000 (15:45 -0700)]
trace: Relax test requirements

We expect the profile and bootstage to agree on timing, but when
running on slow machines there can be a larger descrepency. Increase the
tolerance to fix this.

Fixes: 4c0c83c9070 ("trace: Add a test")
Signed-off-by: Simon Glass <sjg@chromium.org>
21 months agox86: Pass -z execstack for EFI payload flags
Tom Rini [Tue, 14 Feb 2023 20:09:32 +0000 (15:09 -0500)]
x86: Pass -z execstack for EFI payload flags

To match how we link EFI executables elsewhere, and to silence a linker
warning, pass -z execstack here as well.

Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
21 months agoMakefile: Link with -z noexectack
Tom Rini [Tue, 14 Feb 2023 20:09:31 +0000 (15:09 -0500)]
Makefile: Link with -z noexectack

When moving to gcc-12.2 we started trying to quiet some of the new
linker warnings, that are not relevant to us. However, a
misunderstanding of the mechanics at play meant that I intentionally
omitted passing -z noexecstack to the linker, when we do need to. Add
this flag and in turn remove warnings from the linker.

Fixes: e30a33becdef ("Makefile: link with --no-warn-rwx-segments")
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
21 months agofs: btrfs: limit the mapped length to the original length
Qu Wenruo [Mon, 13 Feb 2023 00:37:59 +0000 (08:37 +0800)]
fs: btrfs: limit the mapped length to the original length

[BUG]
There is a bug report that btrfs driver caused hang during file read:

  This breaks btrfs on the HiFive Unmatched.

  => pci enum
  PCIE-0: Link up (Gen1-x8, Bus0)
  => nvme scan
  => load nvme 0:2 0x8c000000 /boot/dtb/sifive/hifive-unmatched-a00.dtb
  [hangs]

[CAUSE]
The reporter provided some debug output:

  read_extent_data: cur=615817216, orig_len=16384, cur_len=16384
  read_extent_data: btrfs_map_block: cur_len=479944704; ret=0
  read_extent_data: ret=0
  read_extent_data: cur=615833600, orig_len=4096, cur_len=4096
  read_extent_data: btrfs_map_block: cur_len=479928320; ret=0

Note the second and the last line, the @cur_len is 450+MiB, which is
almost a chunk size.

And inside __btrfs_map_block(), we limits the returned value to stripe
length, but that's depending on the chunk type:

if (map->type & (BTRFS_BLOCK_GROUP_RAID0 | BTRFS_BLOCK_GROUP_RAID1 |
 BTRFS_BLOCK_GROUP_RAID1C3 | BTRFS_BLOCK_GROUP_RAID1C4 |
 BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6 |
 BTRFS_BLOCK_GROUP_RAID10 |
 BTRFS_BLOCK_GROUP_DUP)) {
/* we limit the length of each bio to what fits in a stripe */
*length = min_t(u64, ce->size - offset,
      map->stripe_len - stripe_offset);
} else {
*length = ce->size - offset;
}

This means, if the chunk is SINGLE profile, then we don't limit the
returned length at all, and even for other profiles, we can still return
a length much larger than the requested one.

[FIX]
Properly clamp the returned length, preventing it from returning a much
larger range than expected.

Reported-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Qu Wenruo <wqu@suse.com>
21 months agousb: dwc3-uniphier: Select PHY
Marek Vasut [Thu, 23 Feb 2023 16:29:24 +0000 (17:29 +0100)]
usb: dwc3-uniphier: Select PHY

Make sure the PHY subsystem is activated for the uniphier DWC3 glue
logic, as it depends on PHY implementation there.

Signed-off-by: Marek Vasut <marex@denx.de>
21 months agoMerge branch 'next' of git://source.denx.de/u-boot-usb into next
Tom Rini [Wed, 22 Feb 2023 23:21:40 +0000 (18:21 -0500)]
Merge branch 'next' of git://source.denx.de/u-boot-usb into next

- dwc3-generic rework and then switch uniphier to it

21 months agouniphier_defconfig: Disable USB_XHCI_DWC3
Kunihiko Hayashi [Mon, 20 Feb 2023 05:50:34 +0000 (14:50 +0900)]
uniphier_defconfig: Disable USB_XHCI_DWC3

Replacing with dwc3-generic, no need USB_XHCI_DWC3 anymore.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Marek Vasut <marex@denx.de>
21 months agousb: dwc3-uniphier: Use dwc3-generic instead of xhci-dwc3
Kunihiko Hayashi [Mon, 20 Feb 2023 05:50:33 +0000 (14:50 +0900)]
usb: dwc3-uniphier: Use dwc3-generic instead of xhci-dwc3

dwc3-uniphier depends on xhci-dwc3 framework, however, it is preferable
to use dwc3-generic.

This driver calls the exported dwc3-generic functions and redefine
the SoC-dependent operations to fit dwc3-generic.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Marek Vasut <marex@denx.de>
21 months agophy: socionext: Add UniPhier USB3 PHY driver
Kunihiko Hayashi [Mon, 20 Feb 2023 05:50:32 +0000 (14:50 +0900)]
phy: socionext: Add UniPhier USB3 PHY driver

Add USB3 PHY driver support to control clocks and resets needed to enable
PHY. The phy_ops->init() and exit() control PHY clocks and resets only,
and clocks and resets for the controller and the parent logic are enabled
in advance.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Marek Vasut <marex@denx.de>
21 months agoclk: uniphier: Add missing USB SS-PHY clocks
Kunihiko Hayashi [Mon, 20 Feb 2023 05:50:31 +0000 (14:50 +0900)]
clk: uniphier: Add missing USB SS-PHY clocks

The USB SS-PHY needs its own clock, however, some clocks don't have
clock gates. Define missing clock entries for the PHY as reference
clock.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Marek Vasut <marex@denx.de>
21 months agoreset: uniphier: Add USB glue reset support
Kunihiko Hayashi [Mon, 20 Feb 2023 05:50:30 +0000 (14:50 +0900)]
reset: uniphier: Add USB glue reset support

Add reset control support in USB glue logic. This needs to control
the external clocks and resets for the logic before accessing the
glue logic.

The USB dm tree when using dwc3-generic is the following:

   USB glue
     +-- controller       (need controller-reset)
     +-- controller-reset (need syscon-reset)
     +-- phy

The controller needs to deassert "controller-reset" in USB glue before
the controller registers are accessed. The glue needs to deassert
"syscon-reset" before the glue registers are accessed.

The glue itself doesn't have "syscon-reset", so the controller-reset
controls "syscon-reset" instead.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Marek Vasut <marex@denx.de>
21 months agousb: dwc3-generic: Add the size of regs property to glue structure
Kunihiko Hayashi [Mon, 20 Feb 2023 05:50:29 +0000 (14:50 +0900)]
usb: dwc3-generic: Add the size of regs property to glue structure

Add the size of regs property to the glue structure to correctly
specify the register region to map.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Marek Vasut <marex@denx.de>
21 months agousb: dwc3-generic: Export glue structures and functions
Kunihiko Hayashi [Mon, 20 Feb 2023 05:50:28 +0000 (14:50 +0900)]
usb: dwc3-generic: Export glue structures and functions

In order to allow external SoC-dependent glue drivers to use dwc3-generic
functions, push the glue structures and export the functions to a header
file.

The exported structures and functions are:

- struct dwc3_glue_data
- struct dwc3_glue_ops
- dwc3_glue_bind()
- dwc3_glue_probe()
- dwc3_glue_remove()

The SoC-dependent glue drivers can only define their own wrapper driver
and specify these functions. The drivers can also add their own compatible
strings and configure functions.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Marek Vasut <marex@denx.de>
21 months agousb: dwc3-generic: Add clock initialization in child DT node
Kunihiko Hayashi [Mon, 20 Feb 2023 05:50:27 +0000 (14:50 +0900)]
usb: dwc3-generic: Add clock initialization in child DT node

Same as the reset cotnrol, should add a clock initialization in child DT
node, if the glue node doesn't have any clocks.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Marek Vasut <marex@denx.de>
21 months agousb: dwc3-generic: Allow different controller DT node pattern
Kunihiko Hayashi [Mon, 20 Feb 2023 05:50:26 +0000 (14:50 +0900)]
usb: dwc3-generic: Allow different controller DT node pattern

The most of devicetree has the following USB node structure.
The controller node is placed as a child node of the glue node.
Current dwc3-generic driver works on this premise.

    glue {
        /* glue node */
usb {
            /* controller node */
};
    };

However, UniPhier original devicetree has the following USB node structure.
The controller node is separately placed from the glue node.

    usb {
        /* controller node */
    };
    glue {
        /* glue node */
    };

In dwc_glue_bind(), this patch provides .glue_get_ctrl_dev() callback to
get such a controller node and binds the driver related to the node.

If this callback isn't defined, dwc_glue_bind() looks for the controller
nodes from the child nodes, as before.

Suggested-by: Marek Vasut <marex@denx.de>
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Marek Vasut <marex@denx.de>
21 months agousb: dwc3: Look up reference clock DT phandle in both controller DT nodes
Marek Vasut [Mon, 20 Feb 2023 05:50:25 +0000 (14:50 +0900)]
usb: dwc3: Look up reference clock DT phandle in both controller DT nodes

There are currently four disparate placement possibilities of DWC3
reference clock phandle in SoC DTs:
- in top level glue node, with generic subnode without clock (ZynqMP)
- in top level generic node, with no subnode (i.MX8MQ)
- in generic subnode, with other clock in top level node (i.MX8MP)
- in both top level node and generic subnode (Rockchip)

Cover all the possibilities here by looking into both nodes, start
with the top level node as that seems to be used in majority of DTs
to reference the clock.

Signed-off-by: Marek Vasut <marex@denx.de>
Acked-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
21 months agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Wed, 22 Feb 2023 18:36:29 +0000 (13:36 -0500)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-usb

- DWC3 bugfix

21 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-socfpga
Tom Rini [Wed, 22 Feb 2023 14:28:03 +0000 (09:28 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-socfpga

- chameleonv3 updates

21 months agochameleonv3: Convert CONFIG_SPL_MAX_SIZE to Kconfig
Paweł Anikiel [Tue, 21 Feb 2023 15:17:06 +0000 (16:17 +0100)]
chameleonv3: Convert CONFIG_SPL_MAX_SIZE to Kconfig

This file was missed during the conversion process. Add the symbol to
defconfig.

Signed-off-by: Paweł Anikiel <pan@semihalf.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
21 months agoarm: dts: chameleonv3: Add 270-2 variant
Paweł Anikiel [Tue, 21 Feb 2023 15:17:05 +0000 (16:17 +0100)]
arm: dts: chameleonv3: Add 270-2 variant

Add devicetree for chameleonv3 with the 270-2I2-D11E variant of the
Mercury+ AA1 module

Signed-off-by: Paweł Anikiel <pan@semihalf.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
21 months agoarm: dts: chameleonv3: Rename chameleonv3.dts to .dtsi
Paweł Anikiel [Tue, 21 Feb 2023 15:17:04 +0000 (16:17 +0100)]
arm: dts: chameleonv3: Rename chameleonv3.dts to .dtsi

This file is included by the different chameleonv3 variants. Change the
name to .dtsi.

Signed-off-by: Paweł Anikiel <pan@semihalf.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
21 months agoarm: dts: chameleonv3: Override chameleonv3 bitstream names
Paweł Anikiel [Tue, 21 Feb 2023 15:17:03 +0000 (16:17 +0100)]
arm: dts: chameleonv3: Override chameleonv3 bitstream names

Set the bitstream name per Chameleon variant. This allows the same
boot filesystem with all bitstream variants to be used on different
boards.

Signed-off-by: Paweł Anikiel <pan@semihalf.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
21 months agosocfpga: chameleonv3: Move environment to a text file
Paweł Anikiel [Tue, 21 Feb 2023 15:17:02 +0000 (16:17 +0100)]
socfpga: chameleonv3: Move environment to a text file

Move the environment to an easily editable text file in the boot
partition

Signed-off-by: Paweł Anikiel <pan@semihalf.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
21 months agosocfpga: chameleonv3: Enable ext4 in SPL
Paweł Anikiel [Tue, 21 Feb 2023 15:17:01 +0000 (16:17 +0100)]
socfpga: chameleonv3: Enable ext4 in SPL

Allow SPL to boot from an ext4 filesystem.

Signed-off-by: Paweł Anikiel <pan@semihalf.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
21 months agousb: dwc3: Use the devm_gpiod_get_optional() API for reset gpio
Venkatesh Yadav Abbarapu [Fri, 13 Jan 2023 05:12:02 +0000 (10:42 +0530)]
usb: dwc3: Use the devm_gpiod_get_optional() API for reset gpio

As the "reset-gpios" property is optional, don't return the
error and just skip the gpio reset sequence.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
21 months agoMerge tag 'efi-2023-04-rc3' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sun, 19 Feb 2023 22:03:30 +0000 (17:03 -0500)]
Merge tag 'efi-2023-04-rc3' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2023-04-rc3

Documentation

* Add a document for the RISC-V architecture
* Move gateworks and bcm7xxx documentation to HTML

UEFI

* measure the loaded device-tree
* make CapsuleMax configurable and provide sensible default

21 months agodoc: remove superfluous warning
Heinrich Schuchardt [Sun, 19 Feb 2023 20:26:24 +0000 (21:26 +0100)]
doc: remove superfluous warning

We have been using Sphinx >=3 since 2020. We don't expect issues.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
21 months agoefi_loader: set CapsuleMax from CONFIG_EFI_CAPSULE_MAX
Etienne Carriere [Thu, 16 Feb 2023 17:21:41 +0000 (18:21 +0100)]
efi_loader: set CapsuleMax from CONFIG_EFI_CAPSULE_MAX

Adds CONFIG_EFI_CAPSULE_MAX to configure the max index value used in
EFI capsule reports. Prior to this change is the hard coded value was
65535 which would exceed available storage for variables. Now the
default value is 15 which should work fine with most systems.

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
21 months agoefi_loader: Measure the loaded DTB
Etienne Carriere [Thu, 16 Feb 2023 16:29:48 +0000 (17:29 +0100)]
efi_loader: Measure the loaded DTB

Measures the DTB passed to the EFI application upon new boolean config
switch CONFIG_EFI_TCG2_PROTOCOL_MEASURE_DTB. For platforms where the
content of the DTB passed to the OS can change across reboots, there is
not point measuring it hence the config switch to allow platform to not
embed this feature.

Co-developed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Tested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
21 months agoefi_loader: fix wrong attribute check for QueryVariableInfo
Masahisa Kojima [Wed, 15 Feb 2023 02:32:17 +0000 (11:32 +0900)]
efi_loader: fix wrong attribute check for QueryVariableInfo

QueryVariableInfo with EFI_VARIABLE_HARDWARE_ERROR_RECORD is
accepted, remove wrong attribute check.

Fixes: 9195ef414f04 ("efi_loader: update attribute check for QueryVariableInfo()")
Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
21 months agoefi_loader: avoid buffer overrun in efi_var_mem_compare
Heinrich Schuchardt [Mon, 13 Feb 2023 18:22:33 +0000 (19:22 +0100)]
efi_loader: avoid buffer overrun in efi_var_mem_compare

We should not scan beyond the end of string name.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
21 months agodoc: arch: Add document for RISC-V architecture
Yu Chien Peter Lin [Tue, 14 Feb 2023 10:18:51 +0000 (18:18 +0800)]
doc: arch: Add document for RISC-V architecture

This patch adds a brief introduction to the RISC-V architecture and
the typical boot process used on a variety of RISC-V platforms.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
21 months agoboard: gateworks: venice: move README to RST
Tim Harvey [Mon, 13 Feb 2023 17:44:27 +0000 (09:44 -0800)]
board: gateworks: venice: move README to RST

Move board/gateworks/venice/README to RST documentation.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
21 months agodoc: board: bcm7xxx: Convert to reStructuredText format
Thomas Fitzsimmons [Mon, 13 Feb 2023 16:21:27 +0000 (11:21 -0500)]
doc: board: bcm7xxx: Convert to reStructuredText format

Convert the documentation for the Broadcom BCM7445 and BCM7260 boards
to reStructuredText format and add the new filename to
doc/board/broadcom/index.rst.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
21 months agodoc: devicetree: dt_qemu.rst: Fix the typo and space
Yu Chien Peter Lin [Sun, 12 Feb 2023 07:09:51 +0000 (15:09 +0800)]
doc: devicetree: dt_qemu.rst: Fix the typo and space

Fix typo and whitespace in the document.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
21 months agoMerge branch '2023-02-17-assorted-fixes'
Tom Rini [Fri, 17 Feb 2023 19:18:46 +0000 (14:18 -0500)]
Merge branch '2023-02-17-assorted-fixes'

- avb_verify bugfix, and cpsw_mdio bugfix

21 months agocommon: avb_verify: prevent opening incorrect session
Ivan Khoronzhuk [Fri, 27 Jan 2023 20:02:14 +0000 (22:02 +0200)]
common: avb_verify: prevent opening incorrect session

The arg->session is not valid if arg->ret != NULL, so can't be
assigned, correct this.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@globallogic.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>