]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
3 years agoenv: nand: Put ENV_INVALID into gd->env_valid if default environment
Marek Behún [Fri, 22 Oct 2021 13:47:15 +0000 (15:47 +0200)]
env: nand: Put ENV_INVALID into gd->env_valid if default environment

env_nand_init() says the environment is valid even if it is assigning
default environment due to not being able to access nand pre-reloaction
(determined by macro values). Change this to ENV_INVALID and let the
generic env_init() function, which calls this initializer, assign the
default environment.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoenv: sf: Put ENV_INVALID into gd->env_valid on CRC failure
Marek Behún [Fri, 22 Oct 2021 13:47:14 +0000 (15:47 +0200)]
env: sf: Put ENV_INVALID into gd->env_valid on CRC failure

env_sf_init_addr() says the environment is valid even if it is assigning
default environment due to CRC failure. Change this to ENV_INVALID and
let the generic env_init() function, which calls this initializer,
assign the default environment.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoenv: sf: Use ENV_VALID enum names instead of literals
Marek Behún [Fri, 22 Oct 2021 13:47:13 +0000 (15:47 +0200)]
env: sf: Use ENV_VALID enum names instead of literals

The function env_sf_init_addr() assigns number literals (1) instead of
ENV_VALID to gd->env_valid. Fix this.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoenv: sf: Cosmetic fix in env_sf_init_addr()
Marek Behún [Fri, 22 Oct 2021 13:47:12 +0000 (15:47 +0200)]
env: sf: Cosmetic fix in env_sf_init_addr()

In the if clause we use tabs and in the else clause spaces. Let's use
spaces in the if clause too.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agox86: Fix linking u-boot with ld.lld
Alistair Delva [Wed, 20 Oct 2021 21:31:33 +0000 (21:31 +0000)]
x86: Fix linking u-boot with ld.lld

When linking the final u-boot binary with LLD, the following link errors
are seen:

ld.lld: error: can't create dynamic relocation R_386_32 against local
               symbol in readonly segment; recompile object files with
               -fPIC or pass '-Wl,-z,notext' to allow text relocations
               in the output
>>> defined in arch/x86/cpu/start.o
>>> referenced by arch/x86/cpu/start.o:(.text.start+0x32)
[...]
>>> defined in arch/x86/cpu/start16.o
>>> referenced by arch/x86/cpu/start16.o:(.start16+0x1C)

According to Nick Desaulniers:

"This is a known difference between GNU and LLVM linkers; the GNU
 linkers permit relocations in readonly segments (making them not read
 only), LLVM does not (by default)."

Since U-Boot apparently seems to use relocations in readonly segments,
change the global linker flags to permit them when linking with LLD by
specifying '-z notext'.

Signed-off-by: Alistair Delva <adelva@google.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: Migrate ARCH_MAP_SYSMEM to Kconfig
Tom Rini [Wed, 20 Oct 2021 01:16:55 +0000 (21:16 -0400)]
sandbox: Migrate ARCH_MAP_SYSMEM to Kconfig

Move this from a hard-coded define in config.mk to Kconfig.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Allow timeout to occur in the image or its section
Simon Glass [Mon, 18 Oct 2021 18:13:15 +0000 (12:13 -0600)]
binman: Allow timeout to occur in the image or its section

At present testThreadTimeout() assumes that the expected timeout happens
first when building the section, but it can just as easily happen at the
top-level image. Update the test to cope with both.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
3 years agoimage.h: make image_sign_info.fit point to const
Hannu Lounento [Mon, 18 Oct 2021 05:49:03 +0000 (08:49 +0300)]
image.h: make image_sign_info.fit point to const

The data blob apparently does not need to be modified through the fit
field of the image_sign_info struct so make it point to const to avoid
the need to cast away constness in functions that assign a pointer to
const data to the field.

fit_image_setup_verify already had to cast away constness as it assigned
a const void * argument to the field. The cast can now be removed.

Signed-off-by: Hannu Lounento <hannu.lounento@vaisala.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoMerge branch '2021-10-31-assorted-platform-updates'
Tom Rini [Sun, 31 Oct 2021 16:21:12 +0000 (12:21 -0400)]
Merge branch '2021-10-31-assorted-platform-updates'

- Revert GIC LPI changes that need to be reworked.
- mvebu SATA booting bugfix
- Samsung Galaxy S9/S9+(SM-G96x0), Samsung Galaxy A and Apple M1
  platform support.

3 years agoboard: samsung: add support for Galaxy A series of 2017 (a5y17lte)
Dzmitry Sankouski [Sun, 17 Oct 2021 10:45:42 +0000 (13:45 +0300)]
board: samsung: add support for Galaxy A series of 2017 (a5y17lte)

Samsung Galaxy A3, A5, A7 (2017) - middle class Samsung smartphones.
U-boot can be used as chain-loaded bootloader to gain control
on booting vanilla linux(and possibly others) kernels

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
3 years agoSoC: exynos: add support for exynos 78x0
Dzmitry Sankouski [Sun, 17 Oct 2021 10:45:41 +0000 (13:45 +0300)]
SoC: exynos: add support for exynos 78x0

Samsung Exynos 7880 \ 7870 - SoC for mainstream smartphones and tablets
introduced on March 2017.
Features:
- 8 Cortex A53 cores
- ARM Mali-T830 MP3 GPU
- LTE Cat. 7 (7880) or 6 (7870) modem

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
3 years agopinctrl: exynos: add support for multiple pin banks
Dzmitry Sankouski [Sun, 17 Oct 2021 10:45:40 +0000 (13:45 +0300)]
pinctrl: exynos: add support for multiple pin banks

Iterate all pin banks to find a pin

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
3 years agoserial: samsung: add support for skip debug init in s5p
Dzmitry Sankouski [Sun, 17 Oct 2021 10:45:39 +0000 (13:45 +0300)]
serial: samsung: add support for skip debug init in s5p

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
3 years agoboard: samsung: add Samsung Galaxy S9/S9+(SM-G96x0) board
Dzmitry Sankouski [Sun, 17 Oct 2021 10:44:32 +0000 (13:44 +0300)]
board: samsung: add Samsung Galaxy S9/S9+(SM-G96x0) board

Samsung S9 SM-G9600 - Snapdragon SDM845 version of the phone,
for China \ Hong Kong markets.
Has unlockable bootloader, unlike SM-G960U (American market version),
which allows running u-boot as a chain-loaded bootloader.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
3 years agoSoC: qcom: add support for SDM845
Dzmitry Sankouski [Sun, 17 Oct 2021 10:44:31 +0000 (13:44 +0300)]
SoC: qcom: add support for SDM845

Hi-end qualcomm chip, introduced in late 2017.
Mostly used in flagship phones and tablets of 2018.
Features:
- arm64 arch
- total of 8 Kryo 385 Gold / Silver cores
- Hexagon 685 DSP
- Adreno 630 GPU

Tested only as second-stage bootloader.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stephan Gerhold <stephan@gerhold.net>
3 years agoclocks: qcom: add clocks for SDM845 debug uart
Dzmitry Sankouski [Sun, 17 Oct 2021 10:44:30 +0000 (13:44 +0300)]
clocks: qcom: add clocks for SDM845 debug uart

Allows to change clock frequency of debug uart,
thus supporting wide range of baudrates.
Enable / disable functionality is not implemented yet.
In most use cases of SDM845 (i.e. mobile phones and tablets)
it's not needed, because qualcomm first stage bootloader leaves it
initialized, and on the other hand there's no possibility to
replace signed first stage bootloader with u-boot.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
3 years agopinctrl: qcom: add pinctrl and gpio drivers for SDM845 SoC
Dzmitry Sankouski [Sun, 17 Oct 2021 10:44:29 +0000 (13:44 +0300)]
pinctrl: qcom: add pinctrl and gpio drivers for SDM845 SoC

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Stephan Gerhold <stephan@gerhold.net>
[trini: Add CONFIG_SDM845 around sdm845_data usage]

3 years agospmi: msm: add arbiter version 5 support
Dzmitry Sankouski [Sun, 17 Oct 2021 10:44:28 +0000 (13:44 +0300)]
spmi: msm: add arbiter version 5 support

Currently driver supports only version 1 and 2.
Version 5 has slightly different registers structure

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
3 years agoserial: qcom: add support for GENI serial driver
Dzmitry Sankouski [Sun, 17 Oct 2021 10:44:27 +0000 (13:44 +0300)]
serial: qcom: add support for GENI serial driver

Generic Interface (GENI) Serial Engine (SE) based uart
can be found on newer qualcomm SOCs, starting from SDM845.
Tested on Samsung SM-G9600(starqltechn)
by chain-loading u-boot with stock bootloader.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
3 years agodoc: board: apple: Add Apple M1 documentation
Mark Kettenis [Sat, 23 Oct 2021 14:58:07 +0000 (16:58 +0200)]
doc: board: apple: Add Apple M1 documentation

Provide preliminary instructions on how to get U-Boot to run on
Apple Silicon Macs.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoarm: dts: apple: Add preliminary device trees
Mark Kettenis [Sat, 23 Oct 2021 14:58:06 +0000 (16:58 +0200)]
arm: dts: apple: Add preliminary device trees

Add preliminary device trees for the Apple M1 mini (2020) and
Apple M1 Macbook Pro 13" (2020).  Device tree bindings for
the Apple M1 SoC are still being formalized and these device
trees will be synchronized with the Linux kernel as needed.

The device trees in this commit are based on the initial Apple
M1 device trees from Linux 5.13, nodes for dart, pcie, pinctrl,
pmgr, usb based on bindings on track for inclusion in Linux
5.15 and 5.16 and nodes for i2c, mailbox, nvme, pmu, spmi and
watchdog that don't have a proposed binding yet.

These device trees are provided as a reference only as U-Boot
uses the device tree passed by the m1n1 bootloader.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoiommu: Add Apple DART driver
Mark Kettenis [Sat, 23 Oct 2021 14:58:05 +0000 (16:58 +0200)]
iommu: Add Apple DART driver

The DART is an IOMMU that is used on Apple's M1 SoC.  This driver
configures the DART such that it operates in bypass mode which is
enough to support DMA for the USB3 ports integrated on the SoC.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoserial: s5p: Add Apple M1 support
Mark Kettenis [Sat, 23 Oct 2021 14:58:04 +0000 (16:58 +0200)]
serial: s5p: Add Apple M1 support

Apple M1 SoCs include an S5L UART which is a variant of the S5P
UART.  Add support for this variant and enable it by default
on Apple SoCs.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoarm: apple: Add initial support for Apple's M1 SoC
Mark Kettenis [Sat, 23 Oct 2021 14:58:03 +0000 (16:58 +0200)]
arm: apple: Add initial support for Apple's M1 SoC

Add support for Apple's M1 SoC that is used in "Apple Silicon"
Macs.  This builds a basic U-Boot that can be used as a payload
for the m1n1 boot loader being developed by the Asahi Linux
project.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
[trini: Add MAINTAINERS entry]

3 years agotest: Add tests for IOMMU uclass
Mark Kettenis [Sat, 23 Oct 2021 14:58:02 +0000 (16:58 +0200)]
test: Add tests for IOMMU uclass

Add a set of tests for the IOMMU uclass.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoiommu: Add IOMMU uclass
Mark Kettenis [Sat, 23 Oct 2021 14:58:01 +0000 (16:58 +0200)]
iommu: Add IOMMU uclass

This uclass is intended to manage IOMMUs on systems where the
IOMMUs are not in bypass mode by default.  In that case U-Boot
cannot ignore the IOMMUs if it wants to use devices that need
to do DMA and sit behind such an IOMMU.

This initial IOMMU uclass implementation does not implement and
device ops and is intended for IOMMUs that have a bypass mode
that does not require address translation.  Support for IOMMUs
that do require address translation is planned and device ops
will be defined when support for such IOMMUs will be added.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoarm: mvebu: Fix booting from SATA
Pali Rohár [Fri, 29 Oct 2021 12:09:48 +0000 (14:09 +0200)]
arm: mvebu: Fix booting from SATA

Use proper SATA macro for boot_device switch in spl_boot_device() function.

Signed-off-by: Pali Rohár <pali@kernel.org>
Fixes: 2226ca173486 ("arm: mvebu: Load U-Boot proper binary in SPL code based on kwbimage header")
3 years agoRevert "arch: arm: use dt and UCLASS_SYSCON to get gic lpi details"
Michael Walle [Wed, 27 Oct 2021 16:54:54 +0000 (18:54 +0200)]
Revert "arch: arm: use dt and UCLASS_SYSCON to get gic lpi details"

Stop using the device tree as a source for ad-hoc information.

This reverts commit 2ae7adc659f7fca9ea65df4318e5bca2b8274310.

Signed-off-by: Michael Walle <michael@walle.cc>
[trini: Also make board/broadcom/bcmns3/ns3.c fail clearly now]
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoRevert "arm64: Layerscape: Survive LPI one-way reset workaround"
Tom Rini [Wed, 27 Oct 2021 16:54:53 +0000 (18:54 +0200)]
Revert "arm64: Layerscape: Survive LPI one-way reset workaround"

Ad-hoc bindings that are not part of the upstream device tree / bindings
are not allowed in-tree.  Only bindings that are in-progress with
upstream and then re-synced once agreed upon are.

This reverts commit af288cb291da3abef6be0875527729296f7de7a0.

Cc: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Cc: Priyanka Jain <priyanka.jain@nxp.com>
Reported-by: Michael Walle <michael@walle.cc>
Signed-off-by: Tom Rini <trini@konsulko.com>
Acked-by: Marc Zyngier <maz@kernel.org>
3 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-mmc
Tom Rini [Fri, 29 Oct 2021 12:27:32 +0000 (08:27 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-mmc

- Fix mmc_switch timeout
- Update mmc hwpartitiion command
- Support wait_dat0 for Freescale eSDHC/sdhci drivers

3 years agommc: arm_pl180_mmci: Enable HWFC for specific versions of MCI
Usama Arif [Tue, 19 Oct 2021 14:49:48 +0000 (15:49 +0100)]
mmc: arm_pl180_mmci: Enable HWFC for specific versions of MCI

There are 4 registers (PERIPHID{0-3}) that contain the ID of MCI.
For MMCs' with peripheral id 0x02041180 and 0x03041180, H/W flow control
needs to be enabled for multi block writes (MMC CMD 18).

Signed-off-by: Usama Arif <usama.arif@arm.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agommc: Fix mmc_switch excessive timeout
Kirill Kapranov [Sat, 9 Oct 2021 20:49:59 +0000 (23:49 +0300)]
mmc: Fix mmc_switch excessive timeout

Fix branching to avoid premature falling back on a long timeout instead
of continuation of the initialization attempt.

Clear of the comment to avoid the ambiguity.

Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
Cc: Ye Li <ye.li@nxp.com>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Tested-by: Marek Behún <marek.behun@nic.cz>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agocmd: mmc: check whether card is SD or eMMC before hwpartition
Jaehoon Chung [Fri, 24 Sep 2021 00:23:34 +0000 (09:23 +0900)]
cmd: mmc: check whether card is SD or eMMC before hwpartition

It doesn't need to follow more sequence to do the hwparititioning,
because SD doesn't support hwpartitioning feature.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agocmd: mmc: Support mmc hwpartition user enh start -
Marek Vasut [Wed, 15 Sep 2021 09:43:13 +0000 (11:43 +0200)]
cmd: mmc: Support mmc hwpartition user enh start -

Add option to extend the hardware partition to the maximum size by
using the '-' dash sign instead of $cnt parameter. This is useful
in case we want to switch the entire eMMC user area into pSLC mode,
especially in case the device may be populated with different size
eMMCs. With this change, we do not have to calculate the number of
blocks of the user area manually.

To switch the pSLC mode for user area, use e.g. the following.
WARNING: This is a one-time irreversible change.
=> mmc hwpartition user enh 0 - wrrel on complete

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agodrivers: mmc: Add wait_dat0 support for sdhci driver
Stephen Carlson [Tue, 17 Aug 2021 19:46:41 +0000 (12:46 -0700)]
drivers: mmc: Add wait_dat0 support for sdhci driver

Adds an implementation of the wait_dat0 MMC operation for the DM SDHCI
driver, allowing the driver to continue when the card is ready rather
than waiting for the worst case time on each MMC switch operation.

Signed-off-by: Stephen Carlson <stcarlso@linux.microsoft.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agodrivers: mmc: Add wait_dat0 support for Freescale eSDHC driver
Stephen Carlson [Tue, 17 Aug 2021 19:46:40 +0000 (12:46 -0700)]
drivers: mmc: Add wait_dat0 support for Freescale eSDHC driver

Adds an implementation of the wait_dat0 MMC operation for the Freescale
eSHDC driver, allowing the driver to continue when the card is ready
rather than waiting for the worst case time on each MMC switch operation.

Signed-off-by: Stephen Carlson <stcarlso@linux.microsoft.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Thu, 28 Oct 2021 11:57:54 +0000 (07:57 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- mvebu: Fix usage of BIN header arguments (Pali)
- mvebu: turris_omnia: Fix MTD partitions order for Linux (Pali)
- mvebu: nandpagesize support for kwbimage v1 (Pali)

3 years agoarm: mvebu: Fix comments about kwbimage structures
Pali Rohár [Fri, 22 Oct 2021 10:41:10 +0000 (12:41 +0200)]
arm: mvebu: Fix comments about kwbimage structures

kwbimage v1 is used on more SoCs.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agoarm: mvebu: Update name of kwbimage v1 field at offset 0x2-0x3
Pali Rohár [Fri, 22 Oct 2021 10:37:48 +0000 (12:37 +0200)]
arm: mvebu: Update name of kwbimage v1 field at offset 0x2-0x3

At this offset is stored nand page size.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Patch nandpagesize to zero also for v1 image
Pali Rohár [Fri, 22 Oct 2021 10:37:47 +0000 (12:37 +0200)]
tools: kwboot: Patch nandpagesize to zero also for v1 image

kwbimage v1 has also nandpagesize field. So set it to zero for both image
versions when image is not signed.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwbimage: Add support for NAND_PAGE_SIZE command also for v1 images
Pali Rohár [Fri, 22 Oct 2021 10:37:46 +0000 (12:37 +0200)]
tools: kwbimage: Add support for NAND_PAGE_SIZE command also for v1 images

The NAND_PAGE_SIZE command is already supported by mkimage for v0 images,
but not for v1 images.

A38x and A39x BootROM supports reading NAND flash page size from v1 image
in the same way as Kirkwood BootROM from v0 image. It it documented in A38x
and A39x Functional Specification.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agoarm: mvebu: turris_omnia: Fix MTD partitions order for Linux
Pali Rohár [Thu, 21 Oct 2021 15:55:48 +0000 (17:55 +0200)]
arm: mvebu: turris_omnia: Fix MTD partitions order for Linux

Linux enumerates MTD partitions in DTB order, while the fdt_add_subnode()
function puts a new subnode at the beginning.

To fix this, put MTD partitions into DTB in reverse order.

Fixes: 92f36c8e74c1 ("arm: mvebu: turris_omnia: fixup MTD partitions in Linux' DTB")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agoarm: mvebu: Remove dummy BIN header arguments for SPL binary
Pali Rohár [Thu, 21 Oct 2021 14:46:09 +0000 (16:46 +0200)]
arm: mvebu: Remove dummy BIN header arguments for SPL binary

U-Boot SPL binary does not read BIN header arguments, so passing some dummy
values 0000005b and 00000068 has no effect for U-Boot SPL code.

Probably these two values comes from old Marvell DDR training code which
was separated from U-Boot and used it for some configuration.

Seems that two 32-bit values were specified here to ensure SPL code
alignment to 128-bit boundary as it is required e.g. for A370 or AXP
processors. Main kwbimage header is 64-byte long which is aligned to
128-bit boundary. Optional kwbheader is 32-bit long, number of BIN header
arguments is stored in 32-bit number. So for alignment to 128-bit boundary
is needed 64-bit padding which exactly these two 32-bit dummy arguments
provided.

Now when mkimage correctly aligns start of executable code in BIN header to
128-bit boundary, there is no requirement to put dummy argument values into
kwbimage. So remove them.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agoarm: mvebu: Add documentation for save_boot_params() function
Pali Rohár [Thu, 21 Oct 2021 14:46:08 +0000 (16:46 +0200)]
arm: mvebu: Add documentation for save_boot_params() function

Important detail is availability of kwbimage BIN header arguments passed
via r0 and r1 registers by BootROM.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwbimage: Align BIN header executable code to 128-bit boundary
Pali Rohár [Thu, 21 Oct 2021 14:46:07 +0000 (16:46 +0200)]
tools: kwbimage: Align BIN header executable code to 128-bit boundary

ARM executable code inside the BIN header on some mvebu platforms
(e.g. A370, AXP) must always be aligned with the 128-bit boundary. This
requirement can be met by inserting dummy arguments into BIN header.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agotools: kwboot: Align UART baudrate change code in BIN header to 128-bit boundary
Pali Rohár [Thu, 21 Oct 2021 14:46:06 +0000 (16:46 +0200)]
tools: kwboot: Align UART baudrate change code in BIN header to 128-bit boundary

ARM executable code inside the BIN header on some mvebu platforms
(e.g. A370, AXP) must always be aligned with the 128-bit boundary. This
requirement can be met by inserting dummy arguments into BIN header.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agosandbox: Remove OF_HOSTFILE
Ilias Apalodimas [Tue, 26 Oct 2021 06:12:33 +0000 (09:12 +0300)]
sandbox: Remove OF_HOSTFILE

OF_HOSTFILE is used on sandbox configs only.  Although it's pretty
unique and not causing any confusions,  we are better of having simpler
config options for the DTB.

So let's replace that with the existing OF_BOARD.  U-Boot would then
have only three config options for the DTB origin.
- OF_SEPARATE, build separately from U-Boot
- OF_BOARD, board specific way of providing the DTB
- OF_EMBED embedded in the u-boot binary(should not be used in production

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoMerge tag 'efi-2022-01-rc1-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Tue, 26 Oct 2021 22:42:26 +0000 (18:42 -0400)]
Merge tag 'efi-2022-01-rc1-2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2022-01-rc1-2

doc:
Remove obsolete PPC4XX references

UEFI:
Implement missing TCG2 measurements
Code clean up

# gpg: Signature made Tue 26 Oct 2021 05:56:47 PM EDT
# gpg:                using RSA key 6DC4F9C71F29A6FA06B76D33C481DBBC2C051AC4
# gpg: Good signature from "Heinrich Schuchardt <xypron.glpk@gmx.de>" [unknown]
# gpg:                 aka "[jpeg image of size 1389]" [unknown]
# Primary key fingerprint: 6DC4 F9C7 1F29 A6FA 06B7  6D33 C481 DBBC 2C05 1AC4

3 years agoMerge branch '2021-10-26-add-nand-biterr-and-bugfixes'
Tom Rini [Tue, 26 Oct 2021 22:34:55 +0000 (18:34 -0400)]
Merge branch '2021-10-26-add-nand-biterr-and-bugfixes'

- Add biterr sub-command to "nand"
- scmi, rsa, uuid bugfixes, re-sort DFU menu in Kconfig and remove
  superfluous checks before free in env.

3 years agoefi_loader: add DeployedMode and AuditMode variable measurement
Masahisa Kojima [Tue, 26 Oct 2021 08:27:27 +0000 (17:27 +0900)]
efi_loader: add DeployedMode and AuditMode variable measurement

This commit adds the DeployedMode and AuditMode variable
measurement required in TCG PC Client Platform Firmware
Profile Specification.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
3 years agoefi_loader: simplify tcg2_measure_secure_boot_variable()
Masahisa Kojima [Tue, 26 Oct 2021 08:27:26 +0000 (17:27 +0900)]
efi_loader: simplify tcg2_measure_secure_boot_variable()

This commit simplifies tcg2_measure_secure_boot_variable()
using secure_variables table.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
3 years agoefi_loader: add UEFI GPT measurement
Masahisa Kojima [Tue, 26 Oct 2021 08:27:25 +0000 (17:27 +0900)]
efi_loader: add UEFI GPT measurement

This commit adds the UEFI GPT disk partition topology
measurement required in TCG PC Client Platform Firmware
Profile Specification

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
3 years agoenv: superfluous check before free()
Heinrich Schuchardt [Mon, 25 Oct 2021 22:41:59 +0000 (00:41 +0200)]
env: superfluous check before free()

Free() checks if its argument in NULL. There is no need for the caller to
do the same.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
3 years agodfu: Sort Kconfig entries alphabetically
Marek Vasut [Mon, 25 Oct 2021 22:37:05 +0000 (00:37 +0200)]
dfu: Sort Kconfig entries alphabetically

The DFU_MTD Kconfig entry is in the wrong position, move it into the
correct alphabetically sorted position. No functional change.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agolib: uuid: fix the test on RNG device presence
Patrick Delaunay [Fri, 22 Oct 2021 15:05:47 +0000 (17:05 +0200)]
lib: uuid: fix the test on RNG device presence

Correct the test on RNG device presence,when ret is equal to 0,
before to call dm_rng_read function.

Without this patch the RNG device is not used when present (when ret == 0)
or a data abort occurs in dm_rng_read when CONFIG_DM_RNG is activated but
the RNG device is not present in device tree (ret != 0 and devp = NULL).

Fixes: 92fdad28cfdf ("lib: uuid: use RNG device if present")
CC: Matthias Brugger <mbrugger@suse.com>
CC: Torsten Duwe <duwe@suse.de>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocommon: Kconfig.boot: add config SPL_FIT_RSASSA_PSS
Philippe Reynes [Fri, 15 Oct 2021 09:35:03 +0000 (11:35 +0200)]
common: Kconfig.boot: add config SPL_FIT_RSASSA_PSS

The padding pss is only supported on u-boot and tools since
commit 2bbed3ff8c7f ("image: Use Kconfig to enable FIT_RSASSA_PSS on host")

This commit adds the config SPL_FIT_RSASSA_PSS to support
the padding pss in the SPL.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolib: rsa: rsa-verify: also check that padding is not NULL
Philippe Reynes [Fri, 15 Oct 2021 09:28:47 +0000 (11:28 +0200)]
lib: rsa: rsa-verify: also check that padding is not NULL

This commit adds a check on the padding in the function rsa_verify_key
to avoid using a NULL pointer.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agofirmware: scmi: fix struct layout for scmi_clk_rate_set_in
Clément Léger [Wed, 13 Oct 2021 14:00:04 +0000 (16:00 +0200)]
firmware: scmi: fix struct layout for scmi_clk_rate_set_in

First two fields are reversed compared to what is expected by the SCMI
specification.

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
Fixes: 60388844836 ("clk: add clock driver for SCMI agents")
3 years agocmd: nand biterr - Add support for nand biterr command
Balamanikandan Gunasundar [Tue, 29 Jun 2021 07:16:11 +0000 (12:46 +0530)]
cmd: nand biterr - Add support for nand biterr command

The command shall be used to induce bit errors in the nand page
manually. The code flips a bit in the specified offset without
changing the ECC. This helps to see how the software handles the
error.

The patch is ported from
https://patchwork.ozlabs.org/project/uboot/patch/\
1325691123-19565-1-git-send-email-holger.brunck@keymile.com

The implementation is inspired from
'mtd-utils/nand-utils/nandflipbits.c'

Signed-off-by: Balamanikandan Gunasundar <balamanikandan.gunasundar@microchip.com>
3 years agoefi_loader: add SMBIOS table measurement
Masahisa Kojima [Tue, 26 Oct 2021 08:27:24 +0000 (17:27 +0900)]
efi_loader: add SMBIOS table measurement

TCG PC Client Platform Firmware Profile Specification
requires to measure the SMBIOS table that contains static
configuration information (e.g. Platform Manufacturer
Enterprise Number assigned by IANA, platform model number,
Vendor and Device IDs for each SMBIOS table).

The device- and environment-dependent information such as
serial number is cleared to zero or space character for
the measurement.

Existing smbios_string() function returns pointer to the string
with const qualifier, but exisintg use case is updating version
string and const qualifier must be removed.
This commit removes const qualifier from smbios_string()
return value and reuses to clear the strings for the measurement.

This commit also fixes the following compiler warning:

lib/smbios-parser.c:59:39: warning: cast to pointer from integer of
different size [-Wint-to-pointer-cast]
  const struct smbios_header *header = (struct smbios_header *)entry->struct_table_address;

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
3 years agoMerge branch '2021-10-25-assorted-updates'
Tom Rini [Tue, 26 Oct 2021 13:31:48 +0000 (09:31 -0400)]
Merge branch '2021-10-25-assorted-updates'

- Allow redundant environment on the eMMC HW boot partitions
- Use LMB in "loads"
- env, dfu + spi, OPTEE bugfixes

3 years agodfu: dfu_sf: Read the SPI flash in 16 MiB chunks
Marek Vasut [Tue, 14 Sep 2021 03:26:51 +0000 (05:26 +0200)]
dfu: dfu_sf: Read the SPI flash in 16 MiB chunks

Not all SPI flashes and controllers can do continuous transfer longer
than 16 MiB, so perform the DFU read in 16 MiB chunks.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agoarm: spl: prepare for jumping to OPTEE
Ricardo Salveti [Wed, 20 Oct 2021 12:12:06 +0000 (15:12 +0300)]
arm: spl: prepare for jumping to OPTEE

Make sure to (if applicable) flush the D-cache, invalidate I-cache,
and disable MMU and caches before jumping to OPTEE.
This fixes the SDP->SPL->OPTEE boot flow on iMX6Q and most likely on
some other ARM SoCs.

Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
Co-developed-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
3 years agoefi_loader: simplify tcg2_measure_secure_boot_variable()
Heinrich Schuchardt [Thu, 9 Sep 2021 06:50:01 +0000 (08:50 +0200)]
efi_loader: simplify tcg2_measure_secure_boot_variable()

Don't duplicate GUIDs.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agoefi_loader: simplify efi_sigstore_parse_sigdb()
Heinrich Schuchardt [Thu, 9 Sep 2021 06:25:08 +0000 (08:25 +0200)]
efi_loader: simplify efi_sigstore_parse_sigdb()

Simplify efi_sigstore_parse_sigdb() by using existing functions.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agoefi_loader: function to get GUID for variable name
Heinrich Schuchardt [Thu, 9 Sep 2021 06:22:58 +0000 (08:22 +0200)]
efi_loader: function to get GUID for variable name

In multiple places we need the default GUID matching a variable name.
The patch provides a library function. For secure boot related variables
like 'PK', 'KEK', 'db' a lookup table is used. For all other variable
names EFI_GLOBAL_VARIABLE is returned.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agoefi_loader: treat UEFI variable name as const
Heinrich Schuchardt [Thu, 9 Sep 2021 05:12:14 +0000 (07:12 +0200)]
efi_loader: treat UEFI variable name as const

UEFI variable names are typically constants and hence should be defined as
const. Unfortunately some of our API functions do not define the parameters
for UEFI variable names as const. This requires unnecessary conversions.

Adjust parameters of several internal functions to tre UEFI variable names
as const.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agoefi_loader: capsule: add back efi_get_public_key_data()
AKASHI Takahiro [Thu, 7 Oct 2021 06:23:32 +0000 (15:23 +0900)]
efi_loader: capsule: add back efi_get_public_key_data()

The commit 47a25e81d35c ("Revert "efi_capsule: Move signature from DTB to
.rodata"") failed to revert the removal of efi_get_public_key_data().

Add back this function and move it under lib/efi_loader so that other
platforms can utilize it. It is now declared as a weak function so that
it can be replaced with a platform-specific implementation.

Fixes: 47a25e81d35c ("Revert "efi_capsule: Move signature from DTB to
.rodata"")
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
3 years agoRevert "Revert "doc: Update CapsuleUpdate READMEs""
AKASHI Takahiro [Thu, 7 Oct 2021 06:23:31 +0000 (15:23 +0900)]
Revert "Revert "doc: Update CapsuleUpdate READMEs""

This reverts commit a7e4f905d206d5895dab4bd38a8316e4f2fe15fe.
The description originally written by Sughosh is still valid
even after the commit 47a25e81d35c ("Revert "efi_capsule: Move signature
from DTB to .rodata"") was applied.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
3 years agoRevert "Revert "mkeficapsule: Remove dtb related options""
AKASHI Takahiro [Thu, 7 Oct 2021 06:23:30 +0000 (15:23 +0900)]
Revert "Revert "mkeficapsule: Remove dtb related options""

This reverts commit d428e81266a59974ade74c1ba019af39f23304ab.
We have agreed with removing dtb-related stuff from mkeficapsule
command even if the commit 47a25e81d35c ("Revert "efi_capsule: Move
signature from DTB to .rodata"") was applied.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years ago.mailmap: add Heinrich Schuchardt
Heinrich Schuchardt [Sat, 23 Oct 2021 14:08:29 +0000 (16:08 +0200)]
.mailmap: add Heinrich Schuchardt

Add a mailmap entry for me.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
3 years agoefi_loader: add missing const qualifier
Masahisa Kojima [Fri, 22 Oct 2021 11:24:24 +0000 (20:24 +0900)]
efi_loader: add missing const qualifier

This commit fixes the following compilation warning
of boottime->install_configuration_table() function.

lib/efi_selftest/efi_selftest_tcg2.c:475:46:
warning: passing argument 1 of ‘boottime->install_configuration_table’
discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  ret = boottime->install_configuration_table(&smbios_guid, dmi);

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
3 years agodoc: Remove the obsolete README.mpc74xx file
Thomas Huth [Mon, 25 Oct 2021 06:56:14 +0000 (08:56 +0200)]
doc: Remove the obsolete README.mpc74xx file

Support for the PPC74xx processors has been removed in commit
d928664f41 ("powerpc: 74xx_7xx: remove 74xx_7xx cpu support")
more than 6 years ago already. So the corresponding README file
can now be removed, too.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
3 years agodoc: remove AMCC PPC405 processor references
Heinrich Schuchardt [Sat, 23 Oct 2021 11:14:39 +0000 (13:14 +0200)]
doc: remove AMCC PPC405 processor references

Support for PPC4XX processors has been removed. So we should not mention it
in the documentation.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
3 years agoenv: mmc: Add support for redundant env in both eMMC boot partitions
Marek Vasut [Sun, 17 Oct 2021 17:23:36 +0000 (19:23 +0200)]
env: mmc: Add support for redundant env in both eMMC boot partitions

Currently the MMC environment driver supports storing redundant environment
only in one eMMC partition at different offsets. This is sub-optimal, since
if this one boot partition is erased, both copies of environment are lost.
Since the eMMC has two boot partitions, add support for storing one copy of
environment in each of the two boot partitions.

To enable this functionality, select CONFIG_SYS_REDUNDAND_ENVIRONMENT to
indicate redundant environment should be used. Set CONFIG_SYS_MMC_ENV_PART
to 1 to indicate environment should be stored in eMMC boot partition. Set
CONFIG_ENV_OFFSET equal to CONFIG_ENV_OFFSET_REDUND, and both to the offset
from start of eMMC boot partition where the environment should be located.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
3 years agoloads: Block writes into LMB reserved areas of U-Boot
Marek Vasut [Sun, 10 Oct 2021 21:52:41 +0000 (23:52 +0200)]
loads: Block writes into LMB reserved areas of U-Boot

The loads srec loading may overwrite piece of U-Boot accidentally.
Prevent that by using LMB to detect whether upcoming write would
overwrite piece of reserved U-Boot code, and if that is the case,
abort the srec loading.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoenv: mmc: Add missing eMMC bootpart restoration to env erase
Marek Vasut [Wed, 6 Oct 2021 16:29:53 +0000 (18:29 +0200)]
env: mmc: Add missing eMMC bootpart restoration to env erase

If the environment is stored in eMMC hardware boot partition, the environment
driver first stores the currently selected eMMC boot partition, then does the
requested operation, and then restores the original boot partition settings.
In case the environment operation fails, the boot partition settings are also
restored.

The 'env erase' implementation in the MMC environment driver lacks the path
which restores the boot partition. This could lead to various failure modes,
like the system boots the wrong copy of bootloader etc. Fix this by filling
in the missing restoration path.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
3 years agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxi
Tom Rini [Mon, 25 Oct 2021 16:09:57 +0000 (12:09 -0400)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxi

- Add and enable watchdog driver
- Prepare for SYSRESET driven AXP poweroff
- Prepare for SoCs without MMC2
- Some fixes for extending SPL (SPL-DM for RISC-V)
- Some preparations for proper VBUS management
- Fix secure monitor move

3 years agommc: sunxi: conditionally include MMC2 initialization code
Icenowy Zheng [Thu, 22 Jul 2021 06:30:05 +0000 (14:30 +0800)]
mmc: sunxi: conditionally include MMC2 initialization code

Allwinner R329 has no MMC2.

Only include the code of MMC2 if the base address of it is defined.

Signed-off-by: Icenowy Zheng <icenowy@sipeed.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agosunxi: only include alias for eMMC when mmc2 used
Icenowy Zheng [Thu, 22 Jul 2021 06:30:04 +0000 (14:30 +0800)]
sunxi: only include alias for eMMC when mmc2 used

Some Allwinner SoCs (e.g. R329) doesn't have a MMC2 controller at all,
and on boards that we do not utilize MMC2, the alias for it is just
useless.

Only include the alias when we specify CONFIG_MMC_SUNXI_EXTRA_SLOT to 2.

Signed-off-by: Icenowy Zheng <icenowy@sipeed.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agosunxi: dts: H616: Enable the watchdog
Samuel Holland [Sun, 22 Aug 2021 18:53:29 +0000 (13:53 -0500)]
sunxi: dts: H616: Enable the watchdog

For some reason, the watchdog was disabled in the H616 device tree. Most
likely this is a copy-paste from the H6 device tree: the H6 watchdog is
disabled because it is broken in some chips. However, there is no
evidence of issues with the H616 watchdog.

Enable the watchdog node so it can be used by the driver.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agoMerge tag 'u-boot-imx-20211022' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
Tom Rini [Mon, 25 Oct 2021 13:54:36 +0000 (09:54 -0400)]
Merge tag 'u-boot-imx-20211022' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx

u-boot-imx-20211022
-------------------

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

- i.MX8:
- Toradex Verdin (switch to binman, cleanup, etc.)
- Phytec phycore_imx8mm (fixes, boot from SPI-NOR)
- fixes for imx8mp_evk
- doc (i.MX): MX8MM with Fast boot
- i.MX6:
- Toradex : colibri-imx6ull with eMMC, fixes
- i.MX7ULP :
- preparation for OPTEE + Serial Number
- generic:
- imx8m_image: Support ddr3 firmware

3 years agosunxi: Enable watchdog timer support by default
Samuel Holland [Sun, 22 Aug 2021 18:53:28 +0000 (13:53 -0500)]
sunxi: Enable watchdog timer support by default

A watchdog helps recover from hangs or failure to boot an OS. It can
also be used by the sysreset framework to intentionally reset the
system. Now that a driver is available, let's enable this functionality
on sunxi boards.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agowatchdog: Add a driver for the sunxi watchdog
Samuel Holland [Sun, 22 Aug 2021 18:53:27 +0000 (13:53 -0500)]
watchdog: Add a driver for the sunxi watchdog

This driver supports the sun4i/sun6i/sun20i watchdog timers.
They have a maximum timeout of 16 seconds.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agoclk: sunxi: Extend DM_RESET selection to SPL
Samuel Holland [Sat, 11 Sep 2021 19:45:31 +0000 (14:45 -0500)]
clk: sunxi: Extend DM_RESET selection to SPL

The sunxi clock driver exposes a reset controller, so it selects the
reset controller framework. Ensure that dependency is also satisfied
when building the driver for the SPL.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agosunxi: SPL SPI: Allow larger SPL
Andre Przywara [Mon, 5 Jul 2021 23:04:43 +0000 (00:04 +0100)]
sunxi: SPL SPI: Allow larger SPL

The more recent Allwinner SoCs BootROMs can actually load SPL images
larger than 32KB. We use this on the H616 to fit the extra code needed
for the PMIC into the image, and have provisions in board.c to respect
that larger SPL size when booting from MMC.

However the sunxi SPL SPI loader has a hardcoded load offset of 32KB,
which will fail on the H616.

To fix this, use the same algorithm we use for MMC: if the SPL size is
smaller than 32KB, we use 32KB, otherwise we expect the U-Boot payload
directly after the SPL code.

This prepares for SPI booting with larger SPLs like on the H616.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
3 years agopower: pmic: axp: Implement poweroff via sysreset
Samuel Holland [Mon, 25 Oct 2021 02:00:10 +0000 (21:00 -0500)]
power: pmic: axp: Implement poweroff via sysreset

The AXP PMICs have the ability to power off the system. The existing
code for this is duplicated for each PMIC variant, and uses the legacy
non-DM "pmic_bus" interface. When SYSRESET is enabled, this can all be
replaced with a sysreset device using the DM_PMIC interface.

Since the trigger bit is the same on all PMIC variants, use the register
definitions from the oldest supported PMIC.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agopower: axp: Avoid do_poweroff conflict with sysreset
Samuel Holland [Sun, 22 Aug 2021 23:18:05 +0000 (18:18 -0500)]
power: axp: Avoid do_poweroff conflict with sysreset

The sysreset uclass has an option to provide the do_poweroff() function.
When that option is enabled, the AXP power drivers should not provide
their own definition.

For the AXP305, which is paired with 64-bit systems where TF-A provides
PSCI, there is another possible conflict with the PSCI firmware driver.
This driver can be enabled even if CONFIG_PSCI_RESET is disabled, so
make sure to use the right symbol in the condition.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agoinclude: axp_pmic: Include headers for all variants
Samuel Holland [Sun, 22 Aug 2021 23:18:04 +0000 (18:18 -0500)]
include: axp_pmic: Include headers for all variants

A single DM-based driver should be able to support some feature for
several PMIC variants where the interface is the same. For example,
all PMIC variants use the same register bit to trigger poweroff.

However, currently only definitions for a single PMIC are available at
a time. This requires drivers to use #ifdefs and different indentifiers
for each variant they support.

Let's simplify this by making register definitions for all variants
available from the header. Then no preprocessor conditions are needed;
the driver can use the register definition from any variant that
supports the relevant feature.

An exception is the GPIO-related definitions, which do not use unique
identifiers. So for now, keep them like before. They will be cleaned up
along with the GPIO driver.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agoinclude: axp_pmic: Add missing header guard definition
Samuel Holland [Sun, 22 Aug 2021 23:18:03 +0000 (18:18 -0500)]
include: axp_pmic: Add missing header guard definition

This header attempted to avoid multiple inclusion using a header guard.
But the preprocessor symbol was never defined, so the guard had no
effect. Fix this by defining the symbol.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agotools: mksunxiboot: Use sunxi_image header directly
Samuel Holland [Wed, 13 Oct 2021 00:35:41 +0000 (19:35 -0500)]
tools: mksunxiboot: Use sunxi_image header directly

When adding eGON support to mkimage, the struct boot_file_head
definition was moved to its own header. This is the only thing
mksunxiboot needed out of asm/arch/spl.h. Clean up the relative
include by switching to new header.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agosunxi: A23/A33/H3: Actually move the secure monitor
Samuel Holland [Tue, 12 Oct 2021 23:54:56 +0000 (18:54 -0500)]
sunxi: A23/A33/H3: Actually move the secure monitor

commit 1ebfc0c631e3 ("sunxi: A23/A33/H3: Move sun8i secure monitor to
SRAM A2") attempted to move the secure monitor to SRAM A2. But not all
sun8i SoCs have SRAM A2, so a check was put in for SUNXI_SRAM_A2_SIZE to
avoid breaking the other SoCs.

However, because the header providing SUNXI_SRAM_A2_SIZE was not
included, this unintentionally skipped the new definitions on all SoCs.
Fix this by including the right header.

Fixes: 1ebfc0c631e3 ("sunxi: A23/A33/H3: Move sun8i secure monitor to SRAM A2")
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agophy: sun4i-usb: Support VBUS detection via power supply
Samuel Holland [Sun, 12 Sep 2021 14:22:42 +0000 (09:22 -0500)]
phy: sun4i-usb: Support VBUS detection via power supply

The device tree binding provides for getting VBUS state from a device
referenced by phandle, as an optional alternative to using a GPIO. In
U-Boot, where there is no power supply class, this VBUS detection will
be implemented using a regulator device and its get_enable method.
Let's hook this up to the PHY driver.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Acked-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agophy: sun4i-usb: Refactor VBUS detection to match Linux
Samuel Holland [Sun, 12 Sep 2021 14:22:41 +0000 (09:22 -0500)]
phy: sun4i-usb: Refactor VBUS detection to match Linux

The Linux driver checks the VBUS detection GPIO first; then VBUS power
supply; then finally assumes VBUS is present. When adding VBUS power
supply support, we want to match that order, so we get the same behavior
in case both a GPIO and a power supply are provided in the device tree.

So refactor the function a bit to remove the early return, and use the
same "assume VBUS is present" final fallback.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Acked-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agophy: sun4i-usb: Remove a couple of debug messages
Samuel Holland [Sun, 12 Sep 2021 14:22:40 +0000 (09:22 -0500)]
phy: sun4i-usb: Remove a couple of debug messages

Both of these messages log the GPIO number of the ID detection GPIO,
which is not terribly useful, especially in the VBUS detection function.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agosunxi: Select SPL_SEPARATE_BSS
Samuel Holland [Sun, 22 Aug 2021 18:23:53 +0000 (13:23 -0500)]
sunxi: Select SPL_SEPARATE_BSS

sunxi-common.h defines CONFIG_SPL_BSS_START_ADDR to put SPL's BSS in
DRAM. Due to this, we must select SPL_SEPARATE_BSS, or else SPL will
attempt to load its DTB from the wrong address (after BSS in DRAM).

This change fixes booting with SPL_OF_CONTROL=y.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-spi
Tom Rini [Sat, 23 Oct 2021 14:49:28 +0000 (10:49 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-spi

- Fix mtd erase with mtdpart (Marek Behún)
- NXP fspi driver fixes (Kuldeep Singh)

3 years agospi: nxp_fspi: Implement errata workaround for LS1028A
Kuldeep Singh [Tue, 3 Aug 2021 09:02:58 +0000 (14:32 +0530)]
spi: nxp_fspi: Implement errata workaround for LS1028A

Errata ERR050568 description says that "Flash access by FlexSPI AHB
command may not work with platform frequency equal to 300 MHz" on
LS1028A.

By default, smaller length reads(equal to RX FIFO size) are done by IP
bus and larger length reads using AHB bus. For adding errata workaround,
use IP bus to read entire flash contents and disable AHB path when
platform frequency is 300Mhz.

Signed-off-by: Kuldeep Singh <kuldeep.singh@nxp.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
3 years agospi: nxp-fspi: Add support for IP read only
Kuldeep Singh [Tue, 3 Aug 2021 09:02:57 +0000 (14:32 +0530)]
spi: nxp-fspi: Add support for IP read only

Add support for disabling AHB bus and read entire flash contents via IP
bus only. Please note, this enables IP bus read using a quirk which can
be enabled directly in device-type data or in existence of an errata
where AHB bus may need to be disabled.

Signed-off-by: Kuldeep Singh <kuldeep.singh@nxp.com>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
3 years agomtd: spi-nor-ids: Add SECT_4K to mt25qu512a
Kris Chaplin [Mon, 18 Oct 2021 10:30:18 +0000 (03:30 -0700)]
mtd: spi-nor-ids: Add SECT_4K to mt25qu512a

The mt25qu512a supports 4K or 64K sectors, so adding
SECT_4K to enable 4K sector usage.

Tested on Intel n5x hardware with QSPI carrier card

Signed-off-by: Kris Chaplin <kris.chaplin@linux.intel.com>
Acked-by: Pratyush Yadav <p.yadav@ti.com>
[jagan: droped Tested-by of patch author and datasheet link]
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>