]> git.baikalelectronics.ru Git - uboot.git/log
uboot.git
2 years agoefi_loader: bootmgr: add booting from removable media
AKASHI Takahiro [Thu, 28 Apr 2022 08:09:39 +0000 (17:09 +0900)]
efi_loader: bootmgr: add booting from removable media

Under the current implementation, booting from removable media using
a architecture-specific default image name, say BOOTAA64.EFI, is
supported only in distro_bootcmd script. See the commit 74522c898b35
("efi_loader: Add distro boot script for removable media").

This is, however, half-baked implementation because
1) UEFI specification requires this feature to be implemented as part
   of Boot Manager's responsibility:

  3 - Boot Manager
  3.5.1 Boot via the Simple File Protocol
  When booting via the EFI_SIMPLE_FILE_SYSTEM_PROTOCOL, the FilePath will
  start with a device path that points to the device that implements the
  EFI_SIMPLE_FILE_SYSTEM_PROTOCOL or the EFI_BLOCK_IO_PROTOCOL. The next
  part of the FilePath may point to the file name, including
  subdirectories, which contain the bootable image. If the file name is
  a null device path, the file name must be generated from the rules
  defined below.
  ...
  3.5.1.1 Removable Media Boot Behavior
  To generate a file name when none is present in the FilePath, the
  firmware must append a default file name in the form
  \EFI\BOOT\BOOT{machine type short-name}.EFI ...

2) So (1) entails the hehavior that the user's preference of boot media
   order should be determined by Boot#### and BootOrder variables.

With this patch, the semantics mentioned above is fully implemented.
For example, if you want to boot the system from USB and SCSI in this
order,
* define Boot0001 which contains only a device path to the USB device
  (without any file path/name)
* define Boot0002 which contains only a device path to the SCSI device,
and
* set BootOrder to Boot0001:Boot0002

To avoid build error for sandbox, default file name "BOOTSANDBOX.efi"
is defined even if it is out of scope of UEFI specification.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
On sandbox use binary name corresponding to host architecture.
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoefi_loader: export efi_locate_device_handle()
AKASHI Takahiro [Thu, 28 Apr 2022 08:09:38 +0000 (17:09 +0900)]
efi_loader: export efi_locate_device_handle()

This function will be used in the next commit where some behavior
of EFI boot manager will be expanded.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agomenu: menu_get_choice() return -ENOENT if menu item is empty
Masahisa Kojima [Thu, 28 Apr 2022 08:09:37 +0000 (17:09 +0900)]
menu: menu_get_choice() return -ENOENT if menu item is empty

menu_get_choice() needs to handle the case that menu item
is empty. In this case, menu_get_choice() returns -ENOENT.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agomenu: always show the menu regardless of the number of entry
Masahisa Kojima [Thu, 28 Apr 2022 08:09:36 +0000 (17:09 +0900)]
menu: always show the menu regardless of the number of entry

To make user aware of the menu entry selection, menu always
appears regardless of the number of entry.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Adjust test/py/tests/test_bootmenu.py
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agotest: unit test for u16_strlcat()
Masahisa Kojima [Thu, 28 Apr 2022 08:09:35 +0000 (17:09 +0900)]
test: unit test for u16_strlcat()

Provide a unit test for function u16_strlcat().

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agolib/charset: add u16_strlcat() function
Masahisa Kojima [Thu, 28 Apr 2022 08:09:34 +0000 (17:09 +0900)]
lib/charset: add u16_strlcat() function

Provide u16 string version of strlcat().

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agolib: fix selection of CONFIG_CHARSET
Heinrich Schuchardt [Mon, 2 May 2022 04:27:00 +0000 (06:27 +0200)]
lib: fix selection of CONFIG_CHARSET

lib/charset.c is not optional for
EFI_APP || EFI_LOADER || UFS || UT_UNICODE.
These must select CONFIG_CHARSET.

Fixes: d13805e26a1b ("efi: Make unicode printf available to the app")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoefi_selftest: error handling in efi_selftest_tcg2
Heinrich Schuchardt [Sun, 1 May 2022 09:34:15 +0000 (11:34 +0200)]
efi_selftest: error handling in efi_selftest_tcg2

If memory allocation fails, write an error message.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoefi_selftest: clean up unaligned unit test
Heinrich Schuchardt [Sun, 1 May 2022 09:24:22 +0000 (11:24 +0200)]
efi_selftest: clean up unaligned unit test

* fix typo %s/give/given/
* don't use void * in pointer arithmetic

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoefi_selftest: buildefi_selftest_unaligned.c
Heinrich Schuchardt [Sun, 1 May 2022 09:18:03 +0000 (11:18 +0200)]
efi_selftest: buildefi_selftest_unaligned.c

The unit test has not been built since CPU_V7 was rename CPU_V7A.

Fixes: e2d486f28403 ("arm: v7: Kconfig: Rename CPU_V7 as CPU_V7A")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agotest: fix some pylint problems in test_capsule_firmware_raw.py
Heinrich Schuchardt [Sat, 30 Apr 2022 13:24:31 +0000 (15:24 +0200)]
test: fix some pylint problems in test_capsule_firmware_raw.py

* improve doc-string formatting
* remove unused imports

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoefi_loader: reset colors before clearing screen
Heinrich Schuchardt [Sat, 30 Apr 2022 07:05:04 +0000 (09:05 +0200)]
efi_loader: reset colors before clearing screen

When resetting the text console the colors have to be set before clearing
the screen. Otherwise the background color may be wrong.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agodoc: fix typos in bootmenu.rst
Heinrich Schuchardt [Fri, 29 Apr 2022 20:01:54 +0000 (22:01 +0200)]
doc: fix typos in bootmenu.rst

%s/cammand/command/
%s/sequencies/sequences/

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agocmd: simplify bootmenu
Heinrich Schuchardt [Sun, 1 May 2022 21:17:18 +0000 (23:17 +0200)]
cmd: simplify bootmenu

* correct output for timeout > 99 s
* don't use spaces to advance to the output column

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agotest: unit test for bootmenu
Heinrich Schuchardt [Sat, 30 Apr 2022 09:13:55 +0000 (11:13 +0200)]
test: unit test for bootmenu

Provide a unit test for the bootmenu command

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agosandbox: enable bootmenu command
Heinrich Schuchardt [Sat, 30 Apr 2022 05:42:38 +0000 (07:42 +0200)]
sandbox: enable bootmenu command

Provide the bootmenu command on the sandbox for testing.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoCI: Azure: Rework how we update MSYS2
Tom Rini [Tue, 3 May 2022 12:30:14 +0000 (08:30 -0400)]
CI: Azure: Rework how we update MSYS2

Based on reading https://www.msys2.org/docs/ci/ and "Other Systems"
rework how we update MSYS2 to the current version.  We run it once, to
perform nothing other than being the first run, then we run pacman
twice.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoMerge branch '2022-05-02-add-verifying-program-loader'
Tom Rini [Mon, 2 May 2022 23:02:44 +0000 (19:02 -0400)]
Merge branch '2022-05-02-add-verifying-program-loader'

To quote the author:

U-Boot provides a verified-boot feature based around FIT, but there is
no standard way of implementing it for a board. At present the various
required pieces must be built up separately, to produce a working
implementation. In particular, there is no built-in support for selecting
A/B boot or recovery mode.

This series introduces VPL, a verified program loader phase for U-Boot.
Its purpose is to run the verified-boot process and decide which SPL
binary should be run. It is critical that this decision happens before
SPL runs, since SPL sets up SDRAM and we need to be able to update the
SDRAM-init code in the field.

Adding VPL into the boot flow provides a standard place to implement
verified boot. This series includes the phase itself, some useful Kconfig
options and a sandbox_vpl build for sandbox. No verfied-boot support is
provided in this series.

Most of the patches in this series are fixes and improvements to docs and
various Kconfig conditions for SPL.

2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Mon, 2 May 2022 23:00:42 +0000 (19:00 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- Misc turris_omnia/mox related Fixes and impovements (Pali)
- Turris Omnia: Add support for configuring mSATA and WWAN slots
  via env variables (Pali)
- net: mvgbe: Set PHY page 0 before phy_connect (Tony)
- kirkwood: nsa310s: Use Marvell uclass mvgbe and PHY driver (Tony)
- mvebu: turris_omnia: Fix SYS_RSTOUT_* macro names (Pali)
- mvebu: clearfog_defconfig: enable setexpr command (Josef)
- mvebu: x530: set MPP55 to gpio (Chris)

2 years agoCI: Run VPL tests
Simon Glass [Sat, 30 Apr 2022 06:56:57 +0000 (00:56 -0600)]
CI: Run VPL tests

Add tests for VPL into the mix. For now this just runs the help test and
a few SPL ones.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agovpl: Test that VPL runs correctly through to U-Boot proper
Simon Glass [Sat, 30 Apr 2022 06:56:56 +0000 (00:56 -0600)]
vpl: Test that VPL runs correctly through to U-Boot proper

Check the TPL -> VPL -> SPL -> U-Boot path by running the 'help' command
in U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agovpl: Support running vpl tests
Simon Glass [Sat, 30 Apr 2022 06:56:55 +0000 (00:56 -0600)]
vpl: Support running vpl tests

Add support for these to the pytest system.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agosandbox: Add a build for VPL
Simon Glass [Sat, 30 Apr 2022 06:56:54 +0000 (00:56 -0600)]
sandbox: Add a build for VPL

Add an initial VPL build for sandbox. This includes the flow:

   TPL (with of-platdata) -> VPL -> SPL -> U-Boot

To run it:

   ./tpl/u-boot-tpl -D

The -D is needed to get the default device tree, which includes the serial
console info.

Add a Makefile check for OF_HOSTFILE which is the option that enables
devicetree control on sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agovpl: Add Kconfig options for VPL
Simon Glass [Sat, 30 Apr 2022 06:56:53 +0000 (00:56 -0600)]
vpl: Add Kconfig options for VPL

Add VPL versions of commonly used Kconfig options.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoIntroduce Verifying Program Loader (VPL)
Simon Glass [Sat, 30 Apr 2022 06:56:52 +0000 (00:56 -0600)]
Introduce Verifying Program Loader (VPL)

Add support for VPL, a new phase of U-Boot. This runs after TPL. It is
responsible for selecting which SPL binary to run, based on a
verified-boot process.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoMakefile: Tidy up the TPL build rules
Simon Glass [Sat, 30 Apr 2022 06:56:51 +0000 (00:56 -0600)]
Makefile: Tidy up the TPL build rules

These should follow the same pattern as SPL, for consistency. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoMakefile: Simplify devicetree rules for SPL/TPL
Simon Glass [Sat, 30 Apr 2022 06:56:50 +0000 (00:56 -0600)]
Makefile: Simplify devicetree rules for SPL/TPL

The current logic checks several options to decide whether SPL/TPL need
the U-Boot devicetree to be built. In fact we can check OF_CONTROL, which
is enabled in all cases that matter.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoavb: Don't build in SPL
Simon Glass [Sat, 30 Apr 2022 06:56:49 +0000 (00:56 -0600)]
avb: Don't build in SPL

This feature is not used in SPL at present. Update the Makefile to avoid
it being built.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobloblist: Correct Kconfig dependencies
Simon Glass [Sat, 30 Apr 2022 06:56:48 +0000 (00:56 -0600)]
bloblist: Correct Kconfig dependencies

This feature is not available in SPL unless common/ and lib/ are built.
Update the Kconfig to avoid build errors.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agotest: Tidy up test building with SPL
Simon Glass [Sat, 30 Apr 2022 06:56:47 +0000 (00:56 -0600)]
test: Tidy up test building with SPL

We can in principle add tests to any SPL build, e.g. TPL or VPL. Update
the build rules to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agodoc: Expand SPL docs to explain the phase and config
Simon Glass [Sat, 30 Apr 2022 06:56:46 +0000 (00:56 -0600)]
doc: Expand SPL docs to explain the phase and config

Add a bit more information about how to use SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agodoc: Convert SPL documentation to ReST
Simon Glass [Sat, 30 Apr 2022 06:56:45 +0000 (00:56 -0600)]
doc: Convert SPL documentation to ReST

Move this documentation over to .rst format.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoARM: mvebu: x530: set MPP55 to gpio
Chris Packham [Mon, 2 May 2022 03:16:25 +0000 (15:16 +1200)]
ARM: mvebu: x530: set MPP55 to gpio

MPP55 is used as a reset connected to the L3 switch chip. This doesn't
matter for u-boot as it doesn't use the L3 switch but it is useful to
be able to toggle the switch in/out of reset for the OS.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: clearfog_defconfig: enable setexpr command
Josef Schlehofer [Fri, 29 Apr 2022 15:49:14 +0000 (17:49 +0200)]
arm: mvebu: clearfog_defconfig: enable setexpr command

This command is useful in U-boot scripts and it is being used by
OpenWrt bootscript for this board [1]. Otherwise shell scripting
commands are enabled by default in cmd/Kconfig.

[1] https://github.com/openwrt/openwrt/blob/852126680e21edc71c0c66561ae5a6d7479dcc67/target/linux/mvebu/image/clearfog.bootscript#L7

[2] https://source.denx.de/u-boot/u-boot/-/blob/80d188e1b18edb9ee57ac1d2f3440fc25dc0a3b0/cmd/Kconfig#L1504

Fixes: 0299c90f396c5b2971a4bac596339f4b03661c27 ("arm: mvebu: Add
SolidRun ClearFog Armada 38x initial support")

Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: turris_omnia: Fix SYS_RSTOUT_* macro names
Pali Rohár [Fri, 29 Apr 2022 11:53:25 +0000 (13:53 +0200)]
arm: mvebu: turris_omnia: Fix SYS_RSTOUT_* macro names

This is A385 register.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: kirkwood: nsa310s: Use Marvell uclass mvgbe and PHY driver for DM Ethernet
Tony Dinh [Sun, 17 Apr 2022 20:42:42 +0000 (13:42 -0700)]
arm: kirkwood: nsa310s: Use Marvell uclass mvgbe and PHY driver for DM Ethernet

The Zyxel NSA310s board has the network chip Marvell Alaska 88E1318S.
Use uclass mvgbe and the compatible driver M88E1310 driver to bring
up Ethernet.

- Use uclass mvgbe to bring up the network. And remove ad-hoc code.
- Remove CONFIG_RESET_PHY_R.
- Enable CONFIG_PHY_MARVELL to properly configure the network.
- Add phy mode RGMII to kirkwood-nsa310s.dts
- Miscellaneous changes: Move constants to .c file and remove header file
board/zyxel/nsa310s/nsa310s.h, add support for large USB and SATA HDDs,
use BIT macro, add/cleanup comments, and cosmetic changes.

Note that this patch is depended on the following patch:
https://patchwork.ozlabs.org/project/uboot/patch/20220412201820.10291-1-mibodhi@gmail.com/

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
2 years agonet: marvell: mvgbe: Set PHY page 0 before phy_connect
Tony Dinh [Tue, 12 Apr 2022 20:18:19 +0000 (13:18 -0700)]
net: marvell: mvgbe: Set PHY page 0 before phy_connect

For most Kirkwood boards, the PHY page is already set to page 0
(in register 22) before phy_connect is invoked. But some board like
the Zyxel NSA310S (which uses the network chip MV88E1318S), the PHY page
is not set to page 0. There seems to be some bad data remained in
register 22 when the uclass MVGBE about to invoke phy_connect().

This patch enables the uclass MVGBE to always set the PHY page to 0
before phy_connect.

For reference, please see this discussion:
[RFC PATCH v2] arm: kirkwood: nsa310s: Use Marvell uclass mvgbe
and PHY driver for DM Ethernet.
https://lists.denx.de/pipermail/u-boot/2022-April/480946.html

This patch has been tested with the following Kirkwood boards:

NSA310S (88F6702, network chip MV88E1318S)
Sheevaplug (88F6281, network chip MV88E1318)
Pogo V4 (88F6192, network chip 88E1116R)
GF Home(88F6281, network chip 88E1116R)
Dreamplug (88F6281, network chip MV88E1318)
Dell Kace M300 (88F6282, network chip MV88E1318) - out of tree u-boot

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
2 years agoarm: mvebu: turris_mox: Add NVMe and SCSI to boot targets
Pali Rohár [Wed, 6 Apr 2022 09:39:36 +0000 (11:39 +0200)]
arm: mvebu: turris_mox: Add NVMe and SCSI to boot targets

U-Boot for Turris Mox has already enabled NVMe and SCSI support. So add
NVMe and SCSI to boot targets.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoarm: mvebu: turris_omnia: Add NVMe to boot targets
Pali Rohár [Wed, 6 Apr 2022 09:39:35 +0000 (11:39 +0200)]
arm: mvebu: turris_omnia: Add NVMe to boot targets

U-Boot for Turris Omnia has already enabled NVMe support. So add NVMe to
boot targets.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoarm: mvebu: turris_omnia: Always enable MMC, SCSI and USB boot targets
Pali Rohár [Wed, 6 Apr 2022 09:39:34 +0000 (11:39 +0200)]
arm: mvebu: turris_omnia: Always enable MMC, SCSI and USB boot targets

U-Boot for Turris Omnia is always compiled with MMC, SCSI and USB support,
so always enable macros for booting from these devices.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoarm: mvebu: turris_omnia: Define CONFIG_ETHPRIME instead of ethact= ENV
Pali Rohár [Wed, 6 Apr 2022 09:39:33 +0000 (11:39 +0200)]
arm: mvebu: turris_omnia: Define CONFIG_ETHPRIME instead of ethact= ENV

CONFIG_ETHPRIME defines primary ethernet device and env variable $ethact
stores currently active ethernet device.

So there is no point to set ethact= in default environment. Instead set
CONFIG_ETHPRIME properly.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
2 years agoarm: mvebu: turris_omnia: Fix RESET button message
Pali Rohár [Wed, 6 Apr 2022 09:39:32 +0000 (11:39 +0200)]
arm: mvebu: turris_omnia: Fix RESET button message

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
2 years agoarm: mvebu: turris_omnia: Add support for USB3.0 mode in WWAN MiniPCIe slot
Pali Rohár [Wed, 2 Mar 2022 11:47:58 +0000 (12:47 +0100)]
arm: mvebu: turris_omnia: Add support for USB3.0 mode in WWAN MiniPCIe slot

PCIe Mini CEM 2.1 spec added support for USB3.0 mode on MiniPCIe cards.
USB3.0 and PCIe share same pins and only one function can be active at the
same time. PCIe Mini CEM 2.1 spec says that determining function is
platform specific and spec does not define any dedicated pin which could
say if card is USB3.0-based or PCIe-based.

Implement this platform specific decision (USB3.0 vs PCIe) for WWAN
MiniPCIe slot on Turris Omnia via U-Boot env variable "omnia_wwan_slot",
similarly like is implemented forced mode for MiniPCIe/mSATA slot via
"omnia_msata_slot" env variable. Value "usb3" for "omnia_wwan_slot" would
mean to set USB3.0 mode and value "pcie" original PCIe mode.

A385 SoC on Turris Omnia has configurable fifth SerDes line (exported to
MiniPCIe WWAN slot with SIM card) either to USB3.0 or PCIe functionality,
so implementation of this new PCIe Mini CEM 2.1 feature is simple, by just
configuring SerDes to USB 3.0 mode.

Other twos MiniPCIe slots on Turris Omnia do not have this new
functionality as their SerDes lines cannot be switched to USB3.0
functionality.

Note that A385 SoC does not have too many USB3.0 blocks, so activating
USB3.0 in MiniPCIe cause that one external USB3.0 USB-A port would loose
USB3.0 functionality and would be downgraded just to USB2.0.

By default this MiniPCIe WWAN slot is in PCIe mode, like before.

To set this MiniPCIe WWAN slot to USB3.0 mode, call U-Boot commands:

  => setenv omnia_wwan_slot usb3
  => saveenv
  => reset

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoarm: mvebu: turris_omnia: Signal error when sata/pcie DT mode
Pali Rohár [Wed, 2 Mar 2022 11:47:57 +0000 (12:47 +0100)]
arm: mvebu: turris_omnia: Signal error when sata/pcie DT mode

Show error message when DT file does not contain sata or pcie node which
should be explicitly disabled. This can happen when U-Boot code for finding
those nodes is incomplete or when those DT nodes are in different
unexpected location. In any case it is needed to know if DT not was not
explicitly disabled as it could mean that combo slots where setup
incorrectly.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoarm: mvebu: turris_omnia: Extract code for disabling sata/pcie
Pali Rohár [Wed, 2 Mar 2022 11:47:56 +0000 (12:47 +0100)]
arm: mvebu: turris_omnia: Extract code for disabling sata/pcie

Move code for disabling sata and pcie DT nodes to own functions, so this
code can be called from other places in follow up patches.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoarm: mvebu: turris_omnia: Allow to configure mSATA slot via env variable
Pali Rohár [Wed, 2 Mar 2022 11:47:55 +0000 (12:47 +0100)]
arm: mvebu: turris_omnia: Allow to configure mSATA slot via env variable

Some PCIe-based MiniPCIe cards are broken and they do not ground PIN 43
which is required by PCIe mini CEM specs. Such broken cards are incorrectly
detected as mSATA cards because SATA specs requires that PIN 43 on mSATA
cards has to be disconnected.

PIN 43 on Turris Omnia is used only for MiniPCIe/mSATA card detection by
software in U-Boot SPL. Allow to override that U-Boot SPL detection by a
new "omnia_msata_slot" env variable (to value "pcie" or "sata") so broken
MiniPCIe cards can be used in combo mSATA/MiniPCIe slot too.

As configuration of PCIe vs SATA functionality is done in U-Boot SPL,
it is required to change env variable in permanent storage and reset the
board to take effect.

To force PCIe mode for broken MiniPCIe cards, call U-Boot commands:

  => setenv omnia_msata_slot pcie
  => saveenv
  => reset

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoarm: mvebu: turris_omnia: Define only one serdes map variable
Pali Rohár [Wed, 2 Mar 2022 11:47:54 +0000 (12:47 +0100)]
arm: mvebu: turris_omnia: Define only one serdes map variable

By default use primary serdes map with PCIe function in combined
miniPCIe/mSATA slot. When SATA is detected change serdes map variable at
runtime.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoarm: mvebu: turris_omnia: Enable ENV support in SPL
Pali Rohár [Wed, 2 Mar 2022 11:47:53 +0000 (12:47 +0100)]
arm: mvebu: turris_omnia: Enable ENV support in SPL

Allow to read ENV variables also in SPL on Turris Omnia.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoarm: mvebu: turris_omnia: Provide env_sf_get_env_addr() function
Pali Rohár [Wed, 2 Mar 2022 11:47:52 +0000 (12:47 +0100)]
arm: mvebu: turris_omnia: Provide env_sf_get_env_addr() function

BootROM maps SPI Flash to fixed address 0xD4000000 and this mapping is
active also when BootROM is executing binary kwbimage headers, which
includes also U-Boot SPL.

Therefore no initialization code is required to access SPI Flags from
U-Boot SPL. In proper U-Boot it is remapped to other location.

So in mvebu implementation of env_sf_get_env_addr() function returns
0xD4000000 when running in SPL and NULL when in proper U-Boot.

This change would allow to use U-Boot ENV in U-Boot SPL. Normally it is not
possible to read ENV because it is too big and U-Boot SPL does not have
such big malloc() pool to real all ENV variables.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
2 years agoenv: sf: Allow to use env_sf_init_addr() at any stage
Pali Rohár [Wed, 2 Mar 2022 11:47:51 +0000 (12:47 +0100)]
env: sf: Allow to use env_sf_init_addr() at any stage

In some cases it makes sense to use env_sf_init_addr() also in SPL mode.
Allow it for boards by providing custom implementation of weak function
env_sf_get_env_addr(). When this function returns NULL it signals that
address is invalid, like config option CONFIG_ENV_ADDR.

There is no change in default behavior or in config options.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoMerge tag 'efi-2022-07-rc2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Fri, 29 Apr 2022 18:04:08 +0000 (14:04 -0400)]
Merge tag 'efi-2022-07-rc2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2022-07-rc2

UEFI:

* fix UEFI booting after integration of UEFI sub-system with driver model
* avoid random return values from devpath_is_partition()
* minor code clean ups

2 years agoMerge branch '2022-04-29-fuzzing-and-asan-fixes'
Tom Rini [Fri, 29 Apr 2022 15:25:06 +0000 (11:25 -0400)]
Merge branch '2022-04-29-fuzzing-and-asan-fixes'

To quote the author:

I've been experimenting with ASAN on sandbox and turned up a few issues
that are fixed in this series.

Basic ASAN was easy to turn on, but integrating with dlmalloc was
messier and fairly intrusive. Even when I had it working, there was only
a small redzone between allocations which limits the usefulness.

I saw another series on the list by Sean Anderson to enable valgrind
which was finding a different set of issues, though there was one
overlap that Sean is fixing with
"[PATCH] IOMUX: Fix access past end of console_devices".

With these issues fixed, I was able to run the dm tests without any ASAN
issues. There are a couple of leaks reported at the end, but that's for
another day.

2 years agotest: dm: devres: Remove use-after-free
Andrew Scull [Sun, 3 Apr 2022 10:39:15 +0000 (10:39 +0000)]
test: dm: devres: Remove use-after-free

Use-after-free shouldn't be used, even in tests. It's bad practice and
makes the test brittle.

Signed-off-by: Andrew Scull <ascull@google.com>
Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agotest: Fix pointer overrun in dm_test_devm_regmap()
Andrew Scull [Sun, 3 Apr 2022 10:39:14 +0000 (10:39 +0000)]
test: Fix pointer overrun in dm_test_devm_regmap()

This tests calls regmap_read() which takes a uint pointer as an output
parameter. The test was passing a pointer to a u16 which resulted in an
overflow when the output was written. Fix this by following the
regmap_read() API and passing a uint pointer instead.

Signed-off-by: Andrew Scull <ascull@google.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Jean-Jacques Hiblot <jjhiblot@ti.com>
Cc: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agosound: Fix buffer overflow in square wave generation
Andrew Scull [Sun, 3 Apr 2022 10:39:13 +0000 (10:39 +0000)]
sound: Fix buffer overflow in square wave generation

Data is written for each channel but is only tracked as having one
channel written. This resulted in a buffer overflow and corruption of
the allocator's metadata which caused further problems when the buffer
was later freed. This could be observed with sandbox unit tests.

Resolve the overflow by tracking the writes for each channel.

Fixes: a57465b7aa ("dm: sound: Use the correct number of channels for sound")
Signed-off-by: Andrew Scull <ascull@google.com>
Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agousb: sandbox: Bounds check read from buffer
Andrew Scull [Sun, 3 Apr 2022 10:39:12 +0000 (10:39 +0000)]
usb: sandbox: Bounds check read from buffer

The buffer is 512 bytes but read requests can be 800 bytes. Limit the
request to the size of the buffer.

Signed-off-by: Andrew Scull <ascull@google.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Marek Vasut <marex@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agousb: sandbox: Check for string end in copy_to_unicode()
Andrew Scull [Sun, 3 Apr 2022 10:39:11 +0000 (10:39 +0000)]
usb: sandbox: Check for string end in copy_to_unicode()

When copying the string in copy_to_unicode(), check for the null
terminator in each position, not just at the start, to avoid reading
beyond the end of the string.

Signed-off-by: Andrew Scull <ascull@google.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Marek Vasut <marex@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agox86: sandbox: Add missing PCI bar to barinfo
Andrew Scull [Sun, 3 Apr 2022 10:39:10 +0000 (10:39 +0000)]
x86: sandbox: Add missing PCI bar to barinfo

There are expecte to be bars 0 through 5, but the last of these was
missing leading to an read beyond the buffer. Add the missing element
with zero values.

Signed-off-by: Andrew Scull <ascull@google.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoacpi: Fix buffer overflow in do_acpi_dump()
Andrew Scull [Sun, 3 Apr 2022 10:39:09 +0000 (10:39 +0000)]
acpi: Fix buffer overflow in do_acpi_dump()

When do_acpi_dump() converts the table name to upper case, pass the
actual size of the output buffer so that the null terminator doesn't get
written beyond the end of the buffer.

Signed-off-by: Andrew Scull <ascull@google.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agodoc: Correct position of gdb '--args' parameter
Andrew Scull [Sun, 3 Apr 2022 10:39:08 +0000 (10:39 +0000)]
doc: Correct position of gdb '--args' parameter

The '--args' parameter to gdb comes before the binary that the debugger
will be attached to rather than after the binary and before the
arguments. Fix that in the docs.

Signed-off-by: Andrew Scull <ascull@google.com>
Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
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 branch '2022-04-28-led-updates'
Tom Rini [Thu, 28 Apr 2022 17:46:31 +0000 (13:46 -0400)]
Merge branch '2022-04-28-led-updates'

- DM GPIO bugfix
- LED related code clean-ups
- Fix some of the DM/LED tests
- Update the LED dt binding doc

2 years agodt-bindings: leds: import common led bindings from linux 5.17
Pali Rohár [Thu, 28 Apr 2022 11:26:53 +0000 (13:26 +0200)]
dt-bindings: leds: import common led bindings from linux 5.17

This allows usage of LED_COLOR_ID_RGB macro in DTS files.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agotest: dm: pinmux: Get LED2 udevice in the pinmux test
Marek Vasut [Mon, 25 Apr 2022 16:33:51 +0000 (18:33 +0200)]
test: dm: pinmux: Get LED2 udevice in the pinmux test

The UT reinitializes the pin controller state, get LED2 udevice
to trigger its probe and configure the pin controller pin state
as it is expected by the test.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Cc: Sean Anderson <seanga2@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Steven Lawrance <steven.lawrance@softathome.com>
2 years agotest: dm: led: Fix LED enumeration
Marek Vasut [Mon, 25 Apr 2022 16:33:50 +0000 (18:33 +0200)]
test: dm: led: Fix LED enumeration

The GPIO LED driver no longer considers the top level node an LED,
because it is not an LED. With this bug fixed, the LED enumeration
has changed. Update the test accordingly.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Cc: Sean Anderson <seanga2@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Steven Lawrance <steven.lawrance@softathome.com>
2 years agoled: Drop led_default_state()
Marek Vasut [Fri, 22 Apr 2022 13:41:42 +0000 (15:41 +0200)]
led: Drop led_default_state()

This function is empty, drop it.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Cc: Sean Anderson <seanga2@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Steven Lawrance <steven.lawrance@softathome.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoled: gpio: Use NOP uclass driver for top-level node
Marek Vasut [Fri, 22 Apr 2022 13:34:00 +0000 (15:34 +0200)]
led: gpio: Use NOP uclass driver for top-level node

The top level DT node of gpio-leds is not a LED itself, bind NOP uclass
driver to it, and bind different LED uclass driver to its subnodes which
represent the actual LEDs. This simplifies the probe() implementation
and fixes the bogus top-level not-an-LED in 'led list' command output:

```
=> led list
led             Error -121 <--- This is removed/fixed by this patch
green:user0     off
```

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Cc: Sean Anderson <seanga2@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Steven Lawrance <steven.lawrance@softathome.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Tested-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoled: gpio: Check device compatible string to determine the top level node
Marek Vasut [Fri, 22 Apr 2022 13:15:55 +0000 (15:15 +0200)]
led: gpio: Check device compatible string to determine the top level node

Since 87d0e5d4c05 ("led: gpio: Drop duplicate OF "label" property parsing"),
all LED nodes have some sort of label. Use device_is_compatible(..."leds-gpio")
to determine whether this is a top-level node, since it is only the top
level node which is compatible with "leds-gpio", the GPIO LEDs subnodes
are not.

Fixes: 87d0e5d4c05 ("led: gpio: Drop duplicate OF "label" property parsing")
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Cc: Sean Anderson <seanga2@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Steven Lawrance <steven.lawrance@softathome.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Tested-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agoled: Mark device instance with DM_FLAG_PROBE_AFTER_BIND
Marek Vasut [Fri, 22 Apr 2022 13:15:54 +0000 (15:15 +0200)]
led: Mark device instance with DM_FLAG_PROBE_AFTER_BIND

Calling device_probe() from uclass .post_bind() callback has all kinds
of odd side-effects, e.g. device instances not being available just yet.
Make use of the DM_FLAG_PROBE_AFTER_BIND instead, mark device instances
which need to be probe()d in order to configure the LED default state
with this flag and let the DM core do the device_probe() at the right
time instead.

Fixes: ea638e48365 ("led: Configure LED default-state on boot")
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Cc: Sean Anderson <seanga2@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Steven Lawrance <steven.lawrance@softathome.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Tested-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agodm: core: Add DM_FLAG_PROBE_AFTER_BIND flag
Marek Vasut [Fri, 22 Apr 2022 13:15:53 +0000 (15:15 +0200)]
dm: core: Add DM_FLAG_PROBE_AFTER_BIND flag

Introduce DM_FLAG_PROBE_AFTER_BIND flag, which can be set by driver or
uclass in .bind(), to indicate such driver instance should be probe()d
once binding of all devices is complete.

This is useful in case the driver determines that hardware initialization
is mandatory on boot, and such initialization happens only in probe().
This also solves the inability to call device_probe() from .bind().

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Cc: Sean Anderson <seanga2@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Steven Lawrance <steven.lawrance@softathome.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Tested-by: Patrice Chotard <patrice.chotard@foss.st.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>