]> git.baikalelectronics.ru Git - uboot.git/log
uboot.git
2 years agoefi_loader: call efi_init_early() earlier
Heinrich Schuchardt [Thu, 28 Apr 2022 06:30:30 +0000 (06:30 +0000)]
efi_loader: call efi_init_early() earlier

efi_init_early() creates an event hook for block device probing.
It has to be called before any block device is probed.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoefi_loader: disk: allow blk devices even without UCLASS_PARTITION
AKASHI Takahiro [Thu, 28 Apr 2022 04:49:16 +0000 (13:49 +0900)]
efi_loader: disk: allow blk devices even without UCLASS_PARTITION

While GPT partition is mandated in UEFI specification, CONFIG_PARTITION is
seen optional under the current implementation.
So modify efi_disk_rw_blocks() to allow accepting UCLASS_BLK devices.

Fixes: commit 5ab1ab597483 ("efi_loader: disk: use udevice instead of blk_desc")
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Tested-by: Mark Kettenis <kettenis@openbsd.org>
2 years agoefi_loader: simplify efi_add_conventional_memory_map()
Heinrich Schuchardt [Mon, 25 Apr 2022 21:54:48 +0000 (23:54 +0200)]
efi_loader: simplify efi_add_conventional_memory_map()

Remove redundant constraint.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoefi_loader: simplify try_load_entry()
Heinrich Schuchardt [Mon, 25 Apr 2022 21:35:01 +0000 (23:35 +0200)]
efi_loader: simplify try_load_entry()

Use function efi_create_indexed_name() to create the BootXXXX variable
name.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoefi: fix devpath_is_partition()
Heinrich Schuchardt [Mon, 25 Apr 2022 21:21:20 +0000 (23:21 +0200)]
efi: fix devpath_is_partition()

If the path consists only of an end node, it does not refer to a partition.
Avoid returning a random value from the stack in this case.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoefi_loader: don't call log with __func__ as parameter
Heinrich Schuchardt [Fri, 29 Apr 2022 05:15:04 +0000 (07:15 +0200)]
efi_loader: don't call log with __func__ as parameter

The log functions print file name, line number, and function name if
selected via the log command or customizing. Don't print the function
name twice.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-mpc85xx
Tom Rini [Wed, 27 Apr 2022 13:19:41 +0000 (09:19 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-mpc85xx

fsl-qoriq: Fixes and updates on fsl-layerscape
mpc85xx: fixes and code cleanup

2 years agoMerge tag 'u-boot-amlogic-20220427' of https://source.denx.de/u-boot/custodians/u...
Tom Rini [Wed, 27 Apr 2022 13:19:17 +0000 (09:19 -0400)]
Merge tag 'u-boot-amlogic-20220427' of https://source.denx.de/u-boot/custodians/u-boot-amlogic

- Add AXG support for SARADC, including minimal ao-clk driver
- Update Amlogic documentation for Matrix & Jethub D1

2 years agodoc: boards: amlogic: update jethub d1 specifications
Vyacheslav Bocharov [Tue, 26 Apr 2022 05:26:33 +0000 (08:26 +0300)]
doc: boards: amlogic: update jethub d1 specifications

Signed-off-by: Vyacheslav Bocharov <adeep@lexina.in>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
[narmstrong: removed trailing whitespaces and fixed sphinx build error]
Link: https://lore.kernel.org/r/20220426052633.3027932-2-adeep@lexina.in
2 years agoMerge tag 'u-boot-at91-2022.07-b' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Tue, 26 Apr 2022 11:54:12 +0000 (07:54 -0400)]
Merge tag 'u-boot-at91-2022.07-b' of https://source.denx.de/u-boot/custodians/u-boot-at91

Second set of u-boot-at91 features for the 2022.07 cycle:

This feature set includes the new driver for the AT91 reset controller,
a new board called sam9x60 curiosity, and several other fixes and
clean-ups (sama7g5ek qspi clock, impedance; remove unused code,
introduce Kconfig symbols for SPL timers)

2 years agocpu: 83xx: Add missing dependency on CPU_MPC83XX
Michal Simek [Fri, 22 Apr 2022 13:32:21 +0000 (15:32 +0200)]
cpu: 83xx: Add missing dependency on CPU_MPC83XX

It looks quite weird that for non PPC platforms cpu driver for MPC83xx can
be selected. That's why define proper dependency.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agoboard: ls1046afrwy: Remove Manish Tomar's email
Sean Anderson [Tue, 19 Apr 2022 21:06:31 +0000 (17:06 -0400)]
board: ls1046afrwy: Remove Manish Tomar's email

Manish Tomar's email bounces. Remove it, and reassign the config he was
maintaining to the primary maintainer for the board.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agopci: fsl: Change compatible string for mpc8548 to "fsl, mpc8548-pcie"
Pali Rohár [Thu, 14 Apr 2022 20:52:03 +0000 (22:52 +0200)]
pci: fsl: Change compatible string for mpc8548 to "fsl, mpc8548-pcie"

Upstream Linux kernel uses for mpc8548-based PCIe controllers compatible
string "fsl,mpc8548-pcie". So change U-Boot fsl PCIe driver and all DTS
files to use "fsl,mpc8548-pcie" instead of "fsl,pcie-mpc8548" to be
compatible with Linux kernel.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agopowerpc: dts: p2020: Set dfsrr property for i2c nodes
Pali Rohár [Fri, 8 Apr 2022 12:39:58 +0000 (14:39 +0200)]
powerpc: dts: p2020: Set dfsrr property for i2c nodes

Linux kernel dts files pq3-i2c-*.dtsi also sets this dfsrr property for i2c
nodes.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agopowerpc: dts: p2020: Define L2 cache node
Pali Rohár [Fri, 8 Apr 2022 12:39:57 +0000 (14:39 +0200)]
powerpc: dts: p2020: Define L2 cache node

Copy definition of L2 cache node from upstream Linux kernel P2020 dts files.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agopowerpc: dts: p2020: Make usb@22000 node compatible for Linux kernel driver
Pali Rohár [Fri, 8 Apr 2022 12:39:56 +0000 (14:39 +0200)]
powerpc: dts: p2020: Make usb@22000 node compatible for Linux kernel driver

Linux P2020 USB kernel driver uses compatible string fsl-usb2-dr-v1.6 and
needs more DT properties. Copy P2020 usb@22000 properties from upstream
Linux kernel.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agopowerpc: dts: p2020: Add missing interrupts property to spi@7000 node
Pali Rohár [Fri, 8 Apr 2022 12:39:55 +0000 (14:39 +0200)]
powerpc: dts: p2020: Add missing interrupts property to spi@7000 node

interrupts property for spi@7000 node is needed for compatibility with
Linux kernel.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agopowerpc: dts: p2020: Do not automatically disable spi@7000 node in p2020-post.dtsi
Pali Rohár [Fri, 8 Apr 2022 12:39:54 +0000 (14:39 +0200)]
powerpc: dts: p2020: Do not automatically disable spi@7000 node in p2020-post.dtsi

Device tree include file p2020-post.dtsi should be included after the board
device tree file and overrides settings of the board. So it should not
disable some node as board cannot enable it via normal way (it has to
enable it after inclusion of p2020-post.dtsi file).

Fix it by removal of explicit disable in p2020-post.dtsi file and then
remove explicit post-post enable in all P2020 board device tree files.
Currently no P2020 board has spi@7000 node disabled.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agopowerpc: dts: p2020: Add Linux compatible string and property for eSDHC
Pali Rohár [Fri, 8 Apr 2022 12:39:53 +0000 (14:39 +0200)]
powerpc: dts: p2020: Add Linux compatible string and property for eSDHC

Linux kernel eSDHC driver for P2020 requires additional compatible string
fsl,p2020-esdhc and interrupts property. Add them to p2020-post.dtsi file
to make U-Boot board DTS files compatible for Linux kernel.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agopowerpc: dts: p2020: Add ptp_clock@24e00 node via pq3-etsec1-timer-0.dtsi
Pali Rohár [Fri, 8 Apr 2022 12:39:52 +0000 (14:39 +0200)]
powerpc: dts: p2020: Add ptp_clock@24e00 node via pq3-etsec1-timer-0.dtsi

Import pq3-etsec1-timer-0.dtsi device tree include file from upstream Linux
kernel for P2020. This allows U-Boot to use P2020 device tree files from
upstream Linux kernel which reference ptp_clock@24e00 device.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agopowerpc: dts: p2020: Make PCIe nodes compatible for Linux kernel driver
Pali Rohár [Fri, 8 Apr 2022 12:39:51 +0000 (14:39 +0200)]
powerpc: dts: p2020: Make PCIe nodes compatible for Linux kernel driver

Linux P2020 PCIe kernel driver uses compatible string fsl,mpc8548-pcie and
needs more DT properties. Copy P2020 PCIe nodes and definitions from
upstream Linux kernel.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agopowerpc: dts: p2020: Add gpio-controller@fc00 node via pq3-gpio-0.dtsi
Pali Rohár [Fri, 8 Apr 2022 12:39:50 +0000 (14:39 +0200)]
powerpc: dts: p2020: Add gpio-controller@fc00 node via pq3-gpio-0.dtsi

Import pq3-gpio-0.dtsi device tree include file from upstream Linux kernel
for P2020. This allows U-Boot to use P2020 device tree files from upstream
Linux kernel which reference gpio-controller@fc00 device.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agoboard: freescale: p1_p2_rdb_pc: Define SW macros for lower and upper NOR banks
Pali Rohár [Thu, 7 Apr 2022 10:16:22 +0000 (12:16 +0200)]
board: freescale: p1_p2_rdb_pc: Define SW macros for lower and upper NOR banks

Replace hardcoded i2c hex values for NOR banks by named SW macros in
map_lowernorbank/map_uppernorbank env commands.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agoboard: freescale: p1_p2_rdb_pc: Use named macros for i2c bus num and address
Pali Rohár [Thu, 7 Apr 2022 10:16:21 +0000 (12:16 +0200)]
board: freescale: p1_p2_rdb_pc: Use named macros for i2c bus num and address

Replace hardcoded boot i2c bus num and address by existing macros when
generating env for CONFIG_EXTRA_ENV_SETTINGS.

Same macros are used in U-Boot board code when reading information from
boot i2c data.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agoboard: freescale: p1_p2_rdb_pc: Fix env $vscfw_addr
Pali Rohár [Thu, 7 Apr 2022 10:16:20 +0000 (12:16 +0200)]
board: freescale: p1_p2_rdb_pc: Fix env $vscfw_addr

Do not stringify env $vscfw_addr two times (once implicitly via string
operator "" and second time explicitly via __stringify() macro) and allow
to compile U-Boot without CONFIG_VSC7385_ENET (when __VSCFW_ADDR was not
defined and so macro name was stringified into CONFIG_EXTRA_ENV_SETTINGS).

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agoboard: freescale: p1_p2_rdb_pc: Move ifdef for USB/eLBC check to correct place
Pali Rohár [Thu, 7 Apr 2022 10:16:19 +0000 (12:16 +0200)]
board: freescale: p1_p2_rdb_pc: Move ifdef for USB/eLBC check to correct place

Whole section about USB/eLBC configuration seems to be P1020 specific. So
add ifdefs to not compile it on other platforms (e.g. P2020).

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agoboard: freescale: p1_p2_rdb_pc: Fix page attributes for second 1G SDRAM map
Pali Rohár [Thu, 7 Apr 2022 10:16:18 +0000 (12:16 +0200)]
board: freescale: p1_p2_rdb_pc: Fix page attributes for second 1G SDRAM map

Like for first 1G SDRAM map, do not enable Caching-inhibited nor Guarded
attribute for second 1G SDRAM mapping. Whole 2G SDRAM should use caches and
also allow speculative loading (by not setting Guarded attribute).

Also enable Memory Coherency attribute for second 1G SDRAM map. In commit
5fe1ab62495c ("powerpc: mpc85xx: Fix static TLB table for SDRAM") it was
enabled for all SDRAM maps on all other boards, just missed this one case.

As a last thing, first 1G SDRAM map has wrong comment, so adjust it.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agoboard: freescale: p1_p2_rdb_pc: Do not set MPC85xx_PMUXCR_SDHC_WP bit when SDHC_WP...
Pali Rohár [Thu, 7 Apr 2022 10:16:17 +0000 (12:16 +0200)]
board: freescale: p1_p2_rdb_pc: Do not set MPC85xx_PMUXCR_SDHC_WP bit when SDHC_WP is used as GPIO

When MPC85xx_PMUXCR_SDHC_WP is set then SDHC controller automatically makes
inserted SD card readonly if GPIO[9] is active.

In some design GPIO[9] pin does not have to be connected to SD card
write-protect pin and can be used as GPIO.

So do not set MPC85xx_PMUXCR_SDHC_WP bit when GPIO[9] is not used for
SDHC_WP functionality.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agoboard: freescale: p1_p2_rdb_pc: Detect both P2020 SD switch configurations
Pali Rohár [Thu, 7 Apr 2022 10:16:15 +0000 (12:16 +0200)]
board: freescale: p1_p2_rdb_pc: Detect both P2020 SD switch configurations

As written in comment, P2020 has two possible SD switch configurations.
Extend code to detect both of them.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agoboard: freescale: p1_p2_rdb_pc: Do not hang in checkboard()
Pali Rohár [Thu, 7 Apr 2022 10:16:14 +0000 (12:16 +0200)]
board: freescale: p1_p2_rdb_pc: Do not hang in checkboard()

Like in all other checks in checkboard() function, do not hang on error.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agopowerpc: mpc85xx: Define linker sections in ascending order
Pali Rohár [Tue, 5 Apr 2022 13:12:35 +0000 (15:12 +0200)]
powerpc: mpc85xx: Define linker sections in ascending order

It is too confusing if sections are defined in non-ascending order.

Also linker has to go backward and then again forward when generating final
binary.

To make future changes easier, define all linker sections in ascending
order.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agopowerpc: mpc85xx: Put bss after image when not including reset vector
Pali Rohár [Tue, 5 Apr 2022 13:12:34 +0000 (15:12 +0200)]
powerpc: mpc85xx: Put bss after image when not including reset vector

Linker knows exact size of the image, so there is no need to use
CONFIG_SYS_MONITOR_LEN macro (which should be upper limit).

Remove usage of CONFIG_SYS_MONITOR_LEN macro to simplify setup.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agopowerpc: mpc85xx: Remove useless SIZEOF_HEADERS and .interp from ld script
Pali Rohár [Tue, 5 Apr 2022 13:12:33 +0000 (15:12 +0200)]
powerpc: mpc85xx: Remove useless SIZEOF_HEADERS and .interp from ld script

.interp section is not available in output ELF binary and SIZEOF_HEADERS is
needed at all.

There is no change in generated u-boot.bin binary.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agopowerpc: mpc85xx: Remove duplicate u-boot-nand.lds
Pali Rohár [Mon, 25 Apr 2022 08:51:20 +0000 (14:21 +0530)]
powerpc: mpc85xx: Remove duplicate u-boot-nand.lds

Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agopowerpc: mpc85xx: Remove u-boot-nand_spl.lds
Pali Rohár [Mon, 25 Apr 2022 04:02:03 +0000 (09:32 +0530)]
powerpc: mpc85xx: Remove u-boot-nand_spl.lds

mpc85xx SPL NAND linker script u-boot-nand_spl.lds is not used since
Jun 2014 commit 0234446fd171 ("nand_spl: remove MPC8536DS support").

Remove it.

Signed-off-by: Pali Rohár <pali@kernel.org>
[Rebased]
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agopowerpc: mpc85xx: Fix CONFIG_OF_SEPARATE support
Pali Rohár [Tue, 5 Apr 2022 13:12:30 +0000 (15:12 +0200)]
powerpc: mpc85xx: Fix CONFIG_OF_SEPARATE support

Currently CONFIG_OF_SEPARATE is completely broken and U-Boot for some
mpc85xx board (e.g. P2020) has to be compiled with CONFIG_OF_EMBED.
Otherwise it crashes during early init.

When debug console is enabled and all debug logging options are turned on
then U-Boot on P2020 with CONFIG_OF_SEPARATE prints following error:

  No valid device tree binary found at 110dc300
  initcall sequence 110d3560 failed at call 1109535c (err=-1)
  ### ERROR ### Please RESET the board ###

Problem is with appended DTB. When CONFIG_SYS_MPC85XX_NO_RESETVEC is set
U-Boot binary image without DTB ends immediately after the .u_boot_list
section. At this position is defined _end symbol at which U-Boot expects
start of the appended DTB.

Problem is that after .u_boot_list section are in linker script defined
another sections with 256 byte long padding which are completely empty.
During conversion of U-Boot ELF binary to RAW binary u-boot-nodtb.bin,
objcopy removes trailing zero padding and therefore DTB is appended at
wrong position.

Changing alignment from 256 bytes to 4 bytes fixes this issue. And appended
DTB is finally at he correct position. With this fix U-Boot on P2020 with
CONFIG_OF_SEPARATE option starts working again.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agopowerpc: dts: p1020/p2020: Fix esdhc node name
Pali Rohár [Tue, 5 Apr 2022 09:23:25 +0000 (11:23 +0200)]
powerpc: dts: p1020/p2020: Fix esdhc node name

For compatibility with Linux kernel DTS files and also with other U-Boot
powerpc DTS files, rename esdhc@2e000 node to sdhc@2e000 in p1020-post.dtsi
and p2020-post.dtsi include files.

Linux kernel DTS files which include these dtsi files, expect that esdhc
node has name sdhc@2e000 and do not work with other node names.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agopowerpc: dts: p2020: Add localbus node
Pali Rohár [Tue, 5 Apr 2022 09:15:21 +0000 (11:15 +0200)]
powerpc: dts: p2020: Add localbus node

This node is required for NAND and NOR support. Node is taken from the
upstream Linux kernel DTS file.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agommc: fsl_esdhc_spl: pre-PBL: implement redundancy support
Pali Rohár [Mon, 4 Apr 2022 16:33:11 +0000 (18:33 +0200)]
mmc: fsl_esdhc_spl: pre-PBL: implement redundancy support

QorIQ pre-PBL BootROM scans first 24 SD card sectors (each with fixed 512
bytes length) for boot signature. Implement same redundancy behavior in
fsl_esdhc_spl driver to allow loading proper U-Boot when boot sector is not
the first one.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agommc: fsl_esdhc: Define macro ESDHCCTL_SNOOP for Snoop attribute
Pali Rohár [Mon, 4 Apr 2022 16:32:13 +0000 (18:32 +0200)]
mmc: fsl_esdhc: Define macro ESDHCCTL_SNOOP for Snoop attribute

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agomtd: nand: raw: Add support for DT property nand-ecc-algo=bch
Pali Rohár [Mon, 4 Apr 2022 16:17:21 +0000 (18:17 +0200)]
mtd: nand: raw: Add support for DT property nand-ecc-algo=bch

According to Linux kernel DT schema nand-controller.yaml, using DT property
nand-ecc-algo=bch is the correct way for specifying BCH as ECC algorithm.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agomtd: rawnand: fsl_elbc: Use ECC configuration from device tree
Pali Rohár [Mon, 4 Apr 2022 16:17:20 +0000 (18:17 +0200)]
mtd: rawnand: fsl_elbc: Use ECC configuration from device tree

Initialize ECC configuration after nand_scan_ident() call and only in case
nand_scan_ident() have not done it. nand_scan_ident() fills ECC
configuration from device tree.

Fixes usage of NAND_ECC_SOFT_BCH when it is specified in device tree.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agomtd: rawnand: fsl_elbc: Add device tree support
Pali Rohár [Mon, 4 Apr 2022 16:17:19 +0000 (18:17 +0200)]
mtd: rawnand: fsl_elbc: Add device tree support

This allows boards to specify NAND settings via standard DT properties.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agomtd: rawnand: fsl_elbc: Implement RNDOUT command
Pali Rohár [Mon, 4 Apr 2022 16:17:18 +0000 (18:17 +0200)]
mtd: rawnand: fsl_elbc: Implement RNDOUT command

This is needed for SW ECC.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agopowerpc: dts: p2020: Add serial0 and serial1 via pq3-duart-0.dtsi
Pali Rohár [Sat, 2 Apr 2022 22:42:26 +0000 (00:42 +0200)]
powerpc: dts: p2020: Add serial0 and serial1 via pq3-duart-0.dtsi

Import pq3-duart-0.dtsi device tree include file from upstream Linux kernel
for P2020. This allows U-Boot to use P2020 device tree files from upstream
Linux kernel which reference serial0 or serial1 devices.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agopowerpc: dts: p2020: Add fsl/p2020si-pre.dtsi and fsl/p2020si-post.dtsi symlinks
Pali Rohár [Sat, 2 Apr 2022 22:42:25 +0000 (00:42 +0200)]
powerpc: dts: p2020: Add fsl/p2020si-pre.dtsi and fsl/p2020si-post.dtsi symlinks

P2020 DTS files in upstream Linux kernel use fsl/p2020si-pre.dtsi and
fsl/p2020si-post.dtsi include device tree files.

Add symlinks for these include device tree files into U-Boot powerpc
directory and points them to U-Boot inline device tree files p2020.dtsi and
p2020-post.dtsi.

This allows to use P2020 DTS files from upstream Linux kernel in U-Boot.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agoboard: freescale: p1_p2_rdb_pc: Allow to compile it without env support
Pali Rohár [Sat, 2 Apr 2022 22:24:27 +0000 (00:24 +0200)]
board: freescale: p1_p2_rdb_pc: Allow to compile it without env support

When env support is disabled then usage of env_init() or env_relocate()
generates linker errors. So do not compile env_init() or env_relocate()
in SPL code when env support is disabled in SPL.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agoddr: fsl: Allow to compile it without env support
Pali Rohár [Sat, 2 Apr 2022 22:24:26 +0000 (00:24 +0200)]
ddr: fsl: Allow to compile it without env support

When env support is disabled then usage of env_get_f() generates linker
errors. So do not compile env_get_f() when env support is disabled (for
example when disabled only in SPL).

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agohwconfig: Allow to compile it without env support
Pali Rohár [Sat, 2 Apr 2022 22:24:25 +0000 (00:24 +0200)]
hwconfig: Allow to compile it without env support

When env support is disabled then usage of env_get() generates linker
errors. So do not compile env_get() when env support is disabled (for
example when disabled only in SPL).

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agommc: mmc_mode_name() is used also when LOGLEVEL >= LOGL_DEBUG
Pali Rohár [Sat, 2 Apr 2022 22:20:10 +0000 (00:20 +0200)]
mmc: mmc_mode_name() is used also when LOGLEVEL >= LOGL_DEBUG

When CONFIG_LOGLEVEL is set to LOGL_DEBUG or higher then linker throws
error about undefined symbol mmc_mode_name(). So compile mmc_mode_name()
also when CONFIG_LOGLEVEL is set to LOGL_DEBUG or higher.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agommc: fsl_esdhc_spl: Call mmc_init() before booting from SD card
Pali Rohár [Sat, 2 Apr 2022 22:17:01 +0000 (00:17 +0200)]
mmc: fsl_esdhc_spl: Call mmc_init() before booting from SD card

If env is stored on SD card then U-Boot SPL automatically calls mmc_init()
before it is going to load proper U-Boot from SD card.

If env is not stored on SD card then U-Boot SPL fails to read proper U-Boot
from SD card due to missing mmc_init() call.

So add missing mmc_init() call into fsl_esdhc_spl's mmc_boot() function.
It fixes booting from SD card on P2020 boards without env support in SPL.

mmc_init() returns early if card was already initialized, so there is no
issue with calling this function more times.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agommc: fsl_esdhc_spl: pre-PBL: fix determining U-Boot size
Pali Rohár [Sat, 2 Apr 2022 22:17:00 +0000 (00:17 +0200)]
mmc: fsl_esdhc_spl: pre-PBL: fix determining U-Boot size

In pre-PBL header is stored size of code which BootROM copies from SD card
to L2/SRAM. This size has upper limit of L2 cache size. In most cases this
is size of U-Boot SPL or size of L2 cache.

Therefore this size in pre-PBL header cannot be used for determining size
of proper U-Boot.

So always use CONFIG_SYS_MMC_U_BOOT_SIZE for determining size of proper
U-Boot which stored on SD card.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agommc: fsl_esdhc_spl: pre-PBL: check for BOOT signature instead of MBR/DBR
Pali Rohár [Sat, 2 Apr 2022 22:16:59 +0000 (00:16 +0200)]
mmc: fsl_esdhc_spl: pre-PBL: check for BOOT signature instead of MBR/DBR

Pre-PBL BootROMs (MPC8536E, MPC8569E, P2020, P1011, P1012, P1013, P1020,
P1021, P1022) require custom BOOT signature on sector 0 and MBR/DBR
signature is not required at all.

So add check for BOOT signature and remove check for MBR/DBR.

This allows U-Boot SPL to load proper U-Boot on pre-PBL BootROMs platforms
also from SD cards which do not have MBR/DBR signature on sector 0.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agopowerpc: mpc85xx: Show e500 core version
Pali Rohár [Sat, 2 Apr 2022 22:05:10 +0000 (00:05 +0200)]
powerpc: mpc85xx: Show e500 core version

Distinguish between e500v1 and e500v2.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agopowerpc: mpc85xx: Rename _start_e500 symbol to _start
Pali Rohár [Sat, 2 Apr 2022 22:05:09 +0000 (00:05 +0200)]
powerpc: mpc85xx: Rename _start_e500 symbol to _start

The real entry point is _start_e500. There is no _start symbol at all. So
rename _start_e500 to _start for convension that _start symbol is used as
entry point.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agopowerpc: mpc85xx: Drop _start symbol
Pali Rohár [Mon, 25 Apr 2022 03:59:08 +0000 (09:29 +0530)]
powerpc: mpc85xx: Drop _start symbol

_start symbol contains only 32-bit data number 0x27051956 despite it is
marked as text section. This magic number is IH_MAGIC which is used for
marking uboot image header.

mpc85xx start.S code does not define valid uboot image header, so IH_MAGIC
number in _start symbol is useless there.

Moreover this _start symbol is not used at all. Entry point is at symbol
_start_e500.

So because this _start symbol is not used for anything, completely remove
it with IH_MAGIC number. After _start symbol was _start_cont symbol, so
replace all relative address calculations by _start_cont.

Signed-off-by: Pali Rohár <pali@kernel.org>
[Rebased]
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agoarmv8/fsl-lsch3: Suppress spurious warning on Layerscape CPUs
Stephen Carlson [Tue, 29 Mar 2022 21:51:10 +0000 (14:51 -0700)]
armv8/fsl-lsch3: Suppress spurious warning on Layerscape CPUs

NXP/Freescale Layerscape CPUs support high-speed serial interfaces (SERDES)
that can be configured for the application. Interfaces not used by the
application can be set to protocol 0 to turn them off and save power, but
U-Boot would emit a warning that 0 was invalid for a SERDES protocol on
boot. Replace the warning text with a notice that the SERDES is disabled.

Signed-off-by: Stephen Carlson <stcarlso@linux.microsoft.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agoarmv8: layerscape: fix the function mismatch issue
Yuantian Tang [Wed, 9 Mar 2022 07:37:22 +0000 (15:37 +0800)]
armv8: layerscape: fix the function mismatch issue

Signed-off-by: Yuantian Tang <andy.tang@nxp.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agoboard: sl28: add basic PSCI implementation
Michael Walle [Mon, 25 Apr 2022 03:55:08 +0000 (09:25 +0530)]
board: sl28: add basic PSCI implementation

For now, this only provides reset and poweroff functions.

Signed-off-by: Michael Walle <michael@walle.cc>
[Rebased]
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agoarmv8: psci: add ARMV8_PSCI_RELOCATE Kconfig option
Michael Walle [Mon, 28 Feb 2022 12:48:40 +0000 (13:48 +0100)]
armv8: psci: add ARMV8_PSCI_RELOCATE Kconfig option

There is an user-selectable SYS_HAS_ARMV8_SECURE_BASE, which has the
same meaning but is just for the ls1043ardb board. As no in-tree config
uses this, drop it and replace it with something more sophiticated:
ARMV8_PSCI_RELOCATE. This option will then enable the ARMV8_SECURE_BASE
option which is used as the base to relocate the PSCI code (or any code
in the secure region, but that is only PSCI). A SoC (or board) can now
opt-in into having such a secure region by enabling
SYS_HAS_ARMV8_SECURE_BASE. Enable it for the LS1043A SoC, where it was
possible to relocate the PSCI code before as well as on the LS1028A SoC
where there will be PSCI support soon.

Additionally, make ARMV8_PSCI and SEC_FIRMWARE_ARMV8_PSCI exclusive.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agoarmv8: psci: skip setup code if we are not EL3
Michael Walle [Mon, 28 Feb 2022 12:48:39 +0000 (13:48 +0100)]
armv8: psci: skip setup code if we are not EL3

If we are running in EL2 skip PSCI implementation setup. This avoids an
exception if CONFIG_ARMV8_PSCI is set, but u-boot is started by TF-A.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agoarmv8: layerscape: get rid of smc_call()
Michael Walle [Fri, 22 Apr 2022 09:23:27 +0000 (14:53 +0530)]
armv8: layerscape: get rid of smc_call()

There are two different implementations to do a secure monitor call:
smc_call() and arm_smccc_smc(). The former is defined in fwcall.c and
seems to be an ad-hoc implementation. The latter is imported from linux.

smc_call() is also only available if CONFIG_ARMV8_PSCI is not defined.
This makes it impossible to have both PSCI calls and PSCI implementation
in one u-boot build. The layerscape SoC code decide at runtime via
check_psci() if there is a PSCI support. Therefore, this is a
prerequisite patch to add PSCI implementation support for the layerscape
SoCs.

Note, for the TFA part, this is only compile time tested with
(ls1028ardb_tfa_defconfig).

Signed-off-by: Michael Walle <michael@walle.cc>
[Rebased]
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agoarmv8: include psci_update_dt() unconditionally
Michael Walle [Mon, 28 Feb 2022 12:48:37 +0000 (13:48 +0100)]
armv8: include psci_update_dt() unconditionally

psci_update_dt() is also required if CONFIG_ARMV8_PSCI is set, that is,
if u-boot is the PSCI provider.
Guard the check which is intended to call into the PSCI implementation
in the secure firmware, by the proper macro SEC_FIRMWARE_ARMV8_PSCI.

Mark the function as weak because - unfortunately - there is already
a stub of the same function in arch/arm/mach-rmobile/psci-r8a779a0.c
which does not the same as the common one.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agoarm: layerscape: Disable erratum A009007 on LS1021A, LS1043A, and LS1046A
Sean Anderson [Fri, 22 Apr 2022 08:31:36 +0000 (14:01 +0530)]
arm: layerscape: Disable erratum A009007 on LS1021A, LS1043A, and LS1046A

This erratum is reported to cause problems on these processors [1-3].
The problem is usually with the clocking, which is supposed to be
configured by the RCW [4]. However, if it is not set, or if the default
clocking is not correct, then this erratum will cause an SError.
However, according to Ran Wang in [1]:
" ... this erratum is used to pass USB compliance test only, you could
 disable this workaround on your board if you don't any USB issue on
 normal use case, I think it's fine."

So just disable this erratum by default for these processors.

[1] https://lore.kernel.org/all/761ddd61-05c1-d9b8-ac90-b8f425afde6c@denx.de/
[2] https://community.nxp.com/t5/Layerscape/LS1046A-U-BOOT-HALT-AT-ERRATUM-A0090078/m-p/742993
[3] https://community.nxp.com/t5/QorIQ/Why-does-the-LS1043A-U-Boot-hang-at-code-that-fixes-erratum/m-p/644412
[4] https://source.codeaurora.org/external/qoriq/qoriq-components/rcw/tree/ls1046ardb/usb_phy_freq.rcw

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Acked-by: Ran Wang <ran.wang_1@nxp.com>
[Rebased]
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agodoc: boards: amlogic: update documentation for ADC support for AXG
Vyacheslav Bocharov [Tue, 26 Apr 2022 05:26:32 +0000 (08:26 +0300)]
doc: boards: amlogic: update documentation for ADC support for AXG

Signed-off-by: Vyacheslav Bocharov <adeep@lexina.in>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://lore.kernel.org/r/20220426052633.3027932-1-adeep@lexina.in
2 years agoARM: dts: at91: sama7g5ek: Align the impedance of the QSPI0's HSIO and PCB lines
Tudor Ambarus [Fri, 8 Apr 2022 09:10:36 +0000 (12:10 +0300)]
ARM: dts: at91: sama7g5ek: Align the impedance of the QSPI0's HSIO and PCB lines

The impedance of the QSPI PCB lines on the sama7g5ek is 50 Ohms.
Align the output impedance of the QSPI0 HSIOs by setting a medium drive
strength which corresponds to an impedance of 56 Ohms when VDD is in the
3.0V - 3.6V range. The high drive strength setting corresponds to an
output impedance of 42 Ohms on the QSPI0 HSIOs.
This is just a fine tunning. The memory that we have populated on sama7g5ek
works fine even with high drive strength, but it's better to adjust it and
use medium instead, in case some other flashes with higher frequencies are
tested.

Suggested-by: Mihai Sain <mihai.sain@microchip.com>
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
2 years agoARM: dts: at91: sama7g5: Fix QSPI1 clock
Tudor Ambarus [Fri, 8 Apr 2022 08:41:11 +0000 (11:41 +0300)]
ARM: dts: at91: sama7g5: Fix QSPI1 clock

QSPI1 used the clock of QSPI0, fix it.

Fixes: 5eecc37bb1 ("ARM: dts: at91: sama7g5: Add QSPI0 and OSPI1 nodes")
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
2 years agospi: atmel-quadspi: Fix the buswidth adjustment between spi-mem and controller
Tudor Ambarus [Fri, 8 Apr 2022 08:40:26 +0000 (11:40 +0300)]
spi: atmel-quadspi: Fix the buswidth adjustment between spi-mem and controller

Use the spi_mem_default_supports_op() core helper in order to take into
account the buswidth specified by the user in device tree.

Fixes: b6f2f084c6 ("spi: Add Atmel QuadSPI driver")
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
2 years agoinclude: configs: at91/sam: remove stray #ifdef/#else
Eugen Hristev [Thu, 7 Apr 2022 06:58:48 +0000 (09:58 +0300)]
include: configs: at91/sam: remove stray #ifdef/#else

With the commit that moves the BOOTCOMMAND to Kconfig:

d56fb937d7 ("Convert CONFIG_USE_BOOTCOMMAND et al to Kconfig")

some stray ifdefs have been left in the header files which
are now useless.
Clean up the include files to remove these lines.

Fixes: d56fb937d7 ("Convert CONFIG_USE_BOOTCOMMAND et al to Kconfig")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
2 years agoARM: dts: sam9x60: Add pit64b node
Durai Manickam KR [Mon, 4 Apr 2022 10:30:00 +0000 (16:00 +0530)]
ARM: dts: sam9x60: Add pit64b node

Add DT node for pit64b support.

Signed-off-by: Durai Manickam KR <durai.manickamkr@microchip.com>
2 years agotimers: atmel_pit: introduce CONFIG_SPL_ATMEL_PIT_TIMER
Eugen Hristev [Mon, 4 Apr 2022 08:35:51 +0000 (11:35 +0300)]
timers: atmel_pit: introduce CONFIG_SPL_ATMEL_PIT_TIMER

This commit allows the ATMEL_PIT_TIMER driver to be unselected in SPL and be
selected in u-boot proper. The SPL can use a different timer.
By having a separate Kconfig for ATMEL_TCB in SPL, the size of the SPL
decreases by 0.3 KBytes.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
2 years agotimers: atmel_tcb: introduce CONFIG_SPL_ATMEL_TCB
Eugen Hristev [Mon, 4 Apr 2022 08:35:50 +0000 (11:35 +0300)]
timers: atmel_tcb: introduce CONFIG_SPL_ATMEL_TCB

This commit allows the ATMEL_TCB driver to be unselected in SPL and be
selected in u-boot proper. The SPL can use a different timer.
By having a separate Kconfig for ATMEL_TCB in SPL, the size of the SPL
decreases by 1 KByte.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
2 years agoARM: mach-at91: armv7: Remove default reset driver
Sergiu Moga [Fri, 1 Apr 2022 09:27:27 +0000 (12:27 +0300)]
ARM: mach-at91: armv7: Remove default reset driver

This commit removes the default reset driver for armv7, since
it is no longer needed due to the presence of the SYSRESET driver.

Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
2 years agoARM: mach-at91: arm926ejs: Add SYSRESET conditional
Sergiu Moga [Fri, 1 Apr 2022 09:27:26 +0000 (12:27 +0300)]
ARM: mach-at91: arm926ejs: Add SYSRESET conditional

This commit adds a condition to the Makefile so that whenever the SYSRESET
option is chosen in the configuration, the default reset driver is ignored.

Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
2 years agoconfigs: at91: Enable SYSRESET for Atmel/Microchip's platforms
Sergiu Moga [Fri, 1 Apr 2022 09:27:25 +0000 (12:27 +0300)]
configs: at91: Enable SYSRESET for Atmel/Microchip's platforms

This commit enables SYSRESET in the defconfigs for the
Atmel/Microchip platforms.

Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
2 years agosysreset: Add Atmel/Microchip sysreset driver
Sergiu Moga [Fri, 1 Apr 2022 09:27:24 +0000 (12:27 +0300)]
sysreset: Add Atmel/Microchip sysreset driver

This patch adds a sysreset driver for Atmel/Microchip platforms.

Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
2 years agoARM: dts: at91: Add RSTC node
Sergiu Moga [Fri, 1 Apr 2022 09:27:23 +0000 (12:27 +0300)]
ARM: dts: at91: Add RSTC node

Add node for RSTC.

Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
2 years agoconfigs: Add sam9x60_curiosity_mmc_defconfig
Durai Manickam KR [Mon, 4 Apr 2022 05:53:20 +0000 (11:23 +0530)]
configs: Add sam9x60_curiosity_mmc_defconfig

Add boot from SDMMC (sdcard) support for sam9x60_curiosity.

Signed-off-by: Durai Manickam KR <durai.manickamkr@microchip.com>
2 years agoARM: dts: Add device tree files for sam9x60_curiosity
Durai Manickam KR [Mon, 4 Apr 2022 05:53:19 +0000 (11:23 +0530)]
ARM: dts: Add device tree files for sam9x60_curiosity

Add dts and dtsi files.

Signed-off-by: Durai Manickam KR <durai.manickamkr@microchip.com>
2 years agoboard: Add sam9x60_curiosity support
Durai Manickam KR [Mon, 4 Apr 2022 05:53:18 +0000 (11:23 +0530)]
board: Add sam9x60_curiosity support

Add board files, Kconfig, Makefile and MAINTAINERS.

Signed-off-by: Durai Manickam KR <durai.manickamkr@microchip.com>
2 years agoPrepare v2022.07-rc1
Tom Rini [Mon, 25 Apr 2022 23:26:07 +0000 (19:26 -0400)]
Prepare v2022.07-rc1

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoconfigs: Resync with savedefconfig
Tom Rini [Mon, 25 Apr 2022 22:53:54 +0000 (18:53 -0400)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agonds32: Remove the architecture
Tom Rini [Wed, 6 Apr 2022 13:21:25 +0000 (09:21 -0400)]
nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>
2 years agoMerge branch '2022-04-25-initial-implementation-of-stdboot'
Tom Rini [Mon, 25 Apr 2022 20:02:27 +0000 (16:02 -0400)]
Merge branch '2022-04-25-initial-implementation-of-stdboot'

To quote the author:
The bootflow feature provide a built-in way for U-Boot to automatically
boot an Operating System without custom scripting and other customisation.
This is called 'standard boot' since it provides a standard way for
U-Boot to boot a distro, without scripting.

It introduces the following concepts:

   - bootdev - a device which can hold a distro
   - bootmeth - a method to scan a bootdev to find bootflows (owned by
                U-Boot)
   - bootflow - a description of how to boot (owned by the distro)

This series provides an implementation of these, enabled to scan for
bootflows from MMC, USB and Ethernet. It supports the existing distro
boot as well as the EFI loader flow (bootefi/bootmgr). It works
similiarly to the existing script-based approach, but is native to
U-Boot.

With this we can boot on a Raspberry Pi 3 with just one command:

   bootflow scan -lb

which means to scan, listing (-l) each bootflow and trying to boot each
one (-b). The final patch shows this.

With a standard way to identify boot devices, booting become easier. It
also should be possible to support U-Boot scripts, for backwards
compatibility only.

...

The design is described in these two documents:

https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing

https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing

2 years agoMerge branch '2022-04-23-binman-updates'
Tom Rini [Mon, 25 Apr 2022 20:02:03 +0000 (16:02 -0400)]
Merge branch '2022-04-23-binman-updates'

- Assorted binman updates, and add Alper as a maintainer, after talking
  with Simon.

2 years agobinman: don't import deprecated distutils package
Heinrich Schuchardt [Sat, 9 Apr 2022 12:53:18 +0000 (14:53 +0200)]
binman: don't import deprecated distutils package

'make tests' fails on Ubuntu 22.04 with:

binman: ./tools/binman/binman:12: DeprecationWarning:
The distutils package is deprecated and slated for removal in Python 3.12.
Use setuptools or check PEP 632 for potential alternatives
  from distutils.sysconfig import get_python_lib
./tools/binman/binman:12: DeprecationWarning:
The distutils.sysconfig module is deprecated, use sysconfig instead
  from distutils.sysconfig import get_python_lib
<unittest.result.TestResult run=428 errors=0 failures=4>
AssertionError: 0 != 468

As we don't use Ubuntu 16.04 for our CI anymore drop the import.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2 years agoMAINTAINERS: Add Alper as a binman maintainer
Alper Nebi Yasak [Fri, 22 Apr 2022 15:25:47 +0000 (18:25 +0300)]
MAINTAINERS: Add Alper as a binman maintainer

I ended up learning most of binman internals while trying to add a few
features to it, and I recently started reviewing binman series that
would not affect me personally. I'll keep working on it and try to do
more reviews.

Add myself as a maintainer for binman.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Acked-by: Tom Rini <trini@konsulko.com>
2 years agobinman: Refuse to replace sections for now
Alper Nebi Yasak [Sun, 27 Mar 2022 15:31:50 +0000 (18:31 +0300)]
binman: Refuse to replace sections for now

Binman interfaces allow attempts to replace any entry in the image with
arbitrary data. When trying to replace sections, the changes in the
section entry's data are not propagated to its child entries. This,
combined with how sections rebuild their contents from its children,
eventually causes the replaced contents to be silently overwritten by
rebuilt contents equivalent to the original data.

Add a simple test for replacing a section that is currently failing due
to this behaviour, and mark it as an expected failure. Also, raise an
error when replacing a section instead of silently pretending it was
replaced.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Test replacing non-section entries in FIT subsections
Alper Nebi Yasak [Sun, 27 Mar 2022 15:31:49 +0000 (18:31 +0300)]
binman: Test replacing non-section entries in FIT subsections

A previous patch fixes binman to correctly extract FIT subentries. This
makes it easier to test replacing these entries as we can write tests
using an existing helper function that relies on extracting the replaced
entry.

Add tests that replace leaf entries in FIT subsections with data of
various sizes. Replacing the subsections or the whole FIT section does
not work yet due to the section contents being re-built from unreplaced
subentries' data.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Create FIT subentries in the FIT section, not its parent
Alper Nebi Yasak [Sun, 27 Mar 2022 15:31:48 +0000 (18:31 +0300)]
binman: Create FIT subentries in the FIT section, not its parent

When reading images from a file, each entry's data is read from its
parent section as specified in the Entry.Create() call that created it.
The FIT entry type has been creating its subentries under its parent
(their grandparent), as creating them under the FIT entry resulted in an
error until FIT was converted into a proper section.

FIT subentries have their offsets relative to the FIT section, and
reading those offsets in the parent section results in wrong data. The
subentries rightfully belong under the FIT entries, so create them
there. Add tests checking that we can extract the correct data for a FIT
entry and its subentries.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Remove '/images/' fragment from FIT subentry paths
Alper Nebi Yasak [Sun, 27 Mar 2022 15:31:47 +0000 (18:31 +0300)]
binman: Remove '/images/' fragment from FIT subentry paths

Binman FIT entry nodes describe their subentries in an 'images' subnode,
same as how they would be written for the mkimage executable. The entry
type initially manually managed its subentries keyed by their node paths
relative to its base node. It was later converted to a proper section
while still keeping the same keys for subentries.

These subentry keys of sections are used as path fragments, so they must
not contain the path separator character '/'. Otherwise, they won't be
addressable by binman extract/replace commands. Change these keys from
the '/images/foo' forms to the subentry node names. Extend the simple
FIT tests to check for this.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2 years agobinman: Don't reset offset/size if image doesn't allow repacking
Alper Nebi Yasak [Sun, 27 Mar 2022 15:31:46 +0000 (18:31 +0300)]
binman: Don't reset offset/size if image doesn't allow repacking

When an image has the 'allow-repack' property, binman includes the
original offset and size properties from the image description in the
fdtmap. These are later used as the packing constraints when replacing
entries in an image, so other unconstrained entries can be freely
positioned.

Replacing an entry in an image without 'allow-repack' (and therefore the
original offsets) follows the same logic and results in entries being
merely concatenated. Instead, skip resetting the calculated offsets and
sizes to the missing originals for these images so that every entry is
constrained to its existing offset/size.

Add tests that replace an entry with smaller or equal-sized data, in an
image that doesn't allow repacking. Attempting to do so with bigger-size
data is already an error that is already being tested.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Collect bintools for images when replacing entries
Alper Nebi Yasak [Sun, 27 Mar 2022 15:31:45 +0000 (18:31 +0300)]
binman: Collect bintools for images when replacing entries

Binman entries can use other executables to compute their data, usually
in their ObtainContents() methods. Subclasses of Entry_section would use
bintools in their BuildSectionData() method instead, which is called
from several places including their Pack().

These binary tools are resolved correctly while building an image from a
device-tree description so that they can be used from these methods.
However, this is not being done when replacing entries in an image,
which can result in an error as the Pack() methods attempt to use them.

Collect and resolve entries' bintools also when replacing entries to fix
Pack() errors. Add a way to mock bintool usage in the testing entry type
and tests that check bintools are being resolved for such an entry.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Fix unique names having '/.' for images read from files
Alper Nebi Yasak [Sun, 27 Mar 2022 15:31:44 +0000 (18:31 +0300)]
binman: Fix unique names having '/.' for images read from files

Binman can embed a copy of the image description into the images it
builds as a fdtmap entry, but it omits the /binman/<image-name> prefix
from the node paths while doing so. When reading an already-built image
file, entries are reconstructed using this fdtmap and their associated
nodes still lack that prefix.

Some entries like fit and vblock create intermediate files whose names
are based on an entry unique name. This name is constructed from their
node's path by concatenating the parents with dots up to the binman
node, e.g. /binman/image/foo/bar becomes 'image.foo.bar'.

However, we don't have this /binman/image prefix when replacing entries
in such an image. The /foo/bar entry we read when doing so erroneously
has the unique name of '/.foo.bar', causing permission errors when the
entry attempts to create files based on that.

Fix the unique-name generation by stopping at the '/' node like how it
stops at the binman node. As the unique names are used as filenames, add
tests that check if they're safe to use as filenames.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: doc: Add documentation
Simon Glass [Mon, 25 Apr 2022 05:31:26 +0000 (23:31 -0600)]
bootstd: doc: Add documentation

Add documentation for this feature, including the commands and full
devicetree bindings.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Provide a default command
Simon Glass [Mon, 25 Apr 2022 05:31:27 +0000 (23:31 -0600)]
bootstd: Provide a default command

We would like to use bootstd by default when EFI boot manager is not
enabled. But so far bootstd does not support all the of distro-boot
fetures. So for now, add an option to select this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Add setup for the bootflow tests
Simon Glass [Mon, 25 Apr 2022 05:31:25 +0000 (23:31 -0600)]
bootstd: Add setup for the bootflow tests

We need to create a disk image with a partition table and a DOS-format
filesystem containing a few files. Provide a fallback binary for CI since
it does not seem able to detect the loopback partitions.

Add this to a dm_init test so that it happens when needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Add tests for bootstd including all uclasses
Simon Glass [Mon, 25 Apr 2022 05:31:24 +0000 (23:31 -0600)]
bootstd: Add tests for bootstd including all uclasses

Add a set of combined tests for the bootdev, bootflow and bootmeth
commands, along with associated functionality.

Expand the sandbox console-recording limit so that these can work.

These tests rely on a filesystem script which is not yet added to the
Python tests. It is included here as a shell script.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: usb: Add a bootdev driver
Simon Glass [Mon, 25 Apr 2022 05:31:23 +0000 (23:31 -0600)]
bootstd: usb: Add a bootdev driver

Add a bootdev driver for USB host. It can use the distro boot mechanism to
locate a file, or any other available bootmeth.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Add an implementation of script boot
Simon Glass [Mon, 25 Apr 2022 05:31:22 +0000 (23:31 -0600)]
bootstd: Add an implementation of script boot

Add a bootmeth driver which handles distro boot from a disk via a U-Boot
script, so we can boot a bootflow using this commonly used mechanism. This
is required by Armbian, for example.

Signed-off-by: Simon Glass <sjg@chromium.org>