]> git.ipfire.org Git - thirdparty/u-boot.git/log
thirdparty/u-boot.git
3 years agousb: dwc3-meson-g12a: Select PHY instead of imply PHY
Marek Vasut [Thu, 23 Feb 2023 16:32:43 +0000 (17:32 +0100)] 
usb: dwc3-meson-g12a: Select PHY instead of imply PHY

Imply means you can turn off the option and expect things to work
- "it's a good idea to have X enabled" is when to use imply
- "you must have X for Y to work" is when to use select

Use "select" here.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
3 years agos5p: Remove empty arch_misc_init
Tom Rini [Thu, 16 Feb 2023 03:36:55 +0000 (22:36 -0500)] 
s5p: Remove empty arch_misc_init

We don't need to provide an empty arch_misc_init function here, we can
just not enable the hook.

Cc: Stefan Bosch <stefan_b@posteo.net>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>
3 years agomvebu: Drop empty arch_misc_init
Tom Rini [Thu, 16 Feb 2023 03:36:54 +0000 (22:36 -0500)] 
mvebu: Drop empty arch_misc_init

If this hooks is needed later, it should be added and populated for
real.

Cc: Stefan Roese <sr@denx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agomvebe: Drop ARCH_MISC_INIT from alleycat 5
Tom Rini [Thu, 16 Feb 2023 03:36:53 +0000 (22:36 -0500)] 
mvebe: Drop ARCH_MISC_INIT from alleycat 5

In this platform, arch_misc_init doesn't perform any real function. The
call to get_soc_type_rev has no lasting side effects.

Cc: Chris Packham <chris.packham@alliedtelesis.co.nz>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
3 years agoimx9: Remove ARCH_MISC_INIT
Tom Rini [Thu, 16 Feb 2023 03:36:52 +0000 (22:36 -0500)] 
imx9: Remove ARCH_MISC_INIT

We don't need an empty function, we can just not enable the hook we
don't use.

Cc: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
3 years agocommon: Make ARCH_EARLY_INIT_R be selected only
Tom Rini [Thu, 16 Feb 2023 03:36:51 +0000 (22:36 -0500)] 
common: Make ARCH_EARLY_INIT_R be selected only

As platforms which require this hook need this hook enabled, in order to
function, or do not need this hook, it doesn't make sense to prompt the
user. As all platforms that need this hook now select the symbol, remove
the prompt text.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoarm: rk3368: Select ARCH_EARLY_INIT_R when used
Tom Rini [Thu, 16 Feb 2023 03:36:50 +0000 (22:36 -0500)] 
arm: rk3368: Select ARCH_EARLY_INIT_R when used

On the lion and evb-px5 platforms, we need this function, so select it.

Cc: Andy Yan <andy.yan@rock-chips.com>
Cc: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Cc: Klaus Goger <klaus.goger@theobroma-systems.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
3 years agoarm: zynq: Move to select'ing ARCH_EARLY_INIT_R if we have FPGA
Tom Rini [Thu, 16 Feb 2023 03:36:49 +0000 (22:36 -0500)] 
arm: zynq: Move to select'ing ARCH_EARLY_INIT_R if we have FPGA

The function arch_early_init_r only does anything on these platforms if
we have FPGA (or SPL and SPL_FPGA) enabled, so move the logic to select
based on that.

Cc: Michal Simek <michal.simek@amd.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Michal Simek <michal.simek@amd.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoarm: mvebu: Add select on ARCH_EARLY_INIT_R if ARM64
Tom Rini [Thu, 16 Feb 2023 03:36:48 +0000 (22:36 -0500)] 
arm: mvebu: Add select on ARCH_EARLY_INIT_R if ARM64

We need to be calling arch_early_init_r() on 64bit mvebu platforms, so
move this to a select.

Cc: Stefan Roese <sr@denx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agocommon/Kconfig: Reword text for BOARD_TYPES
Tom Rini [Thu, 16 Feb 2023 03:36:47 +0000 (22:36 -0500)] 
common/Kconfig: Reword text for BOARD_TYPES

While it is true that for some Samsung platforms, we call
get_board_type() the main usage of this CONFIG switch is to enable
board_types in global data, which is then used by various platforms.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoMerge tag 'dm-pull-29feb23' of https://source.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Wed, 1 Mar 2023 21:07:24 +0000 (16:07 -0500)] 
Merge tag 'dm-pull-29feb23' of https://source.denx.de/u-boot/custodians/u-boot-dm

minor sandbox fixes
a37xx fix
Add camel-case tool, since the conversion will take a while

3 years agotools: binman: minor formatting fix in docs
Ralph Siemsen [Wed, 22 Feb 2023 20:56:59 +0000 (15:56 -0500)] 
tools: binman: minor formatting fix in docs

This should fix a rendering oddity when viewing the docs online at
https://u-boot.readthedocs.io/en/latest/develop/package/binman.html

Signed-off-by: Ralph Siemsen <ralph.siemsen@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: fix building with CONFIG_SPL_TIMER=y
Heinrich Schuchardt [Wed, 22 Feb 2023 00:39:18 +0000 (01:39 +0100)] 
sandbox: fix building with CONFIG_SPL_TIMER=y

Building sandbox_defconfig with CONFIG_SPL_TIMER=y results in an error

    include/dm/platdata.h:63:33: error: static assertion failed:
    "Cannot use U_BOOT_DRVINFO with of-platdata.
    Please use devicetree instead"

Add a missing condition in the sandbox driver.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoMAINTAINERS: assign sandbox drivers to SANDBOX
Heinrich Schuchardt [Sat, 18 Feb 2023 09:38:11 +0000 (10:38 +0100)] 
MAINTAINERS: assign sandbox drivers to SANDBOX

Drivers should have a maintainer.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: allow building sandbox_spl with CONFIG_DEBUG
Heinrich Schuchardt [Sat, 18 Feb 2023 08:33:51 +0000 (09:33 +0100)] 
sandbox: allow building sandbox_spl with CONFIG_DEBUG

Building sandbox_spl with CONFIG_DEBUG leads to errors due to missing
symbols:

    /usr/bin/ld: common/spl/spl_fit.o: in function `spl_fit_upload_fpga':
    common/spl/spl_fit.c:595: undefined reference to `fpga_load'
    /usr/bin/ld: test/test-main.o: in function `dm_test_post_run':
    test/test-main.c:124: undefined reference to `crc8'
    /usr/bin/ld: test/test-main.o: in function `dm_test_pre_run':
    test/test-main.c:95: undefined reference to `crc8'
    collect2: error: ld returned 1 exit status

This is due to -Og not eliminating unused functions.

Add FPGA and CRC8 support to the defconfig. Sandbox tests for
SPL_FPGA and CRC8 should be created. So enabling these setting
is advised anyway.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoarm64: a37xx: pinctrl: probe after binding
Robert Marko [Tue, 17 Jan 2023 14:08:15 +0000 (15:08 +0100)] 
arm64: a37xx: pinctrl: probe after binding

Currently, pinctrl drivers are getting probed during post-bind, however
that is being reverted, and on A37XX pinctrl driver is the one that
registers the GPIO driver during the probe.

So, if the pinctrl driver doesn't get probed GPIO-s won't get registered
and thus they cannot be used.

This is a problem on the Methode eDPU as it just uses SB pins as GPIO-s
and without them being registered networking won't work as it only has
one SFP slot and the TX disable GPIO is on the SB controller.

So, lets just add a flag only to A37XX driver to probe after binding
in order for the GPIO driver to always get registered.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: Correctly define BITS_PER_LONG
Michal Suchanek [Sat, 22 Oct 2022 21:22:01 +0000 (23:22 +0200)] 
sandbox: Correctly define BITS_PER_LONG

SANDBOX_BITS_PER_LONG is the number of bits in long on the sandbox
platform.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
3 years agoRFC: tools: Add a camel-case conversion script
Simon Glass [Sat, 29 Jan 2022 21:14:20 +0000 (14:14 -0700)] 
RFC: tools: Add a camel-case conversion script

This is only for posterity, since once the conversion is done, the script
is of no use.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoMerge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-marvell into...
Tom Rini [Wed, 1 Mar 2023 16:00:22 +0000 (11:00 -0500)] 
Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-marvell into next

- mvebu: Various fixes in SPL / kwboot / kwbimage (Pali)

3 years agoMerge tag 'u-boot-at91-fixes-2023.04-a' of https://source.denx.de/u-boot/custodians...
Tom Rini [Wed, 1 Mar 2023 14:39:18 +0000 (09:39 -0500)] 
Merge tag 'u-boot-at91-fixes-2023.04-a' of https://source.denx.de/u-boot/custodians/u-boot-at91

First set of u-boot-at91 fixes for the 2023.04 cycle:

This fixes set include one clock index fix for sama7g5 and two board
configuration alignments for pm9g45.

3 years agodoc/kwboot.1: Update example description
Pali Rohár [Thu, 26 Jan 2023 21:37:26 +0000 (22:37 +0100)] 
doc/kwboot.1: Update example description

Mention fact about changing baudrate back when -B is used.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agoarm: mvebu: Define SPL memory maps
Pali Rohár [Fri, 3 Feb 2023 21:26:37 +0000 (22:26 +0100)] 
arm: mvebu: Define SPL memory maps

In SPL are active memory maps set by the BootROM. Define them in cpu.h file
to the correct values. Some peripherals are not mapped at all.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agoarm: mvebu: Define env_sf_get_env_addr() also for Proper U-Boot
Pali Rohár [Fri, 3 Feb 2023 20:41:45 +0000 (21:41 +0100)] 
arm: mvebu: Define env_sf_get_env_addr() also for Proper U-Boot

Proper U-Boot moves SPI0 CS0 Flash mapping from 0xD4000000 to 0xF4000000
and change its size from 64 MB to 8 MB. Definitions are already in
MBUS_SPI_BASE/MBUS_SPI_SIZE macros. So define these macros also for SPL
build, use them in env_sf_get_env_addr() function and move this function
from spl.c to cpu.c to be available in Proper U-Boot too.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agoarm: mvebu: Fix comment about CPU_ATTR_BOOTROM mapping
Pali Rohár [Fri, 3 Feb 2023 20:34:27 +0000 (21:34 +0100)] 
arm: mvebu: Fix comment about CPU_ATTR_BOOTROM mapping

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agoarm: mvebu: Remove A39x relicts
Pali Rohár [Sun, 29 Jan 2023 18:09:02 +0000 (19:09 +0100)] 
arm: mvebu: Remove A39x relicts

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agoarm: mvebu: clearfog: Add defconfig for SATA booting
Pali Rohár [Sat, 21 Jan 2023 23:09:04 +0000 (00:09 +0100)] 
arm: mvebu: clearfog: Add defconfig for SATA booting

This new clearfog_sata_defconfig file is copy of existing
clearfog_defconfig file and changed to instruct build system to
generate final kwbimage for SATA booting.

This change is more readable via git option --find-copies-harder.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agoarm: mvebu: db-88f6820-amc: Add defconfig for NAND booting
Pali Rohár [Sat, 21 Jan 2023 20:42:08 +0000 (21:42 +0100)] 
arm: mvebu: db-88f6820-amc: Add defconfig for NAND booting

This new db-88f6820-amc_nand_defconfig file is copy of existing
db-88f6820-amc_defconfig file and changed to instruct build system to
generate final kwbimage for NAND booting. It was done by adding options:

    CONFIG_MVEBU_SPL_BOOT_DEVICE_NAND=y
    CONFIG_MVEBU_SPL_NAND_BADBLK_LOCATION=0x00
    CONFIG_SYS_NAND_BLOCK_SIZE=0x40000
    CONFIG_SYS_NAND_PAGE_SIZE=0x1000

Board has Micron MT29F8G08ABACAWP chip which is SLC NAND with 4kB page size
and block size of 64 pages.

This change was only compile-tested and is useful for CI testing that
mkimage can generate valid kwbimage of NAND type.

This change is more readable via git option --find-copies-harder.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agoarm: mvebu: Fix description of MVEBU_SPL_BOOT_DEVICE_(SPI|MMC) options
Pali Rohár [Tue, 10 Jan 2023 22:13:01 +0000 (23:13 +0100)] 
arm: mvebu: Fix description of MVEBU_SPL_BOOT_DEVICE_(SPI|MMC) options

MVEBU_SPL_BOOT_DEVICE_SPI is for NOR flash. Either serial or parallel. Not
for general serial/SPI devices. The correct name should be BOOT_DEVICE_NOR
but name SPI is already used in mkimage config format which we do not want
to change for compatibility reasons.

MVEBU_SPL_BOOT_DEVICE_MMC is for MMC and SD compatible devices. Not for
SDIO devices. In most cases used for eMMC or SD card.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agoarm: mvebu: Add support for generating PEX kwbimage
Pali Rohár [Tue, 10 Jan 2023 22:09:15 +0000 (23:09 +0100)] 
arm: mvebu: Add support for generating PEX kwbimage

Add a new Kconfig option CONFIG_MVEBU_SPL_BOOT_DEVICE_PEX which instruct
make to generate kwbimage with PEX header. This image is used for booting
from PCI Express device which is in the Root Complex mode.

Support is very simple, SPL after finishes DDR training returns back to the
BootROM (via CONFIG_SPL_BOOTROM_SUPPORT option) and BootROM then start
executing U-Boot proper.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agoarm: mvebu: Add support for generating NAND kwbimage
Pali Rohár [Tue, 10 Jan 2023 21:55:21 +0000 (22:55 +0100)] 
arm: mvebu: Add support for generating NAND kwbimage

Add a new Kconfig option CONFIG_MVEBU_SPL_BOOT_DEVICE_NAND which instruct
make to generate kwbimage with NAND header. This image is used for booting
from NAND flash (either SPI or parallel).

Support is very simple, SPL after finishes DDR training returns back to the
BootROM (via CONFIG_SPL_BOOTROM_SUPPORT option) and BootROM then loads and
executes U-Boot proper.

To generate correct kwbimage NAND header, it is required to set following
Kconfig options:

CONFIG_SYS_NAND_PAGE_SIZE
CONFIG_SYS_NAND_BLOCK_SIZE
CONFIG_MVEBU_SPL_NAND_BADBLK_LOCATION

They are used only by make / mkimage when generating final kwbimage.

CONFIG_MVEBU_SPL_NAND_BADBLK_LOCATION is a new mvebu specific Kconfig
option which is set into kwbimage NAND_BADBLK_LOCATION header field.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agotools: kwbimage: Add support for creating an image with no data
Pali Rohár [Sat, 21 Jan 2023 19:11:28 +0000 (20:11 +0100)] 
tools: kwbimage: Add support for creating an image with no data

This change add support for mkimage's -s option to kwbimage format. It will
create an kwbimage with empty data part of image (data part would contain
only required 32-bit checksum). mkimage's -s option is indicated by skipcpy
flag and it is basically in conflict with mkimage's -d (datafile) option.

"Empty" kwbimage with no data can still contain headers. For example it can
contain binary executable header which is copied by BootROM into L2SRAM.
This is useful for example for small images which can do not require DDR
RAM and can be run in L2SRAM (which do not require any initialization).

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agotools: mkimage: Do not try to open datafile when it is skipped
Pali Rohár [Sat, 21 Jan 2023 19:09:26 +0000 (20:09 +0100)] 
tools: mkimage: Do not try to open datafile when it is skipped

When mkimage was instructed to skip datafile via option -s then do not try
to validate or open datafile as it does not have to exist or to be
specified via -d option.

This change allows to use -s option for skipping datafile when -d option
for datafile was not specified.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agotools: mkimage: Print human readable error when -d is not specified
Pali Rohár [Sun, 8 Jan 2023 22:28:39 +0000 (23:28 +0100)] 
tools: mkimage: Print human readable error when -d is not specified

When asking mkimage to create a new image file and option -d is not
specified then mkimage show human unfriendly error message:

  mkimage: Can't open (null): Bad address

Without debugger it is hard to debug what is the issue. Function open() is
being called with file name set to NULL. So add a check for this and if it
happens then show human readable message that option -d was not specified.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agotools: kwbimage: Add support for XIP SPI/NOR images
Pali Rohár [Wed, 18 Jan 2023 20:42:40 +0000 (21:42 +0100)] 
tools: kwbimage: Add support for XIP SPI/NOR images

Marvell BootROM can execute SPI images directly from NOR (either SPI/serial
or parallel) without copying them to DDR RAM. This is know at XIP - execute
in place. To achieve that, destination address in kwbimage must be set to
0xFFFFFFFF and execute address to the offset in bytes from the beginning of
NOR memory.

Kirkwood and Dove which use kwbimage v0 format and have SPI address space
mapped to physical memory at 0xE8000000-0xEFFFFFFF by BootROM.

Armada SoCs use kwbimage v1 format and have SPI address space mapped to
physical memory at 0xD4000000-0xD7FFFFFF and Device bus address space (used
for parallel NOR) at 0xD8000000-0xDFFFFFFF.

Add support for generating XIP kwbimages by mkimage -x flag and mark xflag
as valid option in kwbimage.c.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agotools: mkimage: Do not fill legacy_img_hdr for non-legacy XIP images
Pali Rohár [Sat, 21 Jan 2023 19:05:43 +0000 (20:05 +0100)] 
tools: mkimage: Do not fill legacy_img_hdr for non-legacy XIP images

Skip filling legacy_img_hdr structure for XIP images which do not use
legacy_img_hdr structure header. Adding unwanted header to other image
formats, like kwbimage cause generation of broken image.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agotools: kwbimage: Fix invalid secure boot header signature
Pali Rohár [Sun, 29 Jan 2023 14:00:45 +0000 (15:00 +0100)] 
tools: kwbimage: Fix invalid secure boot header signature

Secure boot header signature is calculated from the image header with
zeroed header checksum. Calculation is done in add_secure_header_v1()
function. So after calling this function no header member except
main_hdr->checksum can be modified. Commit 2b0980c24027 ("tools: kwbimage:
Fill the real header size into the main header") broke this requirement as
final header size started to be filled into main_hdr->headersz_* members
after the add_secure_header_v1() call.

Fix this issue by following steps:
- Split header size and image data offset into two variables (headersz and
  *dataoff).
- Change image_headersz_v0() and add_binary_header_v1() functions to return
  real (unaligned) header size instead of image data offset.
- On every place use correct variable (headersz or *dataoff)

After these steps variable headersz is correctly filled into the
main_hdr->headersz_* members and so overwriting them in the end of the
image_create_v1() function is not needed anymore. Remove those overwriting
which effectively reverts changes in problematic commit without affecting
value in main_hdr->headersz_* members and makes secure boot header
signature valid again.

Fixes: 2b0980c24027 ("tools: kwbimage: Fill the real header size into the main header")
Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agotools: kwbimage: Fix generating secure boot data image signature
Pali Rohár [Sun, 29 Jan 2023 13:33:36 +0000 (14:33 +0100)] 
tools: kwbimage: Fix generating secure boot data image signature

Secure boot data image signature is calculated from the data image without
trailing 4-bit checksum. Commit 37cb9c15d70d ("tools: kwbimage: Simplify
aligning and calculating checksum") unintentionally broke this calculation
when it increased payloadsz variable by 4 bytes which was propagated also
into the add_secure_header_v1() function. Fix this issue by decreasing size
of buffer by 4 bytes from which is calculated secure boot data image
signature.

Fixes: 37cb9c15d70d ("tools: kwbimage: Simplify aligning and calculating checksum")
Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agotools: kwbimage: Rename imagesz to dataoff
Pali Rohár [Sun, 29 Jan 2023 12:17:21 +0000 (13:17 +0100)] 
tools: kwbimage: Rename imagesz to dataoff

Variable imagesz in functions image_create_v0(), image_create_v1() and
kwbimage_set_header() stores offset to data from the beginning of the main
header. So it is not image size.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agotools: kwbimage: Simplify add_secure_header_v1()
Pali Rohár [Sun, 29 Jan 2023 12:08:10 +0000 (13:08 +0100)] 
tools: kwbimage: Simplify add_secure_header_v1()

To make add_secure_header_v1() function more readable, call it directly
with arguments: header pointer with header size and data image pointer with
data image size. No functional change.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agotools: kwbimage: Print image data offset when printing kwbimage header
Pali Rohár [Sun, 8 Jan 2023 12:58:26 +0000 (13:58 +0100)] 
tools: kwbimage: Print image data offset when printing kwbimage header

For all images except SATA is data offset in bytes. For SATA it is in LBA
format (number of sectors). This is how Marvell BootROM interprets it.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agotools: kwbimage: Print binary image offset as size
Pali Rohár [Sun, 8 Jan 2023 22:27:11 +0000 (23:27 +0100)] 
tools: kwbimage: Print binary image offset as size

Use for it pretty print function: genimg_print_size(). This makes it more
human readable, like other offset and sizes printed by this tool.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agotools: kwbimage: Add support for dumping NAND_BLKSZ for v0 images
Pali Rohár [Sun, 8 Jan 2023 15:22:34 +0000 (16:22 +0100)] 
tools: kwbimage: Add support for dumping NAND_BLKSZ for v0 images

In Dove functional specification, which use kwbimage v0, is also defined
nand block size field. So dump NAND_BLKSZ also for v0 images.

In Kirkwood functional specification, which also use kwbimage v0, this
field is not defined. So when it is zero and Kirkwood is detected, do not
dump it.

Fixes: f76ae2571fe0 ("tools: kwbimage: Add support for dumping extended and binary v0 headers")
Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agotools: kwbimage: Reject mkimage -F option
Pali Rohár [Sat, 21 Jan 2023 12:00:21 +0000 (13:00 +0100)] 
tools: kwbimage: Reject mkimage -F option

mkimage -F option (re-sign existing FIT image) signaled by fflag is not
supported by kwbimage. So mark its usage as invalid parameter.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agotools: kwbimage: Fix endianity when printing kwbimage header
Pali Rohár [Sun, 8 Jan 2023 12:56:42 +0000 (13:56 +0100)] 
tools: kwbimage: Fix endianity when printing kwbimage header

All fields in kwbimage header are in little endian format.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agotools: kwbimage: Fix generating of kwbimage v0 header checksum
Pali Rohár [Mon, 9 Jan 2023 00:35:13 +0000 (01:35 +0100)] 
tools: kwbimage: Fix generating of kwbimage v0 header checksum

Checksum for v0 image must be generated after filling all fields in the
main header. Otherwise it would be invalid.

Exactly same problem for v1 images was already fixed in the past in commit
9203c73895ab ("tools: kwbimage: Fix checksum calculation for v1 images").

Fixes: 5c61710c9880 ("tools: kwbimage: Properly set srcaddr in kwbimage v0")
Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agotools: kwbimage: Fix dumping NAND_BLKSZ
Pali Rohár [Sat, 14 Jan 2023 12:42:14 +0000 (13:42 +0100)] 
tools: kwbimage: Fix dumping NAND_BLKSZ

kwbimage nandblocksize field is in 64 kB unit, but NAND_BLKSZ command
expects it in bytes. So do required unit conversion.

Also zero value in nandblocksize field has special meaning. When this field
is set to zero, the default block size is used. This default size is
defined by the NAND flash page size (16 KB for a 512B page or small page
NAND and 64 KB for a large page NAND flash).

Fixes: 1a8e6b63e24f ("tools: kwbimage: Dump kwbimage config file on '-p -1' option")
Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agotools: kwbimage: Fix dumping NAND_BADBLK_LOCATION
Pali Rohár [Sat, 14 Jan 2023 13:46:09 +0000 (14:46 +0100)] 
tools: kwbimage: Fix dumping NAND_BADBLK_LOCATION

Value 0x0 for NAND_BADBLK_LOCATION/nandbadblklocation means that BBI is on
the first or second page and value 0x1 means that BBI is on the last page.
This indicates also NAND Flash Technology, value 0x0 is SLC NAND and value
0x1 is MLC NAND.

Therefore we need to dump NAND_BADBLK_LOCATION also when it is zero.

Note that in v0 images, nandbadblklocation field overlaps with ddrinitdelay
field in one union. ddrinitdelay is used in Kirkwood and nandbadblklocation
is used in Dove. For Dove images is_v0_ext should be set, so use it to
distinguish if nandbadblklocation is available or not. In v1 images there
is always nandbadblklocation field.

Fixes: 1a8e6b63e24f ("tools: kwbimage: Dump kwbimage config file on '-p -1' option")
Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agotools: kwbimage: Fix endianity when dumping NAND_PAGE_SIZE
Pali Rohár [Sat, 14 Jan 2023 13:31:00 +0000 (14:31 +0100)] 
tools: kwbimage: Fix endianity when dumping NAND_PAGE_SIZE

Fixes: 1a8e6b63e24f ("tools: kwbimage: Dump kwbimage config file on '-p -1' option")
Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agotools: kwbimage: Fix dumping register set / DATA commands
Pali Rohár [Sun, 8 Jan 2023 12:53:48 +0000 (13:53 +0100)] 
tools: kwbimage: Fix dumping register set / DATA commands

Upper-bound for iterating for-loop over register set entries is incorrect.
Fix it byt calculating correct number of entries.

And fix also dumping the last entry DATA_DELAY, which is the last and not
first (zero).

Fixes: 1a8e6b63e24f ("tools: kwbimage: Dump kwbimage config file on '-p -1' option")
Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agocmd: mvebu/bubt: Enable command by default
Pali Rohár [Sat, 21 Jan 2023 22:51:15 +0000 (23:51 +0100)] 
cmd: mvebu/bubt: Enable command by default

This makes updating of u-boot/firmware on Marvell boards easier.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agocmd: mvebu/bubt: Fix warnings: unused variable 'secure_mode' and 'fuse_read_u64'...
Pali Rohár [Mon, 20 Feb 2023 21:42:54 +0000 (22:42 +0100)] 
cmd: mvebu/bubt: Fix warnings: unused variable 'secure_mode' and 'fuse_read_u64' defined but not used

'secure_mode' and 'fuse_read_u64' are used only on A38x and A37xx.

Fixes: f7b0bbca2b62 ("cmd: mvebu/bubt: Check for A38x/A37xx OTP secure bits and secure boot")
Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agocmd: mvebu/bubt: Better guess default MVEBU_*_BOOT option
Pali Rohár [Sat, 21 Jan 2023 22:38:31 +0000 (23:38 +0100)] 
cmd: mvebu/bubt: Better guess default MVEBU_*_BOOT option

For 32-bit Armada boards which use SPL we can determinate boot device from
existing MVEBU_SPL_BOOT_DEVICE_* option. For all other boards (e.g. 64-bit
Armada) default option still needs to be set manually.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agocmd: mvebu/bubt: Set correct default image name for 32-bit Armada SoCs
Pali Rohár [Sun, 8 Jan 2023 13:01:03 +0000 (14:01 +0100)] 
cmd: mvebu/bubt: Set correct default image name for 32-bit Armada SoCs

32-bit Armada SoCs uses u-boot binary packed in kwbimage format. Name of
the image is in CONFIG_BUILD_TARGET option. So use it as a default option
in Kconfig.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agocmd: mvebu/bubt: Check also A8K boot image checksum
Pali Rohár [Sun, 29 Jan 2023 17:49:04 +0000 (18:49 +0100)] 
cmd: mvebu/bubt: Check also A8K boot image checksum

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agocmd: mvebu/bubt: Do not modify image in A8K check_image_header()
Pali Rohár [Sun, 29 Jan 2023 17:38:11 +0000 (18:38 +0100)] 
cmd: mvebu/bubt: Do not modify image in A8K check_image_header()

Change checksum verification code so it does require to modify image.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agocmd: mvebu/bubt: Mark all local symbols as static
Pali Rohár [Tue, 10 Jan 2023 21:47:17 +0000 (22:47 +0100)] 
cmd: mvebu/bubt: Mark all local symbols as static

There is no need to export these local functions and structures.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agocmd: mvebu/bubt: Rename variable image_size to hdr_size
Pali Rohár [Sun, 8 Jan 2023 13:31:28 +0000 (14:31 +0100)] 
cmd: mvebu/bubt: Rename variable image_size to hdr_size

Variable image_size contains size of the header, not size of the whole
image. Rename this variable to reflect content.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agocmd: mvebu/bubt: Add support for reading image from the SATA disk partition
Pali Rohár [Sat, 21 Jan 2023 22:29:36 +0000 (23:29 +0100)] 
cmd: mvebu/bubt: Add support for reading image from the SATA disk partition

This change allows to load boot image from the first SATA/SCSI device
partition and burn it to board boot location (e.g. SPI-NOR). This is
particularly when storage device is not handled by U-Boot as USB mass
storage (which is already supported by bubt) but as SATA/SCSI device.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agocmd: mvebu/bubt: Add support for writing image to SATA disk
Pali Rohár [Sun, 22 Jan 2023 00:25:12 +0000 (01:25 +0100)] 
cmd: mvebu/bubt: Add support for writing image to SATA disk

All 32-bit Armada SoCs and also 64-bit Armada 3720 SoC can load and boot
firmware from SATA disk. This adds support for updating firmware binary for
these SoCs. On 32-bit Armada SoC is firmware stored at sector 1 and on
Armada 3720 is stored at MBR partition 0x4d or GPT partition with type GUID
6828311A-BA55-42A4-BCDE-A89BB5EDECAE (Marvell Armada 3700 Boot partition).

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agocmd: mvebu/bubt: Add support for selecting eMMC HW partition
Pali Rohár [Sat, 21 Jan 2023 21:58:28 +0000 (22:58 +0100)] 
cmd: mvebu/bubt: Add support for selecting eMMC HW partition

Support for burning into the correct eMMC HW boot partition was broken and
removed in commit 96be2f072768 ("mvebu: bubt: Drop dead code"). Reimplement
this functionality and bring it back again.

Fixes: 96be2f072768 ("mvebu: bubt: Drop dead code")
Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agotools: kwboot: Show image type and error parsing reasons
Pali Rohár [Tue, 10 Jan 2023 21:33:56 +0000 (22:33 +0100)] 
tools: kwboot: Show image type and error parsing reasons

Show image type and version during parsing of kwbimage.
And show reasons in error messages when parsing failed.
This can help to debug issues with invalid images.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agotools: kwboot: Fix patching of SPI/NOR XIP images
Pali Rohár [Sat, 21 Jan 2023 11:59:20 +0000 (12:59 +0100)] 
tools: kwboot: Fix patching of SPI/NOR XIP images

Marvell BootROM interprets execaddr of SPI/NOR XIP images as relative byte
offset from the from the beginning of the flash device. So if data image
offset and execute offset are not same then it is needed to adjust them
also in DDR RAM.

Fixes: f2c644e0b8bc ("tools: kwboot: Patch destination address to DDR area for SPI image")
Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agotools: kwboot: Add check that kwbimage contains DDR init code
Pali Rohár [Sun, 8 Jan 2023 12:46:14 +0000 (13:46 +0100)] 
tools: kwboot: Add check that kwbimage contains DDR init code

Some NOR images may be execute-in-place and do not contain DDR init code in
its kwbimage header. Such images cannot be booted over UART as BootROM
loads them to RAM. Add check that kwbimage contains DDR init code in its
header (either as binary code header or as the simple register-value set).

In some cases it is possible to load very small image into L2SRAM and when
DDR init code is not required. So check for L2SRAM load address and skip
DDR init code check in this case.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agotools: kwboot: Validate optional kwbimage v1 headers
Pali Rohár [Sun, 8 Jan 2023 12:42:07 +0000 (13:42 +0100)] 
tools: kwboot: Validate optional kwbimage v1 headers

Before starting parsing of kwbimage, first validate that all optional v1
headers and correct. This prevents kwboot crashes on invalid input.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years 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>
3 years 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>
3 years 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>
3 years 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: 2226ca173486 ("arm: mvebu: Load U-Boot proper binary in SPL code based on kwbimage header")
Signed-off-by: Pali Rohár <pali@kernel.org>
3 years 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>
3 years 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: 2226ca173486 ("arm: mvebu: Load U-Boot proper binary in SPL code based on kwbimage header")
Signed-off-by: Pali Rohár <pali@kernel.org>
3 years 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: f830703f4284 ("arm: mvebu: Check that kwbimage blockid matches boot mode")
Signed-off-by: Pali Rohár <pali@kernel.org>
3 years 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: 5a0653493307 ("cmd: mvebu/bubt: Check for A38x image data checksum")
Signed-off-by: Pali Rohár <pali@kernel.org>
3 years 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: 2226ca173486 ("arm: mvebu: Load U-Boot proper binary in SPL code based on kwbimage header")
Signed-off-by: Pali Rohár <pali@kernel.org>
3 years 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: 792e42355083 ("tools: kwboot: Patch source address in image header")
Signed-off-by: Pali Rohár <pali@kernel.org>
3 years 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: 501a54a29cc2 ("tools: kwbimage: Fix generation of SATA, SDIO and PCIe images")
Fixes: 5c61710c9880 ("tools: kwbimage: Properly set srcaddr in kwbimage v0")
Fixes: e0c243c398a7 ("tools: kwbimage: Validate data checksum of v1 images")
Fixes: aa6943ca3122 ("kwbimage: Add support for extracting images via dumpimage tool")
Signed-off-by: Pali Rohár <pali@kernel.org>
3 years 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: 5a0653493307 ("cmd: mvebu/bubt: Check for A38x image data checksum")
Signed-off-by: Pali Rohár <pali@kernel.org>
3 years 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: 2226ca173486 ("arm: mvebu: Load U-Boot proper binary in SPL code based on kwbimage header")
Signed-off-by: Pali Rohár <pali@kernel.org>
3 years 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: 792e42355083 ("tools: kwboot: Patch source address in image header")
Signed-off-by: Pali Rohár <pali@kernel.org>
3 years 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: 501a54a29cc2 ("tools: kwbimage: Fix generation of SATA, SDIO and PCIe images")
Fixes: 5c61710c9880 ("tools: kwbimage: Properly set srcaddr in kwbimage v0")
Fixes: e0c243c398a7 ("tools: kwbimage: Validate data checksum of v1 images")
Fixes: aa6943ca3122 ("kwbimage: Add support for extracting images via dumpimage tool")
Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agoMerge tag 'u-boot-rockchip-20230228' of https://source.denx.de/u-boot/custodians...
Tom Rini [Wed, 1 Mar 2023 01:24:25 +0000 (20:24 -0500)] 
Merge tag 'u-boot-rockchip-20230228' of https://source.denx.de/u-boot/custodians/u-boot-rockchip

Please pull the updates for rockchip platform:
- Add support for rk3588 soc;
- Add rk3588 Edgeble Neu6 board and Radxa ROCK5B board;
- Add rk3308 Radxa ROCK Pi S board;
- Add rk3568 Radxa ROCK 3 board,
- Add rk3566 Radxa Compute Module 3 board;
- Add support for sdram reg info version 3
- Refactor rockchip OTP/eFuse driver and add more soc support;
- Add external TPL support for binman;

binman support for mkimage ignore missing entry is based on [1];

[1] https://patchwork.ozlabs.org/project/uboot/patch/20230219220158.4160763-7-jonas@kwiboo.se/

3 years 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

3 years 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

3 years agoboard: rock5b-rk3588: add memory gaps into kernel's DTB
Eugen Hristev [Wed, 22 Feb 2023 09:05:13 +0000 (11:05 +0200)] 
board: rock5b-rk3588: add memory gaps into kernel's DTB

RK3588 has two memory gaps when using 16 GiB DRAM size:
[0x3fc000000 , 0x3fc500000]
and
[0x3fff00000 , 0x3ffffffff]

If the kernel is agnostic to these gaps, accessing the area causes
a SError panic.

Hence, add reserved memory areas in kernel's DTB before booting.

Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agoboard: rockchip: add Radxa ROCK5B Rk3588 board
Eugen Hristev [Wed, 22 Feb 2023 09:05:12 +0000 (11:05 +0200)] 
board: rockchip: add Radxa ROCK5B Rk3588 board

ROCK 5B is a Rockchip RK3588 based SBC (Single Board Computer) by Radxa.

There are tree variants depending on the DRAM size : 4G, 8G and 16G.

Specification:

    Rockchip Rk3588 SoC
    4x ARM Cortex-A76, 4x ARM Cortex-A55
    4/8/16GB memory LPDDR4x
    Mali G610MC4 GPU
    MIPI CSI 2 multiple lanes connector
    eMMC module connector
    uSD slot (up to 128GB)
    2x USB 2.0, 2x USB 3.0
    2x HDMI output, 1x HDMI input
    Ethernet port
    40-pin IO header including UART, SPI, I2C and 5V DC power in
    USB PD over USB Type-C
    Size: 85mm x 54mm

Kernel commits:
a1d3281450ab ("arm64: dts: rockchip: Add rock-5b board")
6fb13f888f2a ("arm64: dts: rockchip: Update sdhci alias for rock-5b")

Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agoclk: rockchip: rk3568: add more supported clk rates for sdmmc and emmc
Vasily Khoruzhick [Thu, 23 Feb 2023 21:03:32 +0000 (13:03 -0800)] 
clk: rockchip: rk3568: add more supported clk rates for sdmmc and emmc

SDHCI driver may attempt to set 26MHz clock, but clk_rk3568
will return error in this case. Apparently, SDHCI silently ignores the
error and as a result eMMC initialization fails.

Add 25 MHz and 26 MHz clk rates for sdmmc and emmc on rk3568 to fix that.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: rk3588: Read cpuid from otp
Jonas Karlman [Wed, 22 Feb 2023 22:44:41 +0000 (22:44 +0000)] 
rockchip: rk3588: Read cpuid from otp

Read cpuid from otp and set ethaddr for RK3588.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: rk3568: Read cpuid from otp
Jonas Karlman [Wed, 22 Feb 2023 22:44:41 +0000 (22:44 +0000)] 
rockchip: rk3568: Read cpuid from otp

The cpuid on RK3568 is located at 0xa instead of 0x7 as all other SoCs.
Add and use a CFG_CPUID_OFFSET to define this offset.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: misc: Set eth1addr mac address
Jonas Karlman [Wed, 22 Feb 2023 22:44:40 +0000 (22:44 +0000)] 
rockchip: misc: Set eth1addr mac address

Set eth1addr in addition to ethaddr.

Also allow fdt fixup of ethernet mac addresses when CMD_NET is disabled.
Set ethaddr and eth1addr based on HASH and SHA256 options.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: efuse: Add support for RK3036
Jonas Karlman [Wed, 22 Feb 2023 22:44:40 +0000 (22:44 +0000)] 
rockchip: efuse: Add support for RK3036

Add support for rk3036 compatible.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: efuse: Add support for RK3128
Jonas Karlman [Wed, 22 Feb 2023 22:44:40 +0000 (22:44 +0000)] 
rockchip: efuse: Add support for RK3128

Add support for rk3128 compatible.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: efuse: Add support for RK3328
Jonas Karlman [Wed, 22 Feb 2023 22:44:40 +0000 (22:44 +0000)] 
rockchip: efuse: Add support for RK3328

Add support for rk3328 compatible.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: efuse: Add support for RK3288 and more
Jonas Karlman [Wed, 22 Feb 2023 22:44:40 +0000 (22:44 +0000)] 
rockchip: efuse: Add support for RK3288 and more

Add support for rk3066a, rk3188, rk322x and rk3288 compatible.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: efuse: Refactor to use driver data and ops
Jonas Karlman [Wed, 22 Feb 2023 22:44:39 +0000 (22:44 +0000)] 
rockchip: efuse: Refactor to use driver data and ops

Refactor the driver to use driver data and ops to simplify handling
of SoCs that require a unique read op.

Move handling of the aligned bounce buffer to main read op in order to
keep the SoC unique read op simple.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: otp: Add dump_otp debug command
Jonas Karlman [Wed, 22 Feb 2023 22:44:39 +0000 (22:44 +0000)] 
rockchip: otp: Add dump_otp debug command

Add a simple debug command to dump the content of the otp.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: otp: Add support for RK3588
Jonas Karlman [Wed, 22 Feb 2023 22:44:39 +0000 (22:44 +0000)] 
rockchip: otp: Add support for RK3588

Add support for rk3588 compatible.

Adjust offset using driver data in main read op.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: otp: Add support for RK3568
Jonas Karlman [Wed, 22 Feb 2023 22:44:39 +0000 (22:44 +0000)] 
rockchip: otp: Add support for RK3568

Add support for rk3568 compatible.

Handle allocation of an aligned bounce buffer in main read op in order
to keep the SoC unique read op simple.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: otp: Refactor to use driver data and ops
Jonas Karlman [Wed, 22 Feb 2023 22:44:38 +0000 (22:44 +0000)] 
rockchip: otp: Refactor to use driver data and ops

Refactor the driver to use driver data and ops to simplify handling
of SoCs that require a unique read op.

Use readl_poll_sleep_timeout instead of a custom poll loop, and add
validation of input parameter to main read op.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agoboard: rockchip: Add Edgeble Neural Compute Module 6
Jagan Teki [Mon, 30 Jan 2023 14:57:49 +0000 (20:27 +0530)] 
board: rockchip: Add Edgeble Neural Compute Module 6

Neural Compute Module 6(Neu2) is a 96boards SoM-CB compute module
based on Rockchip RK3588 from Edgeble AI.

General features:
- Rockchip RK3588
- up to 32GB LPDDR4x
- up to 128GB eMMC
- 2x MIPI CSI2 FPC

On module WiFi6/BT5 is available in the following Neu6 variants.

Neural Compute Module 6(Neu6) IO board is an industrial form factor
ready-to-use IO board from Edgeble AI.

IO board offers plenty of peripherals and connectivity options and
this patch enables basic eMMC and UART which is enough to successfully
boot Linux.

Neu6 needs to mount on top of this IO board in order to create a
complete Edgeble Neural Compute Module 6(Neu6) IO platform.

Boot log for the record,

DDR Version V1.08 20220617
LPDDR4X, 2112MHz
channel[0] BW=16 Col=10 Bk=8 CS0 Row=16 CS1 Row=16 CS=2 Die BW=16 Size=2048MB
channel[1] BW=16 Col=10 Bk=8 CS0 Row=16 CS1 Row=16 CS=2 Die BW=16 Size=2048MB
channel[2] BW=16 Col=10 Bk=8 CS0 Row=16 CS1 Row=16 CS=2 Die BW=16 Size=2048MB
channel[3] BW=16 Col=10 Bk=8 CS0 Row=16 CS1 Row=16 CS=2 Die BW=16 Size=2048MB
Manufacturer ID:0x6
CH0 RX Vref:31.7%, TX Vref:21.8%,21.8%
CH1 RX Vref:30.7%, TX Vref:22.8%,23.8%
CH2 RX Vref:30.7%, TX Vref:22.8%,22.8%
CH3 RX Vref:30.7%, TX Vref:21.8%,21.8%
change to F1: 528MHz
change to F2: 1068MHz
change to F3: 1560MHz
change to F0: 2112MHz
out

U-Boot SPL 2023.01-00952-g1d1785a516-dirty (Jan 30 2023 - 19:53:55 +0530)
Trying to boot from MMC1
INFO:    Preloader serial: 2
NOTICE:  BL31: v2.3():v2.3-391-g856309329:derrick.huang
NOTICE:  BL31: Built : 14:15:50, Jul 18 2022
INFO:    ext 32k is not valid
INFO:    GICv3 without legacy support detected.
INFO:    ARM GICv3 driver initialized in EL3
INFO:    system boots from cpu-hwid-0
INFO:    idle_st=0x21fff, pd_st=0x11fff9, repair_st=0xfff70001
INFO:    dfs DDR fsp_params[0].freq_mhz= 2112MHz
INFO:    dfs DDR fsp_params[1].freq_mhz= 528MHz
INFO:    dfs DDR fsp_params[2].freq_mhz= 1068MHz
INFO:    dfs DDR fsp_params[3].freq_mhz= 1560MHz
INFO:    BL31: Initialising Exception Handling Framework
INFO:    BL31: Initializing runtime services
WARNING: No OPTEE provided by BL2 boot loader, Booting device without OPTEE initialization. SMC`s destined for OPTEE will return SMC_UNK
ERROR:   Error initializing runtime service opteed_fast
INFO:    BL31: Preparing for EL3 exit to normal world
INFO:    Entry point address = 0xa00000
INFO:    SPSR = 0x3c9

U-Boot 2023.01-00952-g1d1785a516-dirty (Jan 30 2023 - 19:53:55 +0530)

Model: Edgeble Neu6A IO Board
DRAM:  7.5 GiB (effective 3.7 GiB)
Core:  71 devices, 15 uclasses, devicetree: separate
MMC:   mmc@fe2c0000: 0
Loading Environment from nowhere... OK
In:    serial@feb50000
Out:   serial@feb50000
Err:   serial@feb50000
Model: Edgeble Neu6A IO Board
Net:   No ethernet found.
Hit any key to stop autoboot:  0
=>

Add support for Edgeble Neu6 Model A IO Board.

Signed-off-by: Jagan Teki <jagan@edgeble.ai>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
3 years agoARM: dts: rockchip: rk3588s-u-boot: Add sdmmc node
Jagan Teki [Mon, 30 Jan 2023 14:57:47 +0000 (20:27 +0530)] 
ARM: dts: rockchip: rk3588s-u-boot: Add sdmmc node

Booting from SDMMC is one of the fast and easy booting methods
for initial support of any SoC to upstream more features. 

This patch is trying to add the sdmmc node for rk3588 and added
as u-boot specific node in -u-boot.dtsi as upstream Linux is not
supporting yet.

As soon as Linux supports it, a sync of the Linux device tree
would eventually drop this node. 

Clock properties as added according to the rockchip mmc driver
but the actual definition might add scmi clocks into 0 and 1
indexes. This is due to scmi clock are not supporting in upstream
U-Boot. Properly addition of scmi clock would eventually follow
sdmmc clock definition of Linux once they upstreamed.

Signed-off-by: Jagan Teki <jagan@edgeble.ai>
3 years agoARM: dts: rockchip: Add rk3588-u-boot.dtsi
Jagan Teki [Mon, 30 Jan 2023 14:57:46 +0000 (20:27 +0530)] 
ARM: dts: rockchip: Add rk3588-u-boot.dtsi

Add u-boot,dm-spl and u-boot,dm-pre-reloc related properties
for Rockchip RK3588 SoC to boot the SPL.

Signed-off-by: Jagan Teki <jagan@edgeble.ai>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>