platform/kernel/u-boot.git
2 years agoboard: gateworks: venice: config file cleanups
Tim Harvey [Fri, 11 Feb 2022 18:52:06 +0000 (10:52 -0800)]
board: gateworks: venice: config file cleanups

Clean up config file:
 - remove unnecessary IMX_FEC_BASE
 - remove unnecessary comment
 - remove ipaddr/serverip from env

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoboard: gateworks: venice: add imx8mn-gw7902 support
Tim Harvey [Fri, 11 Feb 2022 18:48:56 +0000 (10:48 -0800)]
board: gateworks: venice: add imx8mn-gw7902 support

The GW7902 is based on the i.MX 8M Mini / Nano SoC featuring:
 - LPDDR4 DRAM
 - eMMC FLASH
 - Gateworks System Controller
 - LTE CAT M1 modem
 - USB 2.0 HUB
 - M.2 Socket with USB2.0, PCIe, and dual-SIM
 - IMX8M FEC
 - PCIe based GbE
 - RS232/RS485/RS422 serial transceiver
 - GPS
 - CAN bus
 - WiFi / Bluetooth
 - MIPI header (DSI/CSI/GPIO/PWM/I2S)
 - PMIC

To add support for the i.MX8M Nano GW7902:
 - Add imx8mn-venice dts/defconfig/include
 - Add imx8mn-gw7902 dts
 - Add imx8mn-2gb lpddr4 dram configs
 - Add misc support for IMX8M Nano SoC
 - rename imx8mm-venice.c to venice.c as it is no longer imx8mm specific
 - update README with differences for IMX8MN vs IMX8MM

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agommc: fsl_esdhc_imx: correct the actual card clock
Haibo Chen [Fri, 11 Feb 2022 11:16:57 +0000 (19:16 +0800)]
mmc: fsl_esdhc_imx: correct the actual card clock

The original code logic can not show the correct card clock, and also
has one risk when the div is 0. Because there is div -=1 before.

So move the operation before div -=1, and also involve ddr_pre_div
to get the correct value.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Marek Vasut <marex@denx.de>
2 years agommc: fsl_esdhc_imx: remove redundant ARCH_MXC
Haibo Chen [Fri, 11 Feb 2022 11:16:56 +0000 (19:16 +0800)]
mmc: fsl_esdhc_imx: remove redundant ARCH_MXC

Now original fsl_esdhc.c are split as fsl_esdhc.c and fsl_esdhc_imx.c.
fsl_esdhc_imx.c only cover i.MX SoC. So ARCH_MXC is redundant.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Marek Vasut <marex@denx.de>
2 years agoarm: imx8m: add support for Advantech RSB-3720
Ying-Chun Liu (PaulLiu) [Tue, 8 Feb 2022 01:22:38 +0000 (09:22 +0800)]
arm: imx8m: add support for Advantech RSB-3720

Add initial support for Advantech RSB-3720 board.
The initial support includes:
 - MMC
 - eMMC
 - I2C
 - FEC
 - Serial console

Signed-off-by: Darren Huang <darren.huang@advantech.com.tw>
Signed-off-by: Kevin12.Chen <Kevin12.Chen@advantech.com.tw>
Signed-off-by: Phill.Liu <Phill.Liu@advantech.com.tw>
Signed-off-by: Tim Liang <tim.liang@advantech.com.tw>
Signed-off-by: wei.zeng <wei.zeng@advantech.com.cn>
Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Cc: uboot-imx <uboot-imx@nxp.com>
Cc: Peng Fan (OSS) <peng.fan@oss.nxp.com>
2 years agoconfigs/*imx8mn*: remove [SPL_]CLK_COMPOSITE_CCF
Heiko Thiery [Sun, 30 Jan 2022 06:37:08 +0000 (07:37 +0100)]
configs/*imx8mn*: remove [SPL_]CLK_COMPOSITE_CCF

This option is selected implicitly when [SPL_]CLK_IMX8MN is selected.

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
2 years agoclk: imx: select [SPL_]CLK_COMPOSITE_CCF for imx8mn
Heiko Thiery [Sun, 30 Jan 2022 06:37:06 +0000 (07:37 +0100)]
clk: imx: select [SPL_]CLK_COMPOSITE_CCF for imx8mn

The clock composite is required when using the clock framework. So
select it automatically.

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
2 years agoimx8mm_beacon/imx8mn_beacon: Update build instructions
Adam Ford [Sat, 22 Jan 2022 20:48:40 +0000 (14:48 -0600)]
imx8mm_beacon/imx8mn_beacon: Update build instructions

With binman generating flash.bin, it's not longer necessary to
specify either the location of ATF nor is it necessary to
specify building flash.bin, so let's update the build instructions
to remove those.  While in here, update the revision of ATF and
DDR firmware so both Mini and Nano reference the same revision.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agommc: fsl_esdhc_imx: Use esdhc_soc_data flags to set host caps
Adam Ford [Wed, 12 Jan 2022 13:53:56 +0000 (07:53 -0600)]
mmc: fsl_esdhc_imx: Use esdhc_soc_data flags to set host caps

The Linux driver automatically can detect and enable UHS, HS200, HS400
and HS400_ES automatically without extra flags being placed into the
device tree.

Right now, for U-Boot to use UHS, HS200 or HS400, the extra flags are
needed in the device tree.  Instead, go through the esdhc_soc_data
flags and enable the host caps where applicable to automatically
enable higher speeds.

Suggested-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Adam Ford <aford173@gmail.com>
2 years agoarm: dts: imx8mq: add MNT Reform 2
Patrick Wildt [Sat, 8 Jan 2022 15:04:55 +0000 (16:04 +0100)]
arm: dts: imx8mq: add MNT Reform 2

Device tree taken from Linux v5.16-rc5.

Signed-off-by: Patrick Wildt <patrick@blueri.se>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agofreescale: imx8mm_evk: Use IS_ENABLED instead of #ifdef
Tommaso Merciai [Sun, 26 Dec 2021 17:23:11 +0000 (18:23 +0100)]
freescale: imx8mm_evk: Use IS_ENABLED instead of #ifdef

Use IS_ENABLED(CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG) to make the code
more readable and fix checkpatch.pl warning

Signed-off-by: Tommaso Merciai <tomm.merciai@gmail.com>
2 years agoEnable Fastboot(UUU) for O4-iMX6ULL-NANO boards
Oleh Kravchenko [Mon, 20 Dec 2021 14:00:01 +0000 (16:00 +0200)]
Enable Fastboot(UUU) for O4-iMX6ULL-NANO boards

Make O4-iMX6ULL-NANO-based board compatible with Yocto layer meta-out4 and
fix device flashing by UUU (aka MFG Tools).

Signed-off-by: Oleh Kravchenko <oleg@kaa.org.ua>
2 years agoimx: spl: Fix typo BMODE_EMI -> BMODE_EIM
Harald Seiler [Wed, 1 Dec 2021 09:02:54 +0000 (10:02 +0100)]
imx: spl: Fix typo BMODE_EMI -> BMODE_EIM

The interface for NOR/OneNAND is called "EIM" not "EMI".  Fix this.

Signed-off-by: Harald Seiler <hws@denx.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agocmd: fuse: Add a command to read fuses to memory
Angus Ainslie [Sun, 28 Nov 2021 16:02:53 +0000 (08:02 -0800)]
cmd: fuse: Add a command to read fuses to memory

With the fuse values in memory we can use some of the other u-boot shell
conditonal operators to do tests.

Signed-off-by: Angus Ainslie <angus@akkea.ca>
2 years agocmd: fuse: add a fuse comparison function
Angus Ainslie [Sun, 28 Nov 2021 16:02:52 +0000 (08:02 -0800)]
cmd: fuse: add a fuse comparison function

Compare a hexval to the fuse value and return pass or fail.

Signed-off-by: Angus Ainslie <angus@akkea.ca>
2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Thu, 17 Feb 2022 16:03:50 +0000 (11:03 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- a37xx: pci: Cleanup and minor fix for root port check (Pali)
- pci: mvebu: Ensure that root port is always on root zero bus (Pali)
- kwbimage: Fix dumping DATA registers for v0 images (Pali)
- kwbimage: Support for parsing extended v0 format (Pali)
- a37xx: Fix code and update DTS files to upstream version (Pali)
- a37xx: Fix and extend building memory map (Pali)
- ddr: marvell: a38x: fix BYTE_HOMOGENEOUS_SPLIT_OUT decision (Marek)
- mvebu: Optionally reset board on DDR training failure (Marek)

2 years agoarm: mvebu: turris_omnia: Reset the board immediately on DDR training failure
Marek Behún [Thu, 17 Feb 2022 12:54:43 +0000 (13:54 +0100)]
arm: mvebu: turris_omnia: Reset the board immediately on DDR training failure

The state of the current DDR training code for Armada 38x is such that
we cannot be sure it will always train successfully - although after the
last change we were yet unable to find a board that failed DDR training,
from experience in the last 2 years we know that it is possible.

The experience also tells us that in many cases the board fails training
only sometimes, and after a reset the training is successful.

Enable the new option that makes the board reset itself on DDR training
failure immediately. Until now we called hang() in such a case, which
meant that the board was reset by the MCU after 120 seconds.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
2 years agoarm: mvebu: spl: Add option to reset the board on DDR training failure
Marek Behún [Thu, 17 Feb 2022 12:54:42 +0000 (13:54 +0100)]
arm: mvebu: spl: Add option to reset the board on DDR training failure

Some boards may occacionally fail DDR training. Currently we hang() in
this case. Add an option that makes the board do an immediate reset in
such a case, so that a new training is tried as soon as possible,
instead of hanging and possibly waiting for watchdog to reset the board.

(If the DDR training fails while booting the image via UART, we will
 still hang - it doesn't make sense to reset in such a case, because
 after reset the board will try booting from another medium, and the
 UART booting utility does not expect that.)

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwbimage: Add me as an author of kwbimage
Pali Rohár [Thu, 17 Feb 2022 09:43:40 +0000 (10:43 +0100)]
tools: kwbimage: Add me as an author of kwbimage

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwbimage: Fix help how to extract DDR3 training code
Pali Rohár [Thu, 17 Feb 2022 09:43:39 +0000 (10:43 +0100)]
tools: kwbimage: Fix help how to extract DDR3 training code

First binary executable header is extracted by '-p 1' argument.

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwbimage: Add support for NAND_BLKSZ and NAND_BADBLK_LOCATION for v0 images
Pali Rohár [Thu, 17 Feb 2022 09:43:38 +0000 (10:43 +0100)]
tools: kwbimage: Add support for NAND_BLKSZ and NAND_BADBLK_LOCATION for v0 images

These two commands are currently not processed when generating v0 images.

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwbimage: Do not show mkimage error message in dumpimage
Pali Rohár [Thu, 17 Feb 2022 09:43:37 +0000 (10:43 +0100)]
tools: kwbimage: Do not show mkimage error message in dumpimage

When pflag is set then kwbimage was invoked by dumpimage and not mkimage.
So do not show mkimage error message in this case.

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwbimage: Add support for dumping extended and binary v0 headers
Pali Rohár [Thu, 17 Feb 2022 09:43:36 +0000 (10:43 +0100)]
tools: kwbimage: Add support for dumping extended and binary v0 headers

dumpimage is now able to successfully parse and dump content of the Dove
bootloader image.

Note that support for generating these extended parts of v0 images is not
included yet.

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwbimage: Fix calculating size of kwbimage v0 header
Pali Rohár [Thu, 17 Feb 2022 09:43:35 +0000 (10:43 +0100)]
tools: kwbimage: Fix calculating size of kwbimage v0 header

Extended and binary headers are optional and are part of the image header.

Fixes kwboot to determinate correct length of Dove images.

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwbimage: Define structures for extended kwbimage v0 headers
Pali Rohár [Thu, 17 Feb 2022 09:43:34 +0000 (10:43 +0100)]
tools: kwbimage: Define structures for extended kwbimage v0 headers

They are used by Marvell Dove 88AP510 BootROM.

After the main header is a list of optional extended headers and after that
is a list of optional binary executable headers. Between each two extended
headers is additional 0x20 byte long padding.

Original Kirkwood SoCs support only one extended header and no binary
executable header.

Extension of struct ext_hdr_v0 is backward compatible with the old
definition. Only reserved[] fields are changed.

Signed-off-by: Pali Rohár <pali@kernel.org>
Tested-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoddr: marvell: a38x: fix BYTE_HOMOGENEOUS_SPLIT_OUT decision
Marek Behún [Thu, 17 Feb 2022 00:08:37 +0000 (01:08 +0100)]
ddr: marvell: a38x: fix BYTE_HOMOGENEOUS_SPLIT_OUT decision

In commit 3fc92a215b69 ("ddr: marvell: a38x: fix SPLIT_OUT_MIX state
decision") I ported a cleaned up and changed version of patch
  mv_ddr: a380: fix SPLIT_OUT_MIX state decision

In the port we removed checking for BYTE_HOMOGENEOUS_SPLIT_OUT bit,
because:
- the fix seemed to work without it
- the bit was checked for only at one place out of two, while the second
  bit, BYTE_SPLIT_OUT_MIX, was checked for in both cases
- without the removal it didn't work on Allied Telesis' x530 board

We recently had a chance to test on more boards, and it seems that the
change needs to be opposite: instead of removing the check for
BYTE_HOMOGENEOUS_SPLIT_OUT from the first if() statement, the check
needs to be added also to the second one - it needs to be at both
places.

With this change all the Turris Omnia boards I have had available to
test seem to work, I didn't encounter not even one failed DDR training.

As last time, I am noting that I do not understand what this code is
actually doing, I haven't studied the DDR training algorithm and
I suspect that no one will be able to explain it to U-Boot contributors,
so we are left with this blind poking in the code with testing whether
it works on several boards and hoping it doesn't break anything for
anyone :-(.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Tested-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: a37xx: Fix comment with name of the function
Pali Rohár [Wed, 16 Feb 2022 10:18:45 +0000 (11:18 +0100)]
arm: mvebu: a37xx: Fix comment with name of the function

Function is named build_mem_map, not a3700_build_mem_map.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
2 years agoarm: mvebu: a37xx: Map CCI-400 and AP BootROM address space
Pali Rohár [Wed, 16 Feb 2022 10:18:44 +0000 (11:18 +0100)]
arm: mvebu: a37xx: Map CCI-400 and AP BootROM address space

In function build_mem_map() prepare also mapping for CCI-400 and
BootROM windows.

BootROM window is 1 MB long and by default starts at address 0xfff00000.
A53 AP BootROM is 16 kB long and repeats in this BootROM window 64 times.
RVBAR_EL3 register is set to value 0xffff0000, so by default A53 AP BootROM
is accessed via range 0xffff0000-0xffff3fff.

CCI-400 window when new TF-A version is used, starts at address 0xfe000000
and when old TF-A version is used, starts at address 0xd8000000.

Physical addresses are read directly from mvebu registers, so if TF-A
remaps it in future (again) then it would not cause any issue for U-Boot.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: a37xx: Fix calling build_mem_map()
Pali Rohár [Wed, 16 Feb 2022 10:18:43 +0000 (11:18 +0100)]
arm: mvebu: a37xx: Fix calling build_mem_map()

Function build_mem_map() modifies global variable mem_map. This variable is
used by the get_page_table_size() function which is called by function
arm_reserve_mmu() (as aliased macro PGTABLE_SIZE). Function
arm_reserve_mmu() is called earlier than enable_caches() which calls
build_mem_map(). So arm_reserve_mmu() does not calculate reserved memory
correctly.

Fix this issue by calling build_mem_map() from a3700_dram_init() which is
called before arm_reserve_mmu().

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
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: a7b61ab58d5d ("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 d368e1070514 ("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: d368e1070514 ("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: 1a8e6b63e24f ("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: cb056005dc67 ("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 agoMerge branch 'master' of git://source.denx.de/u-boot-usb
Tom Rini [Wed, 16 Feb 2022 23:21:41 +0000 (18:21 -0500)]
Merge branch 'master' of git://source.denx.de/u-boot-usb

2 years agoMerge branch '2022-02-16-add-TI-J721E-SK'
Tom Rini [Wed, 16 Feb 2022 23:21:21 +0000 (18:21 -0500)]
Merge branch '2022-02-16-add-TI-J721E-SK'

- Add TI J721E SK support

2 years agoarm: dts: k3-j721e-r5-sk: Update R5 DT to pick the new DDR config
Sinthu Raja [Tue, 2 Nov 2021 14:29:45 +0000 (19:59 +0530)]
arm: dts: k3-j721e-r5-sk: Update R5 DT to pick the new DDR config

A new lpddr4 configuration is introduced for J7 SK with 4266 MTs data
rate. Therefore, update the R5 DTS file to point to the new DDR config
file.

Signed-off-by: Sinthu Raja <sinthu.raja@ti.com>
2 years agoarm: dts: k3-j721e-sk: EMIF tool update to 0.6.1 with 4266MTs for lpddr4
Sinthu Raja [Tue, 2 Nov 2021 14:29:44 +0000 (19:59 +0530)]
arm: dts: k3-j721e-sk: EMIF tool update to 0.6.1 with 4266MTs for lpddr4

EMIF tool for J721E SK is now updated to 0.6.1 that includes
* Updated write DQ training pattern to enable user pattern and clock
  pattern (from 0x7 to 0x6).
* Updated IO drive strength to 40-80-80 Ohms.

J721E SK uses the lpddr4 configuration of 4266 MTs data rate which is
the same as J721E EVM but facing random failures. As the tool update is
specific to the SK board, add a new lpddr4 config of 4266 MTs.

Signed-off-by: Kevin Scholz <k-scholz@ti.com>
Signed-off-by: Sinthu Raja <sinthu.raja@ti.com>
2 years agoinclude: configs: Update env for selecting right dtb
Sinthu Raja [Wed, 9 Feb 2022 09:37:01 +0000 (15:07 +0530)]
include: configs: Update env for selecting right dtb

Now that single defconfig can be used for booting J721E EVM and
SK, default device tree will not work for selecting dtb for
kernel. Update the findfdt env to select right dtb based on
board_name env variable.

Signed-off-by: Sinthu Raja <sinthu.raja@ti.com>
2 years agoconfigs: j721e_evm: Store env in MMC FAT partition
Sinthu Raja [Wed, 9 Feb 2022 09:37:00 +0000 (15:07 +0530)]
configs: j721e_evm: Store env in MMC FAT partition

Enable defconfigs relevant for storing env on FAT partion of MMC.

Signed-off-by: Sinthu Raja <sinthu.raja@ti.com>
2 years agoconfigs: j721e_evm_a72: Align OSPI partitions on erase block boundary
Sinthu Raja [Wed, 9 Feb 2022 09:36:59 +0000 (15:06 +0530)]
configs: j721e_evm_a72: Align OSPI partitions on erase block boundary

S28HS512T on TI SK has sector size of 256KB, so update OSPI partition
to align on 256KB sector size. Since the sector size for MT35XU512ABA
on EVM is 128KB, partitions will remain aligned for EVM.

Also, now since the sector size is 256KB ospi.env.backup will collide
with ospi.sysfw, so move ospi.env.backup to the padding space (0x7C0000)
before ospi.rootfs partition.

Signed-off-by: Sinthu Raja <sinthu.raja@ti.com>
2 years agoconfigs: j721e_evm_a72: Add SK dtb as part of DTB FIT
Sinthu Raja [Wed, 9 Feb 2022 09:36:58 +0000 (15:06 +0530)]
configs: j721e_evm_a72: Add SK dtb as part of DTB FIT

Add k3-j721e-sk dtb along with other dtbs inside DTB FIT image.

Signed-off-by: Sinthu Raja <sinthu.raja@ti.com>
2 years agoconfigs: j721e_evm_r5: Enable support for building multiple dtbs into FIT
Sinthu Raja [Wed, 9 Feb 2022 09:36:57 +0000 (15:06 +0530)]
configs: j721e_evm_r5: Enable support for building multiple dtbs into FIT

Enable configs for building multiple dtbs into a single fit image
and load the right dtb for next stage. This will help to use same
defconfig for both J721E EVM and SK boards.

Signed-off-by: Sinthu Raja <sinthu.raja@ti.com>
2 years agoarm: dts: k3-j721e-r5-sk: Add initial R5 specific dts support for j721e-sk
Sinthu Raja [Wed, 9 Feb 2022 09:36:56 +0000 (15:06 +0530)]
arm: dts: k3-j721e-r5-sk: Add initial R5 specific dts support for j721e-sk

Add R5 specific dts for J721E-SK

Signed-off-by: Sinthu Raja <sinthu.raja@ti.com>
2 years agoarm: dts: k3-j721e-sk: Add initial A72 specific dts support
Sinthu Raja [Wed, 9 Feb 2022 09:36:55 +0000 (15:06 +0530)]
arm: dts: k3-j721e-sk: Add initial A72 specific dts support

J721E Starter Kit (SK)[1] is a low cost, small form factor board designed
for TI’s J721E SoC. TI’s J721E SoC comprises of dual core A72, high
performance vision accelerators, video codec accelerators, latest C71x
and C66x DSP, high bandwidth real-time IPs for capture and display, GPU,
dedicated safety island and security accelerators. The SoC is power
optimized to provide best in class performance for industrial and
automotive applications.

    J721E SK supports the following interfaces:
    * 4 GB LPDDR4 RAM
    * x1 Gigabit Ethernet interface
    * x1 USB 3.0 Type-C port
    * x3 USB 3.0 Type-A ports
    * x1 PCIe M.2 E Key
    * x1 PCIe M.2 M Key
    * 512 Mbit OSPI flash
    * x2 CSI2 Camera interface (RPi and TI Camera connector)
    * 40-pin Raspberry Pi GPIO header

Add A72 specific dts for J721E-SK.

[1] https://www.ti.com/tool/SK-TDA4VM

Signed-off-by: Sinthu Raja <sinthu.raja@ti.com>
2 years agoarm: dts: k3-j721e-r5-common-proc-board: Do not use power-domains for I2C
Sinthu Raja [Wed, 9 Feb 2022 09:36:54 +0000 (15:06 +0530)]
arm: dts: k3-j721e-r5-common-proc-board: Do not use power-domains for I2C

Board ID I2C EEPROM will be probed before SYSFW is available.
So drop the power-domains property for wakup_i2c0 on which
board ID EEPROM is connected.

Signed-off-by: Sinthu Raja <sinthu.raja@ti.com>
2 years agoarm: j721e: Add support for selecting DT based on board name
Sinthu Raja [Wed, 9 Feb 2022 09:36:53 +0000 (15:06 +0530)]
arm: j721e: Add support for selecting DT based on board name

Enable support for selecting DTB from FIT within SPL based on the
board name read from EEPROM. This will help to use single defconfig
for both EVM and SK.

Signed-off-by: Sinthu Raja <sinthu.raja@ti.com>
2 years agoboard: ti: j721e: Add support for detecting multiple device trees
Sinthu Raja [Wed, 9 Feb 2022 09:36:52 +0000 (15:06 +0530)]
board: ti: j721e: Add support for detecting multiple device trees

Update the board_fit_config_name_match() to choose the right dtb
based on the board name read from EEPROM.

Also restrict multpile EEPROM reads by verifying if EEPROM is already
read.

Signed-off-by: Sinthu Raja <sinthu.raja@ti.com>
2 years agoboard: ti: j721e: Disable probing of daughtercards
Sinthu Raja [Wed, 9 Feb 2022 09:36:51 +0000 (15:06 +0530)]
board: ti: j721e: Disable probing of daughtercards

j721e-sk doesn't have any daughter cards, so disable daughter
card probing inside board_late_init() and spl_board_init() for
j721e-sk.

Signed-off-by: Sinthu Raja <sinthu.raja@ti.com>
2 years agoboard: ti: j721e: Add support to update board_name for j721e-sk
Sinthu Raja [Wed, 9 Feb 2022 09:36:50 +0000 (15:06 +0530)]
board: ti: j721e: Add support to update board_name for j721e-sk

Update setup_board_eeprom_env() to choose the right board name
for j721e-sk.

Signed-off-by: Sinthu Raja <sinthu.raja@ti.com>
2 years agoboard: ti: j721e: Enable support for reading EEPROM at next alternate address
Sinthu Raja [Wed, 9 Feb 2022 09:36:49 +0000 (15:06 +0530)]
board: ti: j721e: Enable support for reading EEPROM at next alternate address

J721E EVM has EEPROM populated at 0x50. J721E SK has EEPROM populated
at next address 0x51 in order to be compatible with RPi. So start
looking for TI specific EEPROM at 0x50, if not found look for EEPROM at
0x51.

Signed-off-by: Sinthu Raja <sinthu.raja@ti.com>
2 years agoboard: ti: j721e: Guard functions with right #ifdef to avoid build warnings
Sinthu Raja [Wed, 9 Feb 2022 09:36:48 +0000 (15:06 +0530)]
board: ti: j721e: Guard functions with right #ifdef to avoid build warnings

board_late_init(), setup_board_eeprom_env() and setup_serial() is
called only under CONFIG_BOARD_LATE_INIT, so guard these functions
with the same. Also, reorder these functions to place it under
single #ifdef

Signed-off-by: Sinthu Raja <sinthu.raja@ti.com>
2 years agodrivers: power: regulator: tps65941_regulator: Add support for 3Phase buck
Sinthu Raja [Wed, 9 Feb 2022 09:36:47 +0000 (15:06 +0530)]
drivers: power: regulator: tps65941_regulator: Add support for 3Phase buck

Buck regulator 1, 2 and 3 of TPS6594132 on j721e-sk is in 3 Phase
confguration, in-order to support this, add configuring 3 Phase buck
in tps65941 while driver probing.

Signed-off-by: Sinthu Raja <sinthu.raja@ti.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agodrivers: power: pmic: Add support for tps659412 PMIC
Sinthu Raja [Wed, 9 Feb 2022 09:36:46 +0000 (15:06 +0530)]
drivers: power: pmic: Add support for tps659412 PMIC

Since TPS659412 and TPS659413 are both software compatible,
add a compatible string for the same inside tps65941.c.

Signed-off-by: Sinthu Raja <sinthu.raja@ti.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agofdtdec.h: Remove gurads around fdtdec_resetup function
Tom Rini [Wed, 16 Feb 2022 19:18:44 +0000 (14:18 -0500)]
fdtdec.h: Remove gurads around fdtdec_resetup function

This function has not been conditionally compiled for some time, so
remove the incorrect guards around the declaration.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agousb: xhci: reset endpoint on USB stall
Stefan Agner [Mon, 27 Sep 2021 12:42:58 +0000 (14:42 +0200)]
usb: xhci: reset endpoint on USB stall

There are devices which cause a USB stall when trying to read strings.
Specifically Arduino Mega R3 stalls when trying to read the product
string.

The stall currently remains unhandled, and subsequent retries submit new
transfers on a stopped endpoint which ultimately cause a crash in
abort_td():
WARN halted endpoint, queueing URB anyway.
XHCI control transfer timed out, aborting...
Unexpected XHCI event TRB, skipping... (3affe040 00000000 13000000 02008401)
BUG at drivers/usb/host/xhci-ring.c:505/abort_td()!
BUG!
resetting ...

Linux seems to be able to recover from the stall by issuing a
TRB_RESET_EP command.

Introduce reset_ep() which issues a TRB_RESET_EP followed by setting the
transfer ring dequeue pointer via TRB_SET_DEQ. This allows to properly
recover from a USB stall error and continue communicating with the USB
device.

Signed-off-by: Stefan Agner <stefan@agner.ch>
2 years agousb: dwc3: core: stop the core when it's removed
Angus Ainslie [Wed, 2 Feb 2022 23:08:55 +0000 (15:08 -0800)]
usb: dwc3: core: stop the core when it's removed

If u-boot doesn't stop the core when it's finished with it then
linux can't find it.

Signed-off-by: Angus Ainslie <angus@akkea.ca>
2 years agousb: dwc3: dwc3-generic: check the parent nodes
Angus Ainslie [Wed, 2 Feb 2022 23:08:54 +0000 (15:08 -0800)]
usb: dwc3: dwc3-generic: check the parent nodes

The kernel devicetree has definitions for port and hub nodes as subnodes
to the USB devices. These subnodes don't contain all of the data required
to properly configure the dwc3. Check the parent nodes if the data is not
in the port/hub node.

Here's an example from the librem5 kernel dts file

&usb_dwc3_0 {
#address-cells = <1>;
#size-cells = <0>;
dr_mode = "otg";
snps,dis_u3_susphy_quirk;
status = "okay";

port@0 {
reg = <0>;

typec_hs: endpoint {
remote-endpoint = <&usb_con_hs>;
};
};

port@1 {
reg = <1>;

typec_ss: endpoint {
remote-endpoint = <&usb_con_ss>;
};
};
};

&usb_dwc3_1 {
dr_mode = "host";
status = "okay";
#address-cells = <1>;
#size-cells = <0>;

/* Microchip USB2642 */
hub@1 {
compatible = "usb424,2640";
reg = <1>;
#address-cells = <1>;
#size-cells = <0>;

mass-storage@1 {
compatible = "usb424,4041";
reg = <1>;
};
};
};

Signed-off-by: Angus Ainslie <angus@akkea.ca>
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 6337d53fdf45 ("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>