]> git.baikalelectronics.ru Git - uboot.git/log
uboot.git
2 years agopci: mvebu: Ensure that root port is always on root zero bus
Pali Rohár [Tue, 15 Feb 2022 10:34:01 +0000 (11:34 +0100)]
pci: mvebu: Ensure that root port is always on root zero bus

Writing to the PCI_PRIMARY_BUS register of the root port should not change
bus number on which is root port present.

Same change and exactly same fix as was done in commit for pci-aardvark.c.

Fixes: 18e57fe33755 ("pci: pci_mvebu: Properly configure and use PCI Bridge (PCIe Root Port)")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: a37xx: pci: Update comment about Command/Direct mode
Pali Rohár [Tue, 15 Feb 2022 10:23:37 +0000 (11:23 +0100)]
arm: a37xx: pci: Update comment about Command/Direct mode

Code is changing PCIe controller from Command mode to Direct mode.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: a37xx: pci: Register controller also when no PCIe card is connected
Pali Rohár [Tue, 15 Feb 2022 10:23:36 +0000 (11:23 +0100)]
arm: a37xx: pci: Register controller also when no PCIe card is connected

Allow access to config space of PCIe Root Port (which is always present on
the root bus) even when PCIe link is down or no card is connected.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: a37xx: pci: Do not try to access other buses when link is down
Pali Rohár [Tue, 15 Feb 2022 10:23:35 +0000 (11:23 +0100)]
arm: a37xx: pci: Do not try to access other buses when link is down

If a PIO request is executed while link-down, the whole controller gets
stuck in a non-functional state, and even after link comes up again, PIO
requests won't work anymore, and a reset of the whole PCIe controller is
needed. Therefore we need to prevent sending PIO requests while the link
is down.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: a37xx: Update DTS files to version from upstream Linux kernel
Pali Rohár [Mon, 14 Feb 2022 10:34:30 +0000 (11:34 +0100)]
arm: a37xx: Update DTS files to version from upstream Linux kernel

This change updates all Armada 37xx DTS files to version which is used by
Linux kernel v5.18.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: a37xx: espressobin: Explicitly enable eMMC node in -u-boot.dtsi
Pali Rohár [Mon, 14 Feb 2022 10:34:29 +0000 (11:34 +0100)]
arm: a37xx: espressobin: Explicitly enable eMMC node in -u-boot.dtsi

Official DT bindings for Espressobin have disabled eMMC node.

As U-Boot requires to have this node enabled by default, do it in
armada-3720-espressobin-u-boot.dtsi DTS file.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: a37xx: espressobin: Move U-Boot specific partitions node to -u-boot.dtsi
Pali Rohár [Mon, 14 Feb 2022 10:34:28 +0000 (11:34 +0100)]
arm: a37xx: espressobin: Move U-Boot specific partitions node to -u-boot.dtsi

U-Boot specific changes should be in armada-3720-espressobin-u-boot.dtsi DTS file.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: a37xx: Update sdhci pointers to official DT bindings
Pali Rohár [Mon, 14 Feb 2022 10:34:27 +0000 (11:34 +0100)]
arm: a37xx: Update sdhci pointers to official DT bindings

In Linux kernel version of armada-37xx.dtsi file sdhci1 pointer refers to
sdhci@d0000 node and sdhci0 pointer to sdhci@d8000 node.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: turris_mox: Remove hardcoded ethernet node names
Pali Rohár [Mon, 14 Feb 2022 10:34:26 +0000 (11:34 +0100)]
arm: mvebu: turris_mox: Remove hardcoded ethernet node names

Armada 3720 DTS files in upstream kernel use ethernet nodes named
'ethernet@30000' and 'ethernet@40000'. U-Boot have them named 'neta@30000'
and 'neta@40000'. To have Turris Mox U-Boot board code independent of
ethernet node names, find ethernet node via alias.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agowatchdog: armada_37xx: Convert to official DT bindings
Pali Rohár [Mon, 14 Feb 2022 10:34:25 +0000 (11:34 +0100)]
watchdog: armada_37xx: Convert to official DT bindings

Official DT bindings have only one reg property: watchdog address space.
Convert armada-37xx-wdt.c driver to offical DT bindings and access sel_reg
register via MVEBU_REGISTER() macro, as its value (required by U-Boot
driver) is not in DT yet. In later stage can be driver cleaned to not use
it.

This change would allow U-Boot to use A3720 watchdog DTS structure from
Linux kernel.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agousb: ehci: ehci-marvell: Update compatible string to official DT bindings
Pali Rohár [Mon, 14 Feb 2022 10:34:24 +0000 (11:34 +0100)]
usb: ehci: ehci-marvell: Update compatible string to official DT bindings

Official DT bindings use compatible string marvell,armada-3700-ehci.
Update drivers and DTS files.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agophy: marvell: a3700: Update compatible string to official DT bindings
Pali Rohár [Mon, 14 Feb 2022 10:34:23 +0000 (11:34 +0100)]
phy: marvell: a3700: Update compatible string to official DT bindings

In commit a207eda7ead0 ("phy: marvell: a3700: Convert to official DT
bindings in COMPHY driver") was done update to official DT bindings but
compatible string of official DT bindings was not updated.

Fix it now.

Fixes: a207eda7ead0 ("phy: marvell: a3700: Convert to official DT bindings in COMPHY driver")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agortc: ds1307: Add bindings for microchip, mcp7940x
Pali Rohár [Mon, 14 Feb 2022 10:34:22 +0000 (11:34 +0100)]
rtc: ds1307: Add bindings for microchip, mcp7940x

Compatible string microchip,mcp7940x is used by Turris Mox DTS file in
Linux kernel and U-Boot ds1307.c driver works fine with it.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwbimage: Fix dumping DATA registers for v0 images
Pali Rohár [Sun, 13 Feb 2022 00:04:33 +0000 (01:04 +0100)]
tools: kwbimage: Fix dumping DATA registers for v0 images

End of DATA register section is indicated by zero value in both raddr and
rdata.

So do not stop dumping registers with non-zero address and zero value.
And also print end of DATA registers section.

Fixes: 7a800b3de2da ("tools: kwbimage: Dump kwbimage config file on '-p -1' option")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reported-by: Tony Dinh <mibodhi@gmail.com>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: a37xx: pci: Ensure that root port is always on root zero bus
Pali Rohár [Thu, 10 Feb 2022 13:53:45 +0000 (14:53 +0100)]
arm: a37xx: pci: Ensure that root port is always on root zero bus

Writing to the PCI_PRIMARY_BUS register of the root port should not change
bus number on which is root port present.

This PCI_PRIMARY_BUS register is used only for correct configuration of
legacy PCI stuff, like forwarding of PCI special cycles between buses.

Aardvark HW does not support PCI special cycles, so it does not have HW
register for PCI_PRIMARY_BUS and therefore it does not matter what is
stored in this register.

So fix this issue and do not use PCI_PRIMARY_BUS register in pci-aardvark.c
driver for moving root bus of the root port.

After this change there is no reason for storing bus number (zero) into
first_busno variable, so remove this variable.

Signed-off-by: Pali Rohár <pali@kernel.org>
Fixes: 7b758b439474 ("arm: a37xx: pci: Add support for accessing PCI Bridge on root bus")
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: a37xx: pci: Use dev_read_addr()
Pali Rohár [Thu, 10 Feb 2022 13:53:44 +0000 (14:53 +0100)]
arm: a37xx: pci: Use dev_read_addr()

There is only one base address, so use dev_read_addr() instead of dev_read_addr_index().

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: a37xx: pci: Cleanup macro names
Pali Rohár [Thu, 10 Feb 2022 13:53:43 +0000 (14:53 +0100)]
arm: a37xx: pci: Cleanup macro names

Remove "PCI_" prefix from all macros which are aardvark specific to not
conflict with macros defined in global include file pci.h. Instead add
"ADVK_" prefix for them so it is visible that they are aardvark specific.

After "ADVK_" prefix append keyword which describes register group, so it
would be clear to which register each macro value belongs.

Rename some macros for consistency with other macros.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: a37xx: pci: Use standard register macros from pci.h
Pali Rohár [Thu, 10 Feb 2022 13:53:42 +0000 (14:53 +0100)]
arm: a37xx: pci: Use standard register macros from pci.h

PCI config space of the aardvark PCIe Root Port is available only in
internal aardvark memory space starting at offset 0x0. PCI Express
registers (PCI_EXP_*) start at offset 0xc0. And Advanced Error Reporting
registers (PCI_ERR_*) start at offset 0x100.

Replace custom aardvark register macros by standard PCI macros from
include/pci.h file with fixed offset.

Some DEVCTL and AER macros are not defined in include/pci.h file, so define
them in the same way as in linux uapi header file pci_regs.h.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoconfigs: Resync with savedefconfig
Tom Rini [Mon, 14 Feb 2022 22:21:29 +0000 (22:21 +0000)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoPrepare v2022.04-rc2
Tom Rini [Mon, 14 Feb 2022 22:03:08 +0000 (17:03 -0500)]
Prepare v2022.04-rc2

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoMerge branch '2022-02-14-assorted-fixes'
Tom Rini [Mon, 14 Feb 2022 19:18:45 +0000 (14:18 -0500)]
Merge branch '2022-02-14-assorted-fixes'

- Fix for pstore already being in the DT, "setlocalversion" script
  bugfix and pdu001 platform bugfix

2 years agoarm: pdu001: Fix dt to work with the current am33xx dtsi files
Felix Brack [Tue, 8 Feb 2022 10:38:39 +0000 (11:38 +0100)]
arm: pdu001: Fix dt to work with the current am33xx dtsi files

The changes introduced with commit dc8b3f89e640 ("arm: dts: sync am33xx
with Linux 5.9-rc7") prevent the PDU001 from operating correctly.
This patch fixes the configuration of the pin multiplexer and uart3.

Signed-off-by: Felix Brack <fb@ltec.ch>
2 years agoscripts: setlocalversion: remove quotes around localversion from config
Nikita Maslov [Thu, 13 Jan 2022 21:13:39 +0000 (00:13 +0300)]
scripts: setlocalversion: remove quotes around localversion from config

After replacing of include/config/auto.conf sourcing with
extraction of CONFIG_LOCALVERSION, resulting version string
contains quotes around localversion part which are always
present in auto.conf (even if localversion is empty).

This patch fixes this script to remove quotes.

Signed-off-by: Nikita Maslov <wkernelteam@gmail.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agopstore: Support already existing reserved-memory node
Detlev Casanova [Mon, 7 Feb 2022 16:02:30 +0000 (11:02 -0500)]
pstore: Support already existing reserved-memory node

The pstore command tries to create a reserved-memory node but fails if
it is already present with:

    Add 'reserved-memory' node failed: FDT_ERR_EXISTS

This patch creates the node only if it does not exist and adapts the reg
values sizes depending on already present #address-cells and #size-cells
values.

Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
2 years agoMerge tag 'efi-2022-04-rc2-4' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Fri, 11 Feb 2022 20:07:49 +0000 (15:07 -0500)]
Merge tag 'efi-2022-04-rc2-4' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2022-04-rc2-4

Documentation:

* mkeficapsule man-page

UEFI changes:

* add support for signing images to mkeficapsule
* add support for user define capsule GUID
* adjust unit tests for capsules
* fix UEFI image signature validation in case of multiple signatures

2 years agotest/py: efi_secboot: adjust secure boot tests to code changes
Ilias Apalodimas [Fri, 11 Feb 2022 07:37:50 +0000 (09:37 +0200)]
test/py: efi_secboot: adjust secure boot tests to code changes

The previous patch is changing U-Boot's behavior wrt certificate based
binary authentication.  Specifically an image who's digest of a
certificate is found in dbx is now rejected.  Fix the test accordingly
and add another one testing signatures in reverse order

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agoefi_loader: fix dual signed image certification
Ilias Apalodimas [Fri, 11 Feb 2022 07:37:49 +0000 (09:37 +0200)]
efi_loader: fix dual signed image certification

The EFI spec allows for images to carry multiple signatures. Currently
we don't adhere to the verification process for such images.

The spec says:
"Multiple signatures are allowed to exist in the binary's certificate
table (as per PE/COFF Section "Attribute Certificate Table"). Only one
hash or signature is required to be present in db in order to pass
validation, so long as neither the SHA-256 hash of the binary nor any
present signature is reflected in dbx."

With our current implementation signing the image with two certificates
and inserting both of them in db and one of them dbx doesn't always reject
the image.  The rejection depends on the order that the image was signed
and the order the certificates are read (and checked) in db.

While at it move the sha256 hash verification outside the signature
checking loop, since it only needs to run once per image and get simplify
the logic for authenticating an unsigned imahe using sha256 hashes.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agotest/py: efi_capsule: check the results in case of CAPSULE_AUTHENTICATE
AKASHI Takahiro [Wed, 9 Feb 2022 10:10:42 +0000 (19:10 +0900)]
test/py: efi_capsule: check the results in case of CAPSULE_AUTHENTICATE

Before the capsule authentication is supported, this test script works
correctly, but with the feature enabled, most tests will fail due to
unsigned capsules.
So check the results depending on CAPSULE_AUTHENTICATE or not.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agotest/py: efi_capsule: add a test for "--guid" option
AKASHI Takahiro [Wed, 9 Feb 2022 10:10:41 +0000 (19:10 +0900)]
test/py: efi_capsule: add a test for "--guid" option

This test scenario tests a new feature of mkeficapsule, "--guid" option,
which allows us to specify FMP driver's guid explicitly at the command
line.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2 years agotest/py: efi_capsule: align with the syntax change of mkeficapsule
AKASHI Takahiro [Wed, 9 Feb 2022 10:10:40 +0000 (19:10 +0900)]
test/py: efi_capsule: align with the syntax change of mkeficapsule

Since the syntax of mkeficapsule was changed in the previous commit,
we need to modify command line arguments in a pytest script.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agotools: mkeficapsule: allow for specifying GUID explicitly
AKASHI Takahiro [Wed, 9 Feb 2022 10:10:39 +0000 (19:10 +0900)]
tools: mkeficapsule: allow for specifying GUID explicitly

The existing options, "--fit" and "--raw," are only used to put a proper
GUID in a capsule header, where GUID identifies a particular FMP (Firmware
Management Protocol) driver which then would handle the firmware binary in
a capsule. In fact, mkeficapsule does the exact same job in creating
a capsule file whatever the firmware binary type is.

To prepare for the future extension, the command syntax will be a bit
modified to allow users to specify arbitrary GUID for their own FMP driver.
OLD:
   [--fit <image> | --raw <image>] <capsule file>
NEW:
   [--fit | --raw | --guid <guid-string>] <image> <capsule file>

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agotest/py: efi_capsule: add image authentication test
AKASHI Takahiro [Wed, 9 Feb 2022 10:10:38 +0000 (19:10 +0900)]
test/py: efi_capsule: add image authentication test

Add a couple of test cases against capsule image authentication
for capsule-on-disk, where only a signed capsule file with the verified
signature will be applied to the system.

Due to the difficulty of embedding a public key (esl file) in U-Boot
binary during pytest setup time, all the keys/certificates are pre-created.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agodoc: update UEFI document for usage of mkeficapsule
AKASHI Takahiro [Wed, 9 Feb 2022 10:10:37 +0000 (19:10 +0900)]
doc: update UEFI document for usage of mkeficapsule

Now we can use mkeficapsule command instead of EDK-II's script
to create a signed capsule file. So update the instruction for
capsule authentication.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agotools: mkeficapsule: add man page
AKASHI Takahiro [Wed, 9 Feb 2022 10:10:36 +0000 (19:10 +0900)]
tools: mkeficapsule: add man page

Add a man page for mkeficapsule command.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agotools: mkeficapsule: add firmware image signing
AKASHI Takahiro [Wed, 9 Feb 2022 10:10:35 +0000 (19:10 +0900)]
tools: mkeficapsule: add firmware image signing

With this enhancement, mkeficapsule will be able to sign a capsule
file when it is created. A signature added will be used later
in the verification at FMP's SetImage() call.

To do that, we need specify additional command parameters:
  -monotonic-cout <count> : monotonic count
  -private-key <private key file> : private key file
  -certificate <certificate file> : certificate file
Only when all of those parameters are given, a signature will be added
to a capsule file.

Users are expected to maintain and increment the monotonic count at
every time of the update for each firmware image.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agotools: build mkeficapsule with tools-only_defconfig
AKASHI Takahiro [Wed, 9 Feb 2022 10:10:34 +0000 (19:10 +0900)]
tools: build mkeficapsule with tools-only_defconfig

Add CONFIG_TOOLS_MKEFICAPSULE. Then we want to always build mkeficapsule
if tools-only_defconfig is used.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoCI: enforce packages upgrade for Msys2 on Windows
AKASHI Takahiro [Wed, 9 Feb 2022 08:24:23 +0000 (17:24 +0900)]
CI: enforce packages upgrade for Msys2 on Windows

We need to install libgnutls-devel package to build the host tool,
mkeficapsule, and as of now, there seems to be a depencency conflict
in the current msys2 installer;

   :: installing libp11-kit (0.24.1-1) breaks dependency \
'libp11-kit=0.23.22' required by p11-kit

To resolve this conflict, however, the initial "pacman -Syyuu" in
'tools_only_windows' job is not enough. Another "pacman -Su" will
enforce all the out-of-date packages being upgraded.
(Probably the first "-Syyuu" can be changed to "-Syu".)

See the installation steps in
  https://www.msys2.org/

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2 years agoMerge branch '2022-02-11-assorted-updates-and-fixes'
Tom Rini [Fri, 11 Feb 2022 17:02:31 +0000 (12:02 -0500)]
Merge branch '2022-02-11-assorted-updates-and-fixes'

A partial list:
- fw_env updates, a new testcase for mkimage -o ..., nop-phy reset-gpios
  support, DFU updates, kaslr-seed support in extlinux.conf, modern
  "partitions" support in mtd device tree

2 years agotest: test field truncation in snprint()
Heinrich Schuchardt [Sat, 29 Jan 2022 15:33:16 +0000 (16:33 +0100)]
test: test field truncation in snprint()

The output size for snprint() should not only be respected for whole fields
but also with fields. Add more tests.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agophy: nop-phy: Enable reset-gpios support
Adam Ford [Sat, 29 Jan 2022 13:27:47 +0000 (07:27 -0600)]
phy: nop-phy: Enable reset-gpios support

Some usb-nop-xceiv devices use a gpio take them out
of reset.  Add a reset function to put them into that
state.  This is similar to how Linux handles the
usb-nop-xceiv driver.

Signed-off-by: Adam Ford <aford173@gmail.com>
2 years agofw_env: simplify logic & code paths in the fw_env_open()
Rafał Miłecki [Wed, 12 Jan 2022 11:47:06 +0000 (12:47 +0100)]
fw_env: simplify logic & code paths in the fw_env_open()

Environment variables can be stored in two formats:
1. Single entry with header containing CRC32
2. Two entries with extra flags field in each entry header

For that reason fw_env_open() has two main code paths and there are
pointers for CRC32/flags/data.

Previous implementation was a bit hard to follow:
1. It was checking for used format twice (in reversed order each time)
2. It was setting "environment" global struct fields to some temporary
   values that required extra comments explaining it

This change simplifies that code:
1. It introduces two clear code paths
2. It sets "environment" global struct fields values only once it really
   knows them

To be fair there are *two* crc32() calls now and an extra pointer
variable but that should be cheap enough and worth it.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2 years agofw_env: make flash_io() take buffer as an argument
Rafał Miłecki [Wed, 12 Jan 2022 11:47:05 +0000 (12:47 +0100)]
fw_env: make flash_io() take buffer as an argument

It's usually easier to understand code & follow it if all arguments are
passed explicitly. Many coding styles also discourage using global
variables.

Behaviour of flash_io() was a bit unintuitive as it was writing to a
buffer referenced in a global struct. That required developers to
remember how it works and sometimes required hacking "environment"
global struct variable to read data into a proper buffer.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2 years agoacpi: Move acpi_write_tables() to a generic header
Simon Glass [Sat, 29 Jan 2022 21:30:52 +0000 (14:30 -0700)]
acpi: Move acpi_write_tables() to a generic header

This function is used by both x86 and sandbox. Put it in a common header
file.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agocmd/dfu: Enable 'dfu list' command without DFU_OVER_USB
Masami Hiramatsu [Mon, 31 Jan 2022 02:52:54 +0000 (11:52 +0900)]
cmd/dfu: Enable 'dfu list' command without DFU_OVER_USB

Since dfu is not only used for USB, and some platform only
supports DFU_OVER_TFTP or EFI capsule update, dfu_alt_info
is defined on such platforms too.

For such platform, 'dfu list' command is useful to check
how the current dfu_alt_info setting is parsed.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
2 years agodoc: usage: DFU: Fix dfu_alt_info document
Masami Hiramatsu [Mon, 31 Jan 2022 02:52:46 +0000 (11:52 +0900)]
doc: usage: DFU: Fix dfu_alt_info document

Fix some typo and wrong information about dfu_alt_info.
- Add the parameter format, decimal only or hexadecimal.
- Use same parameter name for the same kind of parameters.
  (e.g. dev -> dev_id)

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
2 years agoDFU: Check the number of arguments and argument string strictly
Masami Hiramatsu [Mon, 31 Jan 2022 02:52:37 +0000 (11:52 +0900)]
DFU: Check the number of arguments and argument string strictly

When parsing the dfu_alt_info, check the number of arguments
and argument string strictly. If there is any garbage data
(which is not able to be parsed correctly) in dfu_alt_info,
that means something wrong and user may make a typo or mis-
understanding about the syntax. Since the dfu_alt_info is
used for updating the firmware, this mistake may lead to
brick the hardware.
Thus it should be checked strictly for making sure there
is no mistake.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
2 years agoDFU: Accept redundant spaces and tabs in dfu_alt_info
Masami Hiramatsu [Mon, 31 Jan 2022 02:52:29 +0000 (11:52 +0900)]
DFU: Accept redundant spaces and tabs in dfu_alt_info

If dfu_alt_info has repeated spaces or tab (for indentation or
readability), the dfu fails to parse it. For example, if
dfu_alt_info="mtd nor1=image raw  100000 200000" (double spaces
after "raw"), the image entity start address is '0' and the size
'0x100000'. This is because the repeated space is not skipped.

Use space and tab as a separater and apply skip_spaces() to
skip redundant spaces and tabs.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
2 years agoDFU: Do not copy the entity name over the buffer size
Masami Hiramatsu [Mon, 31 Jan 2022 02:52:20 +0000 (11:52 +0900)]
DFU: Do not copy the entity name over the buffer size

Use strlcpy() instead of strcpy() to prevent copying the
entity name over the name buffer size.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
2 years agomkimage: Improve documentation of algo-name parameter
Jan Kiszka [Sat, 5 Feb 2022 12:19:36 +0000 (13:19 +0100)]
mkimage: Improve documentation of algo-name parameter

Addresses the feedback provided on b4caf5ac4b39 ("mkimage: Allow to
specify the signature algorithm on the command line") which raced with
the merge.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoReplace echo -n's used in environment processing with touch
qthedev [Sat, 5 Feb 2022 10:25:16 +0000 (10:25 +0000)]
Replace echo -n's used in environment processing with touch

echo -n does not give the intended effect when invoked in macOS through
/bin/sh, which is the shell make uses by default, see
"https://stackoverflow.com/questions/11675070/makefile-echo-n-not-working"
for a detailed explanation. In this case, it resulted in "-n" being
written to env.txt and env.in even though they should be empty, which
caused compilation to fail with "Your board uses a text-file
environment, so must not define CONFIG_EXTRA_ENV_SETTINGS".

This patch prevents the error by replacing echo -n's with touch, as they
are used to create empty files in these cases.

2 years agocmd: wrong printf() code in do_test_stackprot_fail()
Heinrich Schuchardt [Fri, 4 Feb 2022 09:50:04 +0000 (10:50 +0100)]
cmd: wrong printf() code in do_test_stackprot_fail()

strlen() returns size_t. So we should use %zu to print it.
This avoids incorrect output on 32bit systems.

Fixes: c8af457df342 ("stackprot: Make our test a bit more complex")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agotest/py: Add test case for mkimage -o argument
Jan Kiszka [Thu, 3 Feb 2022 20:43:50 +0000 (21:43 +0100)]
test/py: Add test case for mkimage -o argument

Stress the '-o algo_name' argument of mkimage by expanding the vboot
test.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
[trini: Update scripts/pylint.base]

2 years agomalloc_simple: Remove usage of unsupported %zx format string
Pali Rohár [Thu, 3 Feb 2022 18:51:37 +0000 (19:51 +0100)]
malloc_simple: Remove usage of unsupported %zx format string

Replace %zx by %lx and cast size_t to ulong.

U-Boot currently prints garbage debug output:
size=x, ptr=18, limit=18: 4002a000

With this change it prints correct debug data:
size=18, ptr=18, limit=2000: 4002a000

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agocommon: fdt_support: add support for "partitions" subnode to fdt_fixup_mtdparts()
Matthias Schiffer [Thu, 3 Feb 2022 14:14:47 +0000 (15:14 +0100)]
common: fdt_support: add support for "partitions" subnode to fdt_fixup_mtdparts()

Listing MTD partitions directly in the flash mode has been deprecated
for a while for kernel Device Trees. Look for a node "partitions" in the
found flash nodes and use it instead of the flash node itself for the
partition list when it exists, so Device Trees following the current
best practices can be fixed up.

Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobutton: adc: set state to pressed when the voltage is closest to nominal
Peter Cai [Wed, 2 Feb 2022 18:04:04 +0000 (13:04 -0500)]
button: adc: set state to pressed when the voltage is closest to nominal

In the Linux implementation of adc-keys
(drivers/input/keyboard/adc-keys.c), `press-threshold-microvolt` is not
really interpreted as a threshold, but rather as the "nominal voltage"
of the button. When the voltage read from the ADC is closest to a
button's `press-threshold-microvolt`, the button is considered pressed.

This patch reconciles the behavior of button-adc with Linux's adc-keys
such that device trees can be synchronized with minimal modifications.

Signed-off-by: Peter Cai <peter@typeblog.net>
2 years agocmd: pxe_utils: sysboot: add kaslr-seed generation support
Zhang Ning [Tue, 1 Feb 2022 00:33:37 +0000 (08:33 +0800)]
cmd: pxe_utils: sysboot: add kaslr-seed generation support

this will add kaslrseed keyword to sysboot lable,
when it set, it will request to genarate random number
from hwrng as kaslr-seed.

with this patch exlinux.conf label looks like

label l0
        menu testing
        linux /boot/vmlinuz-5.15.16-arm
        initrd /boot/initramfs-5.15.16-arm.img
        fdtdir /boot/dtbs/5.15.16-arm/
        kaslrseed
        append root=UUID=92ae1e50-eeeb-4c5b-8939-7e1cd6cfb059 ro

Tested on Khadas VIM with kernel 5.16.0-rc5-arm64, Debian 11.

Signed-off-by: Zhang Ning <zhangn1985@qq.com>
2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Fri, 11 Feb 2022 12:22:30 +0000 (07:22 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-usb

2 years agousb: gadget: ci: Avoid null pointer dereference
Marek Vasut [Fri, 28 Jan 2022 03:39:09 +0000 (04:39 +0100)]
usb: gadget: ci: Avoid null pointer dereference

The ci_req->hw_buf can be NULL, test whether it is and if so,
avoid accessing it. Else, the system may crash.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Peter Chen <peter.chen@nxp.com>
Cc: Li Jun <jun.li@nxp.com>
Cc: Peng Fan <peng.fan@nxp.com>
2 years agoconsole: usb: kbd: Limit poll frequency to improve performance
Thomas Watson [Thu, 10 Feb 2022 21:13:14 +0000 (15:13 -0600)]
console: usb: kbd: Limit poll frequency to improve performance

Using the XHCI driver, the function `usb_kbd_poll_for_event` takes
30-40ms to run. The exact time is dependent on the polling interval the
keyboard requests in its descriptor, and likely cannot be significantly
reduced without major rework to the XHCI driver.

The U-Boot EFI console service sets a timer to poll the keyboard every 5
microseconds, and this timer is checked every time a block is read off
disk. The net effect is that, on my system, loading a ~40MiB kernel and
initrd takes about 62 seconds with a slower keyboard and 53 seconds
with a faster one, with the vast majority of the time spent polling the
keyboard.

To solve this problem, this patch adds a 20ms delay between consecutive
calls to `usb_kbd_poll_for_event`. This is sufficient to reduce the
total loading time to under half a second for both keyboards, and does
not impact the perceived keystroke latency.

Signed-off-by: Thomas Watson <twatson52@icloud.com>
2 years agousb: ehci-mx6: Enable OTG detection on imx8mm and imx8mn
Adam Ford [Thu, 3 Feb 2022 21:20:11 +0000 (15:20 -0600)]
usb: ehci-mx6: Enable OTG detection on imx8mm and imx8mn

The imx8mm and imx8mn appear compatible with imx7d-usb
flags in the OTG driver.  If the dr_mode is defined as
host or peripheral, the device appears to operate correctly,
however the auto host/peripheral detection results in an error.

The solution isn't just adding checks for imx8mm and imx8mn to
the check for imx7, because the USB clock needs to be running
to read from the USBNC_PHY_STATUS_OFFSET register or it will hang.

Marek requested that I not enable the clocks in ehci_usb_of_to_plat,
so I modified that function to return an unknown state if the
device tree does not explicitly state whether it is a host
or a peripheral.

When the driver probes, it looks to see if it's in the unknown
state, and only then will it read the register to auto-detect.

Signed-off-by: Adam Ford <aford173@gmail.com>
Tested-by: Tim Harvey <tharvey@gateworks.com>
2 years agoMerge branch '2022-02-10-platform-updates'
Tom Rini [Thu, 10 Feb 2022 22:38:04 +0000 (17:38 -0500)]
Merge branch '2022-02-10-platform-updates'

- Assorted Apple M1 platform updates
- Drop CONFIG_SYS_RESET_ADDR, update k3-am64-sk memory values in dts

2 years agoarm:dts:k3-am64-sk: EMIF tool update to 0.8.0 with 1333MTs for lpddr4
Sinthu Raja [Mon, 29 Nov 2021 12:04:49 +0000 (17:34 +0530)]
arm:dts:k3-am64-sk: EMIF tool update to 0.8.0 with 1333MTs for lpddr4

EMIF tool for AM64 SK is now updated to 0.8.0 that includes
* disabled Write DQ training
* improve CA ODT to 60 ohms

The lpddr4 enabled with periodic WDQ training is causing periodic 26us
stall. This makes the SoC stall without doing anything which leads to
R5 interrupt latency in TCM memory. Due to this periodic training there
are some outstanding CPU transactions waiting for the lpddr4 to complete.

Hence, disable the periodic write DQ training during the
non-initialization stage of lpddr4 which results in an approximate 1us
stall. Also, update the lpddr4 config to improve CA ODT by 60 ohms

The rationales are as follows:
- PI_WDQLVL_EN: 2 Bits register field to support write DQ leveling,
  disable bit 1 that supports Write DQ during non-initialization to
  avoid ~26us stall during code execution.

- MR11_DATA_F1/F2_x register fields value changed to 0x66 that changes
  the CA ODT from 48ohm to 60ohm to improve the eye margin on CA bus by
  increasing the signal swing.

Signed-off-by: James Doublesin <doublesin@ti.com>
Signed-off-by: Sinthu Raja <sinthu.raja@ti.com>
2 years agoapple: Fix debug uart clock rate
Mark Kettenis [Sun, 6 Feb 2022 12:21:14 +0000 (13:21 +0100)]
apple: Fix debug uart clock rate

The clock rate for the serial console on Apple M1 systems is 24 MHz
instead of 240 kHz.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
2 years agocommon: drop CONFIG_SYS_RESET_ADDR
Ovidiu Panait [Mon, 31 Jan 2022 07:20:22 +0000 (09:20 +0200)]
common: drop CONFIG_SYS_RESET_ADDR

There are no boards that define CONFIG_SYS_RESET_ADDR, so drop the
remaining comments referencing it and also the config_whitelist.txt entry.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Acked-by: thomas@wytron.com.tw
2 years agopowerpc: mpc8xx: drop CONFIG_SYS_RESET_ADDRESS
Ovidiu Panait [Mon, 31 Jan 2022 07:20:21 +0000 (09:20 +0200)]
powerpc: mpc8xx: drop CONFIG_SYS_RESET_ADDRESS

There are no boards that define CONFIG_SYS_RESET_ADDRESS, so drop the
associated mpc8xx code that checks for it.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Acked-by: Christophe Leroy <christophe.leroy@csgroup.eu>
2 years agoinput: apple: Add support for Apple SPI keyboard
Mark Kettenis [Sun, 23 Jan 2022 15:48:13 +0000 (16:48 +0100)]
input: apple: Add support for Apple SPI keyboard

This driver adds support for the keyboard on Apple Silicon laptops.
The controller for this keyboard sits on an SPI bus and uses an
Apple-specific HID over SPI protocol. The packets sent by this
controller for key presses and key releases are fairly simple and
are decoded directly by the code in this driver and converted into
standard Linux keycodes. The same controller handles the touchpad
found on these laptops.  Packets for touchpad events are simply
ignored.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested on: Macbook Air M1
Tested-by: Simon Glass <sjg@chromium.org>
2 years agospi: apple: Add driver for Apple SPI controller
Mark Kettenis [Sun, 23 Jan 2022 15:48:12 +0000 (16:48 +0100)]
spi: apple: Add driver for Apple SPI controller

Add a driver for the SPI controller integrated on Apple SoCs.
This is necessary to support the keyboard on Apple Silicon laopts
since their keyboard uses an Apple-specific HID over SPI protocol.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested on: Macbook Air M1
Tested-by: Simon Glass <sjg@chromium.org>
2 years agoconfigs: apple: Add NVMe boot target
Mark Kettenis [Sat, 22 Jan 2022 19:38:19 +0000 (20:38 +0100)]
configs: apple: Add NVMe boot target

Add a boot target for NVMe such that we can boot from NVMe.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
2 years agonvme: apple: Add driver for Apple NVMe storage controller
Mark Kettenis [Sat, 22 Jan 2022 19:38:18 +0000 (20:38 +0100)]
nvme: apple: Add driver for Apple NVMe storage controller

Add a driver for the NVMe storage controller integrated on
Apple SoCs.  This NVMe controller isn't PCI based and deviates
from the NVMe standard in its implementation of the command
submission queue and the integration of an NVMMU that needs
to be managed.  This commit tweaks the core NVMe code to
support the linear command submission queue implemented by
this controller.  But setting up the submission queue and
managing the NVMMU controller is handled by implementing
the driver ops that were added in an earlier commit.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Tested-on: firefly-rk3399
Tested-by: Mark Kettenis <kettenis@openbsd.org>
Tested on: Macbook Air M1
Tested-by: Simon Glass <sjg@chromium.org>
2 years agopower: domain: apple: Add reset support
Mark Kettenis [Sat, 22 Jan 2022 19:38:17 +0000 (20:38 +0100)]
power: domain: apple: Add reset support

The power management controller found on Apple SoCs als provides
a way to reset all devices within a power domain. This is needed
to cleanly shutdown the NVMe controller before we hand over
control to the OS.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested on: Macbook Air M1
Tested-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agonvme: Add shutdown function
Mark Kettenis [Sat, 22 Jan 2022 19:38:16 +0000 (20:38 +0100)]
nvme: Add shutdown function

Add a function to disable the NVMe controller. This will be used
to let the driver for the NVMe storage integrated on Apple SoCs
shutdown the NVMe controller such we can shutdown the NVMe
IOP controller in a clean way afterwards before handing control
to the OS.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested on: Macbook Air M1
Tested-by: Simon Glass <sjg@chromium.org>
2 years agonvme: Introduce driver ops
Mark Kettenis [Sat, 22 Jan 2022 19:38:15 +0000 (20:38 +0100)]
nvme: Introduce driver ops

The NVMe storage controller integrated on Apple SoCs deviates
from the NVMe standard in two aspects.  It uses a "linear"
submission queue and it integrates an NVMMU that needs to be
programmed for each NVMe command.  Introduce driver ops such
that we can set up the linear submission queue and program the
NVMMU in the driver for this strange beast.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested on: Macbook Air M1
Tested-by: Simon Glass <sjg@chromium.org>
2 years agoarm: apple: Add RTKit support
Mark Kettenis [Sat, 22 Jan 2022 19:38:14 +0000 (20:38 +0100)]
arm: apple: Add RTKit support

Most Apple IOPs run a firmware that is based on what Apple calls
RTKit. RTKit implements a common mailbox protocol.  This code
provides an implementation of the AP side of this protocol,
providing a function to initialize RTKit-based firmwares as well
as a function to do a clean shutdown of this firmware.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested on: Macbook Air M1
Tested-by: Simon Glass <sjg@chromium.org>
2 years agoarm: apple: Change SoC name from "m1" into "apple"
Mark Kettenis [Sat, 22 Jan 2022 19:38:13 +0000 (20:38 +0100)]
arm: apple: Change SoC name from "m1" into "apple"

U-Boot is expected to support multiple generations of Apple SoCs
in a single binary with a single defconfig. Therefore it makes
more sense to set SYS_SOC to "apple".

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agomailbox: apple: Add driver for Apple IOP mailbox
Mark Kettenis [Sat, 22 Jan 2022 19:38:12 +0000 (20:38 +0100)]
mailbox: apple: Add driver for Apple IOP mailbox

This mailbox driver provides a communication channel with the
Apple IOP controllers found on Apple SoCs.  These IOP controllers
are used to implement various functions such as the System
Manegement Controller (SMC) and NVMe storage.  It allows sending
and receiving a 96-bit message over a single channel.

The header file with the struct used for mailbox messages is taken
straight from Linux.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Signed-off-by: Sven Peter <sven@svenpeter.dev>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested on: Macbook Air M1
Tested-by: Simon Glass <sjg@chromium.org>
2 years agonvme: Split out PCI support
Mark Kettenis [Sat, 22 Jan 2022 19:38:11 +0000 (20:38 +0100)]
nvme: Split out PCI support

Apple SoCs have an integrated NVMe controller that isn't connected
over a PCIe bus. In preparation for adding support for this NVMe
controller, split out the PCI support into its own file. This file
is selected through a new CONFIG_NVME_PCI Kconfig option, so do
a wholesale replacement of CONFIG_NVME with CONFIG_NVME_PCI.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested on: Macbook Air M1
Tested-by: Simon Glass <sjg@chromium.org>
2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Thu, 10 Feb 2022 20:09:55 +0000 (15:09 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-riscv

2 years agoMerge tag 'dm-pull-8feb22-take3' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Thu, 10 Feb 2022 14:02:06 +0000 (09:02 -0500)]
Merge tag 'dm-pull-8feb22-take3' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm

patman snake-case conversion
binman fit improvements
ACPI fixes and making MCFG available to ARM

[trini: Update scripts/pylint.base]
Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Thu, 10 Feb 2022 12:37:14 +0000 (07:37 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell

- kwboot: Misc improvements and fixes (Pali)
- Kirkwood: Move to DM ethernet support for some boards (Tony)
- Minor misc stuff

2 years agoarm: kirkwood: Pogoplug E02 : Convert Ethernet to Driver Model
Tony Dinh [Wed, 9 Feb 2022 02:56:22 +0000 (18:56 -0800)]
arm: kirkwood: Pogoplug E02 : Convert Ethernet to Driver Model

The Pogoplug E02 board has the network chip Marvell 88E1116R. Convert
to Driver Model and use uclass mvgbe and the compatible driver M88E1118R
to bring up Ethernet.

- Add board_eth_init(), CONFIG_DM_ETH, and CONFIG_PHY_MARVELL
to bring up Ethernet.
- Currently, CONFIG_RESET_PHY_R symbol is used in
arch/arm/mach-kirkwood/include/mach/config.h for all Kirkwood
boards with mv8831116 PHY, with each board defines the function
reset_phy(). Undefine it for this board.
- As the result of the migration to Driver Model, this u-boot image has
grown substantially (about 100K, give or take). The old envs location
at 0x60000 (384k) is no longer possible. Move it to 0xC0000 (768K).
- Miscellaneous changes: Move constants to .c file and remove header file
board/cloudengines/pogo_e02/pogo_e02.h, use CONFIG_SYS_THUMB_BUILD to
keep u-boot image under 512K, use BIT macro, and cleanup comments.

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Allow to use -b without image path as the last getopt() option
Pali Rohár [Mon, 7 Feb 2022 09:12:24 +0000 (10:12 +0100)]
tools: kwboot: Allow to use -b without image path as the last getopt() option

Currently it is possible to call "kwboot -b -t /dev/ttyUSB0" but not to
call "kwboot -b /dev/ttyUSB0".

Fix it by not trying to process the last argv[], which is non-getopt()
option (tty path) as the image path for -b.

Fixes: 7303f00ee80b ("tools: kwboot: Allow to use option -b without image path")
Reported-by: Marcel Ziswiler <marcel@ziswiler.com>
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marcel Ziswiler <marcel@ziswiler.com>
Tested-by: Marcel Ziswiler <marcel@ziswiler.com>
2 years agoarm: kirkwood: Dockstar : Add DM Ethernet
Tony Dinh [Thu, 3 Feb 2022 22:32:29 +0000 (14:32 -0800)]
arm: kirkwood: Dockstar : Add DM Ethernet

The Dockstar board has the network chip Marvell 88E1116R. Convert to
Ethernet driver model, and use uclass mvgbe and the compatible driver
M88E1118R to bring up Ethernet.

- Add CONFIG_DM_ETH and associated configs.
- Add board_eth_init() to use uclass mvgbe to bring up the network.
And remove ad-hoc code.
- Add CONFIG_PHY_MARVELL to properly configure the network.
- Currently, CONFIG_RESET_PHY_R symbol is used in
arch/arm/mach-kirkwood/include/mach/config.h for all Kirkwood
boards with mv8831116 PHY, with each board defines the function
reset_phy(). Undefine it for this board.
- Miscellaneous changes: Move constants to .c file and remove
header file board/Seagate/dockstar/dockstar.h, use
CONFIG_SYS_THUMB_BUILD to keep u-boot image
under 512K, add CONFIG_HUSH_PARSER, use BIT macro, and cleanup comments.

- Note: This patch is a RESEND for a previous patch:
https://patchwork.ozlabs.org/project/uboot/patch/20210812051854.1340-2-mibodhi@gmail.com/

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoMAINTAINERS: Update list of Armada 385 and Armada 3720 drivers
Pali Rohár [Thu, 3 Feb 2022 16:57:49 +0000 (17:57 +0100)]
MAINTAINERS: Update list of Armada 385 and Armada 3720 drivers

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Fix detection of quit esc sequence
Pali Rohár [Thu, 3 Feb 2022 16:45:20 +0000 (17:45 +0100)]
tools: kwboot: Fix detection of quit esc sequence

Quit esc sequence may be also in the middle of the read buffer.
Fix the detection for that case.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: kirkwood: iConnect : Add Ethernet support
Tony Dinh [Wed, 2 Feb 2022 05:59:27 +0000 (21:59 -0800)]
arm: kirkwood: iConnect : Add Ethernet support

- Currently, CONFIG_RESET_PHY_R symbol is used in
arch/arm/mach-kirkwood/include/mach/config.h for all Kirkwood
boards with mv8831116 PHY, with each board defines the function
reset_phy(). Undefine it for this board.
- Add board_eth_init(), CONFIG_DM_ETH, and CONFIG_PHY_MARVELL
to bring up Ethernet.
- Miscellaneous changes: Move constants to .c file and remove header file
board/iomega/iconnect/iconnect.h. Add CONFIG_HUSH_PARSER, use BIT macro,
and cleanup comments.

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: kirkwood: Dreamplug : Use Marvell uclass mvgbe and PHY driver for Ethernet
Tony Dinh [Sun, 30 Jan 2022 23:02:30 +0000 (15:02 -0800)]
arm: kirkwood: Dreamplug : Use Marvell uclass mvgbe and PHY driver for Ethernet

The Globalscale Technologies Dreamplug board has the network chip
Marvell 88E1116R. Use uclass mvgbe and the compatible driver M88E1310
driver to bring up Ethernet.

- Currently, CONFIG_RESET_PHY_R symbol is used in
arch/arm/mach-kirkwood/include/mach/config.h for all Kirkwood
boards with mv8831116 PHY, with each board defines the function
reset_phy(). Undefine it for this board.
- Add board_eth_init() to use uclass mvgbe to bring up both network
port 0 and 1. And remove ad-hoc code.
- Enable CONFIG_PHY_MARVELL to properly configure the network.
- Add myself as maintainer (this board seems to be orphaned,
could not contact Jason Cooper using current email).
- Miscellaneous changes: Move constants to .c file and remove header file
board/Marvell/dreamplug/dreamplug.h, cleanup comments.

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
2 years agodoc: qemu-riscv: Update documentation for QEMU spike machine
Anup Patel [Thu, 27 Jan 2022 06:11:10 +0000 (11:41 +0530)]
doc: qemu-riscv: Update documentation for QEMU spike machine

We can now use same U-Boot images on both QEMU virt machine and QEMU
spike machine so let's update the QEMU RISC-V documentation.

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agoriscv: qemu: Implement is_flash_available() for MTD NOR
Anup Patel [Thu, 27 Jan 2022 06:11:09 +0000 (11:41 +0530)]
riscv: qemu: Implement is_flash_available() for MTD NOR

Currently, if MTD NOR is enabled then U-Boot tries to issue flash
commands even when CFI flash DT node is not present. This causes
access fault on RISC-V emulators or ISS which do not emulate CFI
flash. To handle this issue, we implement is_flash_available() for
qemu-riscv board which will return 1 only if CFI flash DT node is
present.

Fixes: 4cc52735737d ("riscv: qemu: Enable MTD NOR flash support")
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
2 years agoriscv: qemu: Enable HTIF console support
Anup Patel [Thu, 27 Jan 2022 06:11:08 +0000 (11:41 +0530)]
riscv: qemu: Enable HTIF console support

Enable support for HTIF console so that we can use QEMU RISC-V U-Boot
on RISC-V emulators and ISS having it.

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
2 years agoserial: Add RISC-V HTIF console driver
Anup Patel [Thu, 27 Jan 2022 06:11:07 +0000 (11:41 +0530)]
serial: Add RISC-V HTIF console driver

Quite a few RISC-V emulators and ISS (including Spike) have host
transfer interface (HTIF) based console. This patch adds HTIF
based console driver for RISC-V platforms which depends totally
on DT node for HTIF register base address.

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
Reviewed-by: Rick Chen <rick@andestech.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
2 years agobinman: Convert FIT entry type to a subclass of Section entry type
Alper Nebi Yasak [Mon, 7 Feb 2022 22:08:07 +0000 (01:08 +0300)]
binman: Convert FIT entry type to a subclass of Section entry type

The binman FIT entry type shares some code with the Section entry type.
This shared code is bound to grow, since FIT entries are conceptually a
variation of Section entries.

Make FIT entry type a subclass of Section entry type, simplifying it a
bit and providing us the features that Section implements. Also fix the
subentry alignment test which now attempts to write symbols to a
nonexistent SPL ELF test file by creating it first.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Avoid AddMissingProperties() and SetCalculatedProperties() with FIT:
Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Check missing bintools of Section subclasses
Alper Nebi Yasak [Mon, 7 Feb 2022 22:08:06 +0000 (01:08 +0300)]
binman: Check missing bintools of Section subclasses

Binman can check for missing binary tools and prints warnings if
anything required for an image is missing. The implementation of this
for the Section entry only checks the subentries, presumably because
Section does not use any binary tools itself. However, this means the
check is also skipped for subclasses of Section which might need binary
tools.

Make sure missing binary tools are checked for subclasses of the Section
entry type as well, by calling the parent class' implementation in
the relevant Section method.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Register and check bintools from FIT subentries
Alper Nebi Yasak [Mon, 7 Feb 2022 22:08:05 +0000 (01:08 +0300)]
binman: Register and check bintools from FIT subentries

Binman keeps track of binary tools each entry wants to use. The
implementation of this for the FIT entry only adds "mkimage", but not
the tools that would be used by its subentries.

Register the binary tools that FIT subentries will use in addition to
the one FIT itself uses, and check their existence by copying the
appropriate method from Section entry type. Also add tests that check if
these subentries can use and warn about binary tools.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Fix subentry expansion for FIT entry type
Alper Nebi Yasak [Mon, 7 Feb 2022 22:08:04 +0000 (01:08 +0300)]
binman: Fix subentry expansion for FIT entry type

Binman tries to expand some entries into parts that make it up, e.g.
'u-boot' into a 'u-boot-expanded' section that contains 'u-boot-nodtb'
and 'u-boot-dtb'. Entries with child entries must call ExpandEntries()
on them to build a correct image, as it's possible that unexpanded child
entries have no data of their own. The FIT entry type doesn't currently
do this, which means putting a "u-boot" entry inside it doesn't work as
expected.

Implement ExpandEntries() for FIT and add a copy of a simple FIT image
test that checks subentry expansion in FIT entries.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoacpi: Move MCFG implementation to common lib
Moritz Fischer [Sat, 5 Feb 2022 20:17:45 +0000 (12:17 -0800)]
acpi: Move MCFG implementation to common lib

MCFG tables are used on multiple arches. Move to common ACPI lib.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Moritz Fischer <moritzf@google.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Use sizeof(*mcfg) instead of sizeof(*header)
Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoarch: x86: lib: acpi_table: Fix MCFG entries
Moritz Fischer [Sat, 5 Feb 2022 20:17:44 +0000 (12:17 -0800)]
arch: x86: lib: acpi_table: Fix MCFG entries

Commit 08ae072f87fc ("x86: Move SSDT table to a writer function")
introduced a bug where the actual MCFG entries are no longer generated.

Cc: Simon Glass <sjg@chromium.org>
Fixes: 08ae072f87fc ("x86: Move SSDT table to a writer function")
Signed-off-by: Moritz Fischer <moritzf@google.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
2 years agoserial-uclass: fix build warning
Heiko Schocher [Wed, 2 Feb 2022 12:55:19 +0000 (13:55 +0100)]
serial-uclass: fix build warning

if CONFIG_DM_STDIO is defined but SERIAL_PRESENT not,
gcc drops warnings for serial_stub_* functions
that they are defined but not used.

Fix it.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoserial: remove nulldev_serial_input
Heiko Schocher [Wed, 2 Feb 2022 12:53:17 +0000 (13:53 +0100)]
serial: remove nulldev_serial_input

nulldev_serial_input is static and not used in this file,
so remove it.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agopatman: Update with new pylint scores
Simon Glass [Sat, 29 Jan 2022 21:14:19 +0000 (14:14 -0700)]
patman: Update with new pylint scores

Update the new baseline since various scores have improved.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agopatman: Convert camel case in terminal.py
Simon Glass [Sat, 29 Jan 2022 21:14:18 +0000 (14:14 -0700)]
patman: Convert camel case in terminal.py

Convert this file to snake case and update all files which use it.

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