platform/kernel/u-boot.git
2 years agotee: optee: define TEE error code TEE_ERROR_SHORT_BUFFER
Etienne Carriere [Tue, 9 Nov 2021 16:08:22 +0000 (17:08 +0100)]
tee: optee: define TEE error code TEE_ERROR_SHORT_BUFFER

Adds TEE_ERROR_SHORT_BUFFER as TEE error code. This error code is
commonly used by TEEs to inform caller that the buffer(s) it provided
is too small for the desired operation.

Cc: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
2 years agotee: optee: remove unused duplicated login Id macros
Etienne Carriere [Tue, 9 Nov 2021 16:08:21 +0000 (17:08 +0100)]
tee: optee: remove unused duplicated login Id macros

Remove unused OPTEE_MSG_LOGIN_* ID macros as suitable TEE_LOGIN_* ID
macros are already defined tee.h.

Cc: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
2 years agotee: define session login identifiers
Etienne Carriere [Tue, 9 Nov 2021 16:08:20 +0000 (17:08 +0100)]
tee: define session login identifiers

Define identifiers for clnt_login field in struct tee_open_session_arg
based in GlobalPlatform Device TEE IDs and on the REE_KERNEL identifier
extension from OP-TEE OS.

Cc: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
2 years agofirmware: scmi: smccc transport: simplify probe sequence
Etienne Carriere [Mon, 8 Nov 2021 07:56:11 +0000 (08:56 +0100)]
firmware: scmi: smccc transport: simplify probe sequence

Minor simplification in scmi_smccc_probe() exit sequence.

Cc: Simon Glass <sjg@chromium.org>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agofirmware: scmi: smccc transport: use plat data, not priv data
Etienne Carriere [Mon, 8 Nov 2021 07:56:10 +0000 (08:56 +0100)]
firmware: scmi: smccc transport: use plat data, not priv data

Change SCMI smccc transport drivers to use platform data rather
than private data for channel reference since it only stores platform
data retrieved from the DT. Consequently the probe handler is replaced
with a of_to_plat handler.

Cc: Simon Glass <sjg@chromium.org>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agofirmware: scmi: mailbox transport: use plat data, not priv data
Etienne Carriere [Mon, 8 Nov 2021 07:56:09 +0000 (08:56 +0100)]
firmware: scmi: mailbox transport: use plat data, not priv data

Change SCMI mailbox transport drivers to use platform data rather
than private data for channel reference since it only stores platform
data retrieved from the DT. Consequently the probe handler is replaced
with a of_to_plat handler.

Cc: Simon Glass <sjg@chromium.org>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agofirmware: scmi: mailbox transport: fix probe failure implementation
Etienne Carriere [Mon, 8 Nov 2021 07:56:08 +0000 (08:56 +0100)]
firmware: scmi: mailbox transport: fix probe failure implementation

Correct scmi mailbox probe function that can't free the scmi channel
instance since its auto-allocated by the device model framework.

Cc: Simon Glass <sjg@chromium.org>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agofirmware: scmi: fix description of an API function
Etienne Carriere [Mon, 8 Nov 2021 07:56:07 +0000 (08:56 +0100)]
firmware: scmi: fix description of an API function

Correct inline comment describing API function devm_scmi_process_msg().

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agostm32mp15: deactivate CONFIG_SCMI_AGENT_MAILBOX
Patrick Delaunay [Thu, 28 Oct 2021 17:13:16 +0000 (19:13 +0200)]
stm32mp15: deactivate CONFIG_SCMI_AGENT_MAILBOX

Deactivate the SCMI agent mailbox which is not used on STM32MP15
platforms.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
2 years agofirmware: scmi: add configs to select the supported agents
Patrick Delaunay [Thu, 28 Oct 2021 17:13:15 +0000 (19:13 +0200)]
firmware: scmi: add configs to select the supported agents

Add two configs CONFIG_SCMI_AGENT_MAILBOX and CONFIG_SCMI_AGENT_SMCCC
to select the supported agents as all the agents are not supported.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
2 years agopower: regulator: scmi: define LOG_CATEGORY
Patrick Delaunay [Thu, 28 Oct 2021 17:13:14 +0000 (19:13 +0200)]
power: regulator: scmi: define LOG_CATEGORY

Define LOG_CATEGORY to allow filtering with log command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agoclk: scmi: define LOG_CATEGORY
Patrick Delaunay [Thu, 28 Oct 2021 17:13:13 +0000 (19:13 +0200)]
clk: scmi: define LOG_CATEGORY

Define LOG_CATEGORY to allow filtering with log command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
2 years agoreset: scmi: define LOG_CATEGORY
Patrick Delaunay [Thu, 28 Oct 2021 17:13:12 +0000 (19:13 +0200)]
reset: scmi: define LOG_CATEGORY

Define LOG_CATEGORY to allow filtering with log command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
2 years agoMerge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-net into next
Tom Rini [Tue, 23 Nov 2021 12:43:50 +0000 (07:43 -0500)]
Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-net into next

- Various DSA additions
- bootp: fix for VCI string
- tsec: support for promiscuous mode
- add Aspeed MDIO driver

2 years agonet: phy: realtek: Add tx/rx delay config for 8211e
Samuel Holland [Wed, 13 Oct 2021 02:07:32 +0000 (21:07 -0500)]
net: phy: realtek: Add tx/rx delay config for 8211e

Some boards need to change the tx/rx delay config in order for
gigabit Ethernet to work.

In Linux commit bbc4d71d6354 ("net: phy: realtek: fix rtl8211e rx/tx
delay config"), Realtek documented the bits for overriding the delays
from the hardware straps.

Copy the logic from linux, so the delay config is set from the PHY's
interface type (the phy-mode property in the device tree).

This removes the need for a one-off workaround for the Pine A64+ board.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agodrivers: net: add Aspeed MDIO driver
Dylan Hung [Tue, 2 Nov 2021 05:41:54 +0000 (13:41 +0800)]
drivers: net: add Aspeed MDIO driver

Add a driver for the MDIO interface for Aspeed AST2600 SOC.  The driver
only supports clause 22 for now.

Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Ryan Chen <ryan_chen@aspeedtech.com>
2 years agonet: tsec: Make redundant_init() static
Bin Meng [Mon, 1 Nov 2021 06:15:12 +0000 (14:15 +0800)]
net: tsec: Make redundant_init() static

redundant_init() is only called in the tsec driver. Make it static.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agonet: fec_mxc: Declare 'promisc' as bool
Bin Meng [Mon, 1 Nov 2021 06:15:11 +0000 (14:15 +0800)]
net: fec_mxc: Declare 'promisc' as bool

priv->promisc is used as the parameter of the set_promisc() call
which accepts a bool type instead of char.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agonet: dsa: Use true instead of 1 in the set_promisc() call
Bin Meng [Mon, 1 Nov 2021 06:15:10 +0000 (14:15 +0800)]
net: dsa: Use true instead of 1 in the set_promisc() call

set_promisc() call accepts the parameter of a bool type. Make it
clear by using true instead of 1.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agocmd: pxe_utils: Check fdtcontroladdr in label_boot
Peter Hoyes [Thu, 14 Oct 2021 08:40:04 +0000 (09:40 +0100)]
cmd: pxe_utils: Check fdtcontroladdr in label_boot

If using OF_CONTROL, fdtcontroladdr is set to the fdt used to configure
U-Boot. When using PXE, if no fdt is defined in the menu file, and
there is no fdt at fdt_addr, add fall back on fdtcontroladdr too.

We are developing board support for the Armv8r64 FVP using
config_distro_bootcmd. We are also using OF_BOARD and would like the
PXE boot option to default to the fdt provided by board_fdt_blob_setup.

Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ramon Fried <rfried.dev@gmail.com>
2 years agonet: bootp: Correct VCI string transmission
Walter Stoll [Tue, 12 Oct 2021 11:01:59 +0000 (11:01 +0000)]
net: bootp: Correct VCI string transmission

The VCI string sent during bootp of U-Boot-SPL is corrupt. This is
because the byte counter is not adjusted within the bootp_extended()
function when the VCI string is added. We fix this.

Signed-off-by: Walter Stoll <walter.stoll@duagon.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoconfigs: ls1021a-tsn: enable the generation of random Ethernet MAC addresses
Vladimir Oltean [Wed, 29 Sep 2021 15:04:45 +0000 (18:04 +0300)]
configs: ls1021a-tsn: enable the generation of random Ethernet MAC addresses

Don't fail when booting a board with an empty EEPROM for MAC addresses.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agoconfigs: ls1021a-tsn: enable sja1105 switch driver
Vladimir Oltean [Wed, 29 Sep 2021 15:04:44 +0000 (18:04 +0300)]
configs: ls1021a-tsn: enable sja1105 switch driver

The sja1105 is a 5-port switch that uses a DM_DSA driver. Its 5th (CPU)
port is connected internally to the eth2 port of the LS1021A SoC.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agoarm: dts: ls1021a-tsn: add sja1105 and eth2 bindings
Vladimir Oltean [Wed, 29 Sep 2021 15:04:43 +0000 (18:04 +0300)]
arm: dts: ls1021a-tsn: add sja1105 and eth2 bindings

The eth aliases are for correct probing order, so that each Ethernet
port will get a predictable MAC address from the environment.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agonet: dsa: sja1105: add support for SGMII
Vladimir Oltean [Wed, 29 Sep 2021 15:04:42 +0000 (18:04 +0300)]
net: dsa: sja1105: add support for SGMII

The list of ports which support SGMII depending on switch generation is
available here:
https://www.kernel.org/doc/html/latest/networking/dsa/sja1105.html#port-compatibility-matrix

SGMII can either be used to connect to an external PHY or to the host
port. In the first case, the use of in-band autoneg is expected, in the
last, in-band autoneg is expected to be turned off (fixed-link). So the
driver supports both cases.

SGMII support means configuring the PCS and PMA. The PCS is a Synopsys
Designware XPCS, in Linux this has a separate driver but here it is
embedded within the sja1105 driver. If needed it can be taken out later,
although we would need a UCLASS_PCS for it, which we don't have atm.

Nonetheless, I did go all the way to export an internal MDIO bus for PCS
access, because it is nice to be able to debug the PCS through commands
such as:

=> mdio read ethernet-switch@1-pcs 4 1f.0
Reading from bus ethernet-switch@1-pcs
PHY at address 4:
31.0 - 0x1140

The internal MDIO bus is not registered with DM because there is no
udevice on it, as mentioned. But the XPCS code can still be ripped out,
as needed.

I did not add support for 2500base-x because I do not expect this
interface type to be used as a boot source for anybody, it would just
add unnecessary bloat.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agonet: dsa: add driver for NXP SJA1105 L2 switch
Vladimir Oltean [Wed, 29 Sep 2021 15:04:41 +0000 (18:04 +0300)]
net: dsa: add driver for NXP SJA1105 L2 switch

The SJA1105 driver is largely reused from Linux. Its programming model
is that it is blank out of reset, and it waits for a static
configuration stream over SPI, which contains all runtime parameters (it
has no notion of "default values").

Keeping a binary array for the configuration stream would have meant
that aspects such as the CPU port and the MAC speeds could have not been
configured easily, and would have been static and board-dependent.
Live-patching the binary array means recalculating the static config
table CRCs, which is not a fun process.

So we create an abstraction over the static config tables, using the
packing API, same as in Linux. The tables are kept as C structures, and
the binary configuration stream is constructed on-the-go, with CRC and
all.

All static config tables instantiated in this driver are mandatory.
The hardware reference manual can be found at:
https://www.nxp.com/docs/en/user-guide/UM10944.pdf

For tagging, a simplified version of tag_8021q from Linux is used. The
VLAN EtherType is the same (0xdadb) but since we don't want switching in
U-Boot, there is no reason to have a TX VLAN and an RX VLAN for each
port. We just need the RX VLANs to act as the unique pvid of each
front-panel port, to decode the switch port number. The RX VLAN is used
for both RX and TX.

The device tree bindings are the same as in Linux.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agonet: dsa: felix: configure the in-band autoneg property based on OF node info
Vladimir Oltean [Wed, 29 Sep 2021 15:04:40 +0000 (18:04 +0300)]
net: dsa: felix: configure the in-band autoneg property based on OF node info

Instead of trying to guess which operating modes need in-band
negotiation to be active and which ones don't, parse the available
information from the device tree. That will be correct in the cases we
can already guess, and more.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agonet: introduce a helper to determine whether to use in-band autoneg
Vladimir Oltean [Wed, 29 Sep 2021 15:04:39 +0000 (18:04 +0300)]
net: introduce a helper to determine whether to use in-band autoneg

Certain serial SERDES protocols like 1000base-x, 2500base-x, SGMII,
USXGMII can operate either in a mode where the PHY (be it on-board or
inside an SFP module) passes the link parameters (speed, duplex, pause)
to the MAC through in-band through control words standardized by IEEE
802.3 clause 37, or in a mode where the MAC must configure (force) its
link parameters based on information obtained out-of-band (MDIO reads,
guesswork etc).

In Linux, the OF node property named "managed" is parsed by the phylink
framework, and the convention is that if a driver uses phylink, then the
presence of this property means that in-band autoneg should be enabled,
otherwise it shouldn't.

To be compatible with the OF node bindings of drivers that use phylink
in Linux, introduce parsing support for this property in U-Boot too.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agonet: dsa: allow drivers to get the port OF node
Vladimir Oltean [Wed, 29 Sep 2021 15:04:38 +0000 (18:04 +0300)]
net: dsa: allow drivers to get the port OF node

In the current DSA switch driver API, only the udevice of the switch
(belonging to UCLASS_DSA) is exposed, as well as an "int port" argument.
So drivers do not have access to the udevice of individual ports
(belonging to UCLASS_ETH), one of the reasons being that not all ports
have an associated UCLASS_ETH udevice.

However, all DSA ports have an OF node, and in some cases the driver
needs a handle to it, for all ports including the CPU port. Example: the
following Linux per-port device tree property:

managed = "in-band-status";

states whether a port should operate with clause 37 in-band autoneg
enabled or not.

This patch exposes a function which can be called by individual drivers
as needed.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agoinclude: import if_vlan.h from Linux
Vladimir Oltean [Wed, 29 Sep 2021 15:04:37 +0000 (18:04 +0300)]
include: import if_vlan.h from Linux

This is needed for the VLAN header structure.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agonet: tsec: add support for promiscuous mode
Vladimir Oltean [Wed, 29 Sep 2021 15:04:36 +0000 (18:04 +0300)]
net: tsec: add support for promiscuous mode

The Freescale TSEC can be a DSA master, and the ports of the attached
DSA switch can have different MAC addresses compared to the TSEC.
Nonetheless, the TSEC must receive the packets on behalf of those switch
ports. Therefore, implement the promiscuous mode method to allow DSA to
set this.

Note that the init_registers() function called from eth_ops :: start
overwrites this setting. There is no reason why the RCTRL register
should be zero-initialized, so just stop clearing it so that the setting
we applied in eth_ops :: set_promisc sticks.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agonet: phy: mscc: add support for VSC8502 in dual RGMII mode
Vladimir Oltean [Mon, 27 Sep 2021 23:13:42 +0000 (02:13 +0300)]
net: phy: mscc: add support for VSC8502 in dual RGMII mode

The VSC8502 is a Microchip (formerly Microsemi, formerly Vitesse)
dual port, gigabit Ethernet copper PHY which supports the MII, GMII and
RGMII MAC-side interfaces.

Of these, I could only test RGMII, and my board needed RGMII delays to
be applied by software, so I am able to confirm that this patch handles
that properly.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agoMerge branch 'efi-2022-01' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sat, 20 Nov 2021 14:36:37 +0000 (09:36 -0500)]
Merge branch 'efi-2022-01' of https://source.denx.de/u-boot/custodians/u-boot-efi

Scripts:
* Update spelling.txt

LMB:
* remove extern keyword in lmb.h
* drop unused lmb_size_bytes()

Test:
* test truncation in snprintf()

Documentation:
* add include/lmb.h to HTML documentation

UEFI:
* reduce non-debug logging output for measured boot
* fix use after free in measured boot
* startup the tpm device when installing the protocol
* implement EFI_EVENT_GROUP_BEFORE_EXIT_BOOT_SERVICES
* record capsule result only if capsule is read

2 years agoefi_loader: startup the tpm device when installing the protocol
Ilias Apalodimas [Thu, 18 Nov 2021 08:13:42 +0000 (10:13 +0200)]
efi_loader: startup the tpm device when installing the protocol

Due to U-Boot's lazy binding mentality the TPM is probed but not properly
initialized.  The user can startup the device from the command line
e.g 'tpm2 startup TPM2_SU_CLEAR'.  However we can initialize the TPM during
the TCG protocol installation,  which is easier to use overall.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoefi_loader: fix FinalEvents table if an EFI app invoked GetEventLog
Ilias Apalodimas [Thu, 18 Nov 2021 07:03:39 +0000 (09:03 +0200)]
efi_loader: fix FinalEvents table if an EFI app invoked GetEventLog

As described in the TCG spec [1] in sections 7.1.1 and 7.1.2 the FinalEvent
table should include events after GetEventLog has been called.  This
currently works for us as long as the kernel is the only EFI application
calling that.  Specifically we only implement what's described in 7.1.1.

So refactor the code a bit and support EFI application(s) calling
GetEventLog.  Events will now be logged in both the EventLog and FinalEvent
table as long as ExitBootServices haven't been invoked.

[1] https://trustedcomputinggroup.org/wp-content/uploads/EFI-Protocol-Specification-rev13-160330final.pdf

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agoefi_loader: bump EFI_SPECIFICATION_VERSION to 2.9
Heinrich Schuchardt [Wed, 17 Nov 2021 17:55:59 +0000 (18:55 +0100)]
efi_loader: bump EFI_SPECIFICATION_VERSION to 2.9

We have implemented all what is new in UEFI specification 2.9 and relevant
for U-Boot.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoefi_selftest: unit test for EFI_GROUP_BEFORE_EXIT_BOOT_SERVICE
Heinrich Schuchardt [Wed, 17 Nov 2021 17:52:35 +0000 (18:52 +0100)]
efi_selftest: unit test for EFI_GROUP_BEFORE_EXIT_BOOT_SERVICE

Add a test for the EFI_GROUP_BEFORE_EXIT_BOOT_SERVICE event group.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoefi_loader: EFI_EVENT_GROUP_BEFORE_EXIT_BOOT_SERVICES
Heinrich Schuchardt [Tue, 16 Nov 2021 17:46:27 +0000 (18:46 +0100)]
efi_loader: EFI_EVENT_GROUP_BEFORE_EXIT_BOOT_SERVICES

Implement the EFI_EVENT_GROUP_BEFORE_EXIT_BOOT_SERVICES event group
handling.

Add the definition of EFI_EVENT_GROUP_AFTER_READY_TO_BOOT.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoefi_loader: capsule: Record capsule result only if capsule is read
Masami Hiramatsu [Fri, 12 Nov 2021 13:05:15 +0000 (22:05 +0900)]
efi_loader: capsule: Record capsule result only if capsule is read

Record capsule update result only if the capsule file is
successfully read, because the capsule GUID is not sure when
the file can not be read or the file is not a capsule.
Without this fix, if user puts a dummy (non-capsule) file
under (ESP)EFI/UpdateCapsule, U-Boot causes a synchronous
abort.

This also fixes use-after-free bug of the 'capsule' variable.

Fixes: c74cd8bd08d1 ("efi_loader: capsule: add capsule_on_disk support")
Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agoefi_loader: Reduce efi_tcg2 logging statement
Masahisa Kojima [Tue, 9 Nov 2021 11:35:53 +0000 (20:35 +0900)]
efi_loader: Reduce efi_tcg2 logging statement

log_info() is used for the debug level logging statement
which should use log_debug() instead. Convert it to reduce the
log output.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 years agoefi_loader: Sphinx comments in efi_api.h
Heinrich Schuchardt [Sat, 20 Nov 2021 08:28:54 +0000 (09:28 +0100)]
efi_loader: Sphinx comments in efi_api.h

Fix incorrect Sphinx comments in efi_api.h:

* add missing 'struct'
* correct indentation

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 years agoefi: add comment for efi_system_table and efi_configuration_table
Masahisa Kojima [Fri, 12 Nov 2021 07:24:27 +0000 (16:24 +0900)]
efi: add comment for efi_system_table and efi_configuration_table

This commit adds the comment for efi_system_table and
efi_configuration_table structure.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 years agodoc: fix typos in trace.rst
Heinrich Schuchardt [Tue, 16 Nov 2021 17:38:47 +0000 (18:38 +0100)]
doc: fix typos in trace.rst

Fix obvious typos. Use US spelling consistently.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoscripts: update spelling.txt from upstream Linux
Heinrich Schuchardt [Tue, 16 Nov 2021 17:56:43 +0000 (18:56 +0100)]
scripts: update spelling.txt from upstream Linux

This list is used by checkpatch.pl. The Linux v5.15 version has several
words that where mispelled in U-Boot too.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agotest: test truncation in snprintf()
Heinrich Schuchardt [Mon, 15 Nov 2021 18:06:55 +0000 (19:06 +0100)]
test: test truncation in snprintf()

Test that the return value of snprintf() is correct in the case of
truncation.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agolmb: fix typo 'commun'
Heinrich Schuchardt [Sun, 14 Nov 2021 08:38:53 +0000 (09:38 +0100)]
lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agolmb: drop unused lmb_size_bytes()
Heinrich Schuchardt [Sun, 14 Nov 2021 08:03:27 +0000 (09:03 +0100)]
lmb: drop unused lmb_size_bytes()

lmb_size_bytes() is unused.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agolmb: remove extern keyword in lmb.h
Heinrich Schuchardt [Sun, 14 Nov 2021 07:52:48 +0000 (08:52 +0100)]
lmb: remove extern keyword in lmb.h

The extern keyword is not needed in include/lmb.h to declare functions.
Remove it.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agodoc: add include/lmb.h to the HTML documentation
Heinrich Schuchardt [Sun, 14 Nov 2021 07:43:07 +0000 (08:43 +0100)]
doc: add include/lmb.h to the HTML documentation

Correct Sphinx style comments in include/lmb.h

Add the logical memory block API to the HTML documentation.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agolmb: remove lmb_is_nomap() from include
Heinrich Schuchardt [Sun, 14 Nov 2021 07:41:07 +0000 (08:41 +0100)]
lmb: remove lmb_is_nomap() from include

Defining static functions in includes should be avoided.
Function lmb_is_nomap() is only used in the unit test.
So move it to the unit test.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agoMerge tag 'u-boot-amlogic-20211119' of https://source.denx.de/u-boot/custodians/u...
Tom Rini [Fri, 19 Nov 2021 21:33:33 +0000 (16:33 -0500)]
Merge tag 'u-boot-amlogic-20211119' of https://source.denx.de/u-boot/custodians/u-boot-amlogic

- pinctrl: Correct the driver GPIO declaration
- meson64_android: handle errors on boot and run fastboot on boot failure

2 years agoMerge tag 'tpm-19112021' of https://source.denx.de/u-boot/custodians/u-boot-tpm
Tom Rini [Fri, 19 Nov 2021 21:33:23 +0000 (16:33 -0500)]
Merge tag 'tpm-19112021' of https://source.denx.de/u-boot/custodians/u-boot-tpm

TPM1.2 and Atmel fixes

# gpg verification failed.

2 years agoconfigs: meson64_android: add PANIC stage for SYSTEM fails
Neil Armstrong [Wed, 17 Nov 2021 11:04:11 +0000 (12:04 +0100)]
configs: meson64_android: add PANIC stage for SYSTEM fails

If bootloader was updated without running oem format, reboot will cause
boot loop because the SYSTEM stage fails.

Add a final PANIC stage running fastboot to permit recovery.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2 years agoconfigs: meson64_android: bypass other checks on run_fastboot=1
Neil Armstrong [Wed, 17 Nov 2021 11:04:10 +0000 (12:04 +0100)]
configs: meson64_android: bypass other checks on run_fastboot=1

This can lead to GPT and BCB errors even if fastboot was selected early
by usb rom boot and the eMMC is blank/invalid.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2 years agopinctrl: meson: Correct the driver GPIO declaration
Simon Glass [Sat, 13 Nov 2021 14:07:15 +0000 (07:07 -0700)]
pinctrl: meson: Correct the driver GPIO declaration

This should use the provided U_BOOT_DRIVER() macro so that the driver gets
added to the appropriate linker list. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 7c9dcfed50f ("pinctrl: meson: rework gx pmx function")
Reported-by: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com> on libretech-cc
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2 years agoRevert "nvme: Enable FUA"
Tom Rini [Fri, 19 Nov 2021 01:18:34 +0000 (20:18 -0500)]
Revert "nvme: Enable FUA"

Unaddressed review comments.

This reverts commit b6bfb8971dd039a60e1cff1895ab9be8be0915b3.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoRevert "nvme: Fix error in nvme_setup_prps"
Tom Rini [Fri, 19 Nov 2021 01:18:22 +0000 (20:18 -0500)]
Revert "nvme: Fix error in nvme_setup_prps"

Dependent commit has unaddressed review comments.

This reverts commit c4eef59faab6ae4ecb1beae6d4391b0889bc3ff3.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoMerge branch '2021-11-18-regression-fixes'
Tom Rini [Thu, 18 Nov 2021 23:25:19 +0000 (18:25 -0500)]
Merge branch '2021-11-18-regression-fixes'

- An assortment of fixes related to GD, GD_FLG_SKIP_RELOC, and the lmb
- Environment fix on synquacer developmentbox
- Fix for get_info is not valid in partition code

2 years agoarm64: Add missing GD_FLG_SKIP_RELOC handling
Marek Vasut [Sat, 13 Nov 2021 17:34:59 +0000 (18:34 +0100)]
arm64: Add missing GD_FLG_SKIP_RELOC handling

In case U-Boot enters relocation with GD_FLG_SKIP_RELOC, skip the
relocation. The code still has to set up new_gd pointer and new
stack pointer.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
2 years agolmb: Reserve U-Boot separately if relocation is disabled
Marek Vasut [Sat, 13 Nov 2021 17:34:37 +0000 (18:34 +0100)]
lmb: Reserve U-Boot separately if relocation is disabled

In case U-Boot starts with GD_FLG_SKIP_RELOC, the U-Boot code is
not relocated, however the stack and heap is at the end of DRAM
after relocation. Reserve a LMB area for the non-relocated U-Boot
code so it won't be overwritten.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
2 years agoboard_f: Copy GD to new GD even if relocation disabled
Marek Vasut [Sat, 13 Nov 2021 17:34:04 +0000 (18:34 +0100)]
board_f: Copy GD to new GD even if relocation disabled

Even if U-Boot has relocation disabled via GD_FLG_SKIP_RELOC , the
relocated stage of U-Boot still picks GD from new_gd location. The
U-Boot itself is not relocated, but GD might be, so copy the GD to
new GD location even if relocation is disabled.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Peng Fan <peng.fan@oss.nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
2 years agopart: return -ENOSYS when get_info not valid.
schspa [Wed, 20 Oct 2021 12:15:55 +0000 (20:15 +0800)]
part: return -ENOSYS when get_info not valid.

In some case, get_info() interface can be NULL, add this check to stop
from crash.

Signed-off-by: schspa <schspa@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoRevert "board: synquacer: developerbox: Don't set gd->env_addr to default_environment"
Masami Hiramatsu [Thu, 18 Nov 2021 05:45:25 +0000 (14:45 +0900)]
Revert "board: synquacer: developerbox: Don't set gd->env_addr to default_environment"

Without default setting of gd->env_addr, U-Boot will cause
a synchronous abort if the env-variables on the SPI flash is
broken or not saved corectly. Set gd->env_addr correctly.

This reverts commit 535870f3b0fb09ee9b2885409f05304111464643.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
2 years agoMerge branch '2021-11-17-assorted-driver-platform-updates' into next
Tom Rini [Thu, 18 Nov 2021 18:46:00 +0000 (13:46 -0500)]
Merge branch '2021-11-17-assorted-driver-platform-updates' into next

- NVMe updates
- TI AM64x related USB updates
- Update PCIe CAM support macros, add PCI CAM support as well
- AST2600, Apple (ARM64) pinctrl drivers
- ARM-specific DEBUG uart inconsistencies fixed
- MediaTek MMC improvement
- aspeed: Support secure boot chain with FIT image verification

2 years agoconfigs: am64x_evm_*_defconfig: Add configs to enable serdes for USB 3.0 support
Aswath Govindraju [Wed, 20 Oct 2021 15:39:13 +0000 (21:09 +0530)]
configs: am64x_evm_*_defconfig: Add configs to enable serdes for USB 3.0 support

Add configs to enable serdes for USB 3.0 support.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
2 years agoarm: dts: am642-sk: Add and Enable USB SuperSpeed Host Port in SPL
Kishon Vijay Abraham I [Wed, 20 Oct 2021 15:39:12 +0000 (21:09 +0530)]
arm: dts: am642-sk: Add and Enable USB SuperSpeed Host Port in SPL

Add and Enable USB SuperSpeed Host Port in SPL.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
2 years agousb: cdns3: cdns3-ti: Add compatible for AM64 SoC
Aswath Govindraju [Wed, 20 Oct 2021 15:32:02 +0000 (21:02 +0530)]
usb: cdns3: cdns3-ti: Add compatible for AM64 SoC

Add new compatible for AM64 SoC.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
2 years agophy: cadence: phy-cadence-torrent: Change the name of subnode searched
Aswath Govindraju [Wed, 20 Oct 2021 15:28:57 +0000 (20:58 +0530)]
phy: cadence: phy-cadence-torrent: Change the name of subnode searched

Search for "phy" in the subnode names, to syncup with kernel.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
2 years agonvme: Fix error in nvme_setup_prps
Jon Lin [Tue, 19 Oct 2021 02:40:54 +0000 (10:40 +0800)]
nvme: Fix error in nvme_setup_prps

Consulting to "NVM Express® Base Specification, revision 2.0".

If more PRP List pages are required, then the last entry of
the PRP List contains the Page Base Address of the next PRP
List page. The next PRP List page shall be memory page aligned.

Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
2 years agonvme: Enable FUA
Jon Lin [Tue, 19 Oct 2021 02:40:53 +0000 (10:40 +0800)]
nvme: Enable FUA

Most NVME devcies maintain data in internal cache for an uncertain
times, and u-boot has no method to force NVME to flush cache.
So this patch adds FUA to avoid data loss caused by power off after data
programming.

Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
Reviewed-by: Stefan Agner <stefan@agner.ch>
2 years agoRFC: arm: pci: Add PCI cam support to PCI-E ecam driver
Alistair Delva [Wed, 20 Oct 2021 21:31:34 +0000 (21:31 +0000)]
RFC: arm: pci: Add PCI cam support to PCI-E ecam driver

When booting U-Boot in crosvm, the virtual machine emulates a PCI cam
device, not the PCI-E 'ecam' device normally seen on e.g. QEMU. This
PCI device can be supported with only trivial changes to the ecam
driver.

Instead of adding a completely new driver which is identical besides the
initialization step, add support for the PCI version to the existing
driver.

Signed-off-by: Alistair Delva <adelva@google.com>
Cc: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Cc: Ram Muthiah <rammuthiah@google.com>
2 years agoconfigs: ast2600: Boot kernel FIT in DRAM
Chia-Wei Wang [Wed, 27 Oct 2021 06:17:35 +0000 (14:17 +0800)]
configs: ast2600: Boot kernel FIT in DRAM

AST2600 leverages the FIT hash/signature verification to fulfill
secure boot trust chain. To improve the performance and save SW
code size for those crypto operations, the two HW crypto engine,
HACE and ACRY, are enabled.

However, both of the engines can only access to data stored in
DRAM space. Therefore, we need to move the FIT image into DRAM
before the booting.

This patch update the CONFIG_BOOTCOMMAND to execute the pre-defined
ENV variable which consists of FIT image copy to memory and booting.

Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
2 years agoconfigs: aspeed: Make EXTRA_ENV_SETTINGS board specific
Chia-Wei Wang [Wed, 27 Oct 2021 06:17:34 +0000 (14:17 +0800)]
configs: aspeed: Make EXTRA_ENV_SETTINGS board specific

Move CONFIG_EXTRA_ENV_SETTINGS to board-specific
configuration headers.

Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
2 years agoconfigs: ast2600-evb: Enable SPL FIT support
Chia-Wei Wang [Wed, 27 Oct 2021 06:17:33 +0000 (14:17 +0800)]
configs: ast2600-evb: Enable SPL FIT support

Enable SPL FIT image load and verification support.
The HW accelerated SHA is also available with the
newly added support of the HACE HW hash engine.

The SPL thumb build is also enabled to keep the binary
less than 64KB to fit into the Aspeed secure boot design.

Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
Reviewed-by: Joel Stanley <joel@jms.id.au>
2 years agoast2600: spl: Locate load buffer in DRAM space
Chia-Wei Wang [Wed, 27 Oct 2021 06:17:32 +0000 (14:17 +0800)]
ast2600: spl: Locate load buffer in DRAM space

Return CONFIG_SYS_LOAD_ADDR pointing to DRAM space for
spl_get_load_buffer() to allow generic SPL image loading
code (e.g. FIT and Ymodem) to store data in DRAM.

Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
Reviewed-by: Joel Stanley <joel@jms.id.au>
2 years agoARM: dts: ast2600: Add ACRY to device tree
Chia-Wei Wang [Wed, 27 Oct 2021 06:17:31 +0000 (14:17 +0800)]
ARM: dts: ast2600: Add ACRY to device tree

Add ACRY DTS node and enable it for AST2600 EVB.

Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
Reviewed-by: Joel Stanley <joel@jms.id.au>
2 years agocrypto: aspeed: Add AST2600 ACRY support
Chia-Wei Wang [Wed, 27 Oct 2021 06:17:30 +0000 (14:17 +0800)]
crypto: aspeed: Add AST2600 ACRY support

ACRY is designed to accelerate ECC/RSA digital signature
generation and verification.

Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
2 years agoclk: ast2600: Add RSACLK control for ACRY
Chia-Wei Wang [Wed, 27 Oct 2021 06:17:29 +0000 (14:17 +0800)]
clk: ast2600: Add RSACLK control for ACRY

Add RSACLK enable for ACRY, the HW RSA/ECC crypto engine
of ASPEED AST2600 SoCs.

Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
2 years agoARM: dts: ast2600: Add HACE to device tree
Joel Stanley [Wed, 27 Oct 2021 06:17:28 +0000 (14:17 +0800)]
ARM: dts: ast2600: Add HACE to device tree

Add HACE DTS node and enable it for AST2600 EVB.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
2 years agocrypto: aspeed: Add AST2600 HACE support
Johnny Huang [Wed, 27 Oct 2021 06:17:27 +0000 (14:17 +0800)]
crypto: aspeed: Add AST2600 HACE support

Hash and Crypto Engine (HACE) is designed to accelerate the
throughput of hash data digest, and symmetric-key encryption.

Signed-off-by: Johnny Huang <johnny_huang@aspeedtech.com>
Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoclk: ast2600: Add YCLK control for HACE
Joel Stanley [Wed, 27 Oct 2021 06:17:26 +0000 (14:17 +0800)]
clk: ast2600: Add YCLK control for HACE

Add YCLK enable for HACE, the HW hash engine of
ASPEED AST2600 SoCs.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
2 years agoaspeed: ast2600: Enlarge SRAM size
Chia-Wei Wang [Wed, 27 Oct 2021 06:17:25 +0000 (14:17 +0800)]
aspeed: ast2600: Enlarge SRAM size

The AST2600 SRAM has been extended to 88KB since A1
chip revision. This patch updates the SRAM size to
offer more space for early stack/heap use.

Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
Reviewed-by: Joel Stanley <joel@jms.id.au>
2 years agoimage: fit: Fix parameter name for hash algorithm
Chia-Wei Wang [Wed, 27 Oct 2021 06:17:24 +0000 (14:17 +0800)]
image: fit: Fix parameter name for hash algorithm

Fix inconsistent function parameter name of the hash algorithm.

Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
Fixes: 92055e138f2 ("image: Drop if/elseif hash selection in calculate_hash()")
Reviewed-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agommc: mtk-sd: implement waiting for DAT0 line state
Julien Masson [Fri, 5 Nov 2021 13:34:14 +0000 (14:34 +0100)]
mmc: mtk-sd: implement waiting for DAT0 line state

With the recent changes on mmc driver, we saw that the boot is ~5 secs
longer compared to v2021.07 on mediatek platforms.

This regression is seen during mmc_init and caused by the following
patch [1].

Indeed since we did not support poll dat0, we fulfilled the condition
of [1] and a delay of 500 ms was added for every __mmc_switch call.

By adding the support of wait_dat0(), we now don't need to mdelay
during mmc_init anymore.

[1]: https://patchwork.ozlabs.org/project/uboot/patch/1629192034-64056-1-git-send-email-ye.li@nxp.com/

Signed-off-by: Julien Masson <jmasson@baylibre.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agork3399: Don't enable the debug UART if there is no driver
Simon Glass [Wed, 3 Nov 2021 13:16:08 +0000 (07:16 -0600)]
rk3399: Don't enable the debug UART if there is no driver

Some boards do not enable SPL_SERIAL so cannot use the debug UART. Add
this condition to the code and drop use of the preprocessor while we are
here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
2 years agoarm: qemu: Enable the debug UART
Simon Glass [Wed, 3 Nov 2021 13:16:07 +0000 (07:16 -0600)]
arm: qemu: Enable the debug UART

Enable this to permit early debugging. Due to the way qmeu works, the
input clock can be zero and things still work.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoarm: Init the debug UART
Simon Glass [Wed, 3 Nov 2021 13:16:06 +0000 (07:16 -0600)]
arm: Init the debug UART

At present we don't init the debug UART in the generic ARM code, but
instead leave it to individual machines to handle. This is not the
way it is supposed to work.

Add the required init to the crt files. This ensures that the UART
is available as early as possible and that the announcement appears
when it should, if enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoarm: Fix some inconsistent debug-UART CONFIG options
Simon Glass [Wed, 3 Nov 2021 13:16:05 +0000 (07:16 -0600)]
arm: Fix some inconsistent debug-UART CONFIG options

A few boards enable CONFIG_DEBUG_UART_BOARD_INIT but do not define the
required init function. Fix this by disabling the debug UART.

With snow the debug UART is enabled but the driver CONFIG is not. Fix this
too.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agopci: Add standard PCIe ECAM macros
Pali Rohár [Wed, 3 Nov 2021 00:01:05 +0000 (01:01 +0100)]
pci: Add standard PCIe ECAM macros

Lot of PCIe controllers are using ECAM addressing. So add common ECAM
macros into U-Boot's pci.h header file which can be suitable for most
PCI controller drivers.

Replace custom ECAM address macros in every PCI controller driver by new
ECAM macros from U-Boot's pci.h header file.

Similar macros are defined also in Linux kernel. There is a small
difference between Linux and these new U-Boot macros.

U-Boot's PCIE_ECAM_OFFSET() takes device and function numbers in separate
arguments. Linux's PCIE_ECAM_OFFSET() takes device and function numbers
encoded in one argument. The reason is that U-Boot's PCI_DEVFN() macro is
different than Linux's PCI_SLOT() macro. So having device and function
numbers in separate arguments makes code more straightforward.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agopinctrl: Add Apple pinctrl driver
Mark Kettenis [Tue, 2 Nov 2021 17:21:57 +0000 (18:21 +0100)]
pinctrl: Add Apple pinctrl driver

This driver supports both pin muxing and GPIO support for the
pin control logic found on Apple SoCs.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
2 years agoaspeed: AST2600 Pinctrl Driver
Ryan Chen [Tue, 2 Nov 2021 02:17:52 +0000 (10:17 +0800)]
aspeed: AST2600 Pinctrl Driver

This driver uses Pinctrl framework and is compatible with the Linux
driver for AST2600.

Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com>
Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
2 years agodrivers: tpm: atmel_twi: fix printf specifier compile warning
Mathew McBride [Thu, 11 Nov 2021 04:06:31 +0000 (04:06 +0000)]
drivers: tpm: atmel_twi: fix printf specifier compile warning

%d was being used as the specifier for size_t, leading to a
compiler warning

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agodrivers: tpm: atmel_twi: implement get_desc operation
Mathew McBride [Thu, 11 Nov 2021 04:06:30 +0000 (04:06 +0000)]
drivers: tpm: atmel_twi: implement get_desc operation

Without get_desc, the tpm command will not provide a
description of the device in 'tpm device' or 'tpm info'.

Due to the characteristics of the Atmel TPM it isn't
possible to determine certain attributes (e.g open/close
status) without using the TPM stack (compare Infineon
and ST TPM drivers), so just print out the chip model
and udevice name as the identifier.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agodrivers: tpm: atmel_twi: do not use an offset byte
Mathew McBride [Thu, 11 Nov 2021 04:06:29 +0000 (04:06 +0000)]
drivers: tpm: atmel_twi: do not use an offset byte

This driver was broken due to an empty offset byte being prepended
at the start of every transmission.

The hardware does not mimic an EEPROM device with registers so
an offset byte is not required.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agodrivers: tpm: atmel_twi: drop non-DM_I2C compatibility
Mathew McBride [Thu, 11 Nov 2021 04:06:28 +0000 (04:06 +0000)]
drivers: tpm: atmel_twi: drop non-DM_I2C compatibility

There are no users of this driver without DM_I2C

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agocmd: tpm-v1: fix load_key_by_sha1 compile errors
Mathew McBride [Thu, 11 Nov 2021 04:06:27 +0000 (04:06 +0000)]
cmd: tpm-v1: fix load_key_by_sha1 compile errors

This command is not compiled by default and has not been updated alongside
changes to the tpmv1 API, such as passing the TPM udevice to the relevant
functions.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agocmd: tpm-v1: fix compile error in TPMv1 list resources command
Mathew McBride [Thu, 11 Nov 2021 04:06:26 +0000 (04:06 +0000)]
cmd: tpm-v1: fix compile error in TPMv1 list resources command

This command is not compiled by default and was not
updated to pass the udevice to tpm_get_capability.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agoMerge branch '2021-11-16-env-rework' into next
Tom Rini [Wed, 17 Nov 2021 01:55:12 +0000 (20:55 -0500)]
Merge branch '2021-11-16-env-rework' into next

To quote Simon:

One barrier to completing the 7-year-long Kconfig migration is that
the default environment is implemented using ad-hoc CONFIG options.
At present U-Boot environment variables, and thus scripts, are defined
by CONFIG_EXTRA_ENV_SETTINGS.

It is not really feasible to move the environment to Kconfig as it is
hundreds of lines of text in some cases.

Even considering the current situation, it is painful to add large
amounts of text to the config-header file and dealing with quoting and
newlines is harder than it should be. It would be better if we could just
type the script into a text file and have it included by U-Boot.

This is already supported by the CONFIG_USE_DEFAULT_ENV_FILE feature. But
that does not support use of CONFIG options or comments, so is best suited
for use by other build systems wanting to define the U-Boot environment.

Add a feature that brings in a .env file associated with the board
config, if present. To use it, create a file board/<vendor>/<board>.env or
use CONFIG_ENV_SOURCE_FILE to set a filename.

The environment variables should be of the form "var=value". Values can
extend to multiple lines. This series converts the existing environment
documentation to rST and updates it to explain how to use this.

3 years agobootm: Tidy up use of autostart env var
Simon Glass [Fri, 22 Oct 2021 03:08:52 +0000 (21:08 -0600)]
bootm: Tidy up use of autostart env var

This has different semantics in different places. Go with the bootm method
and put it in a common function so that the behaviour is consistent in
U-Boot. Update the docs.

To be clear, this changes the way that 'bootelf' and standalone boot
work. Before, if autostart was set to "fred" or "YES", for example, they
would consider that a "yes". This may change behaviour for some boards,
but the only in-tree boards which mention autostart use "no" to disable
it, which will still work.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Wolfgang Denk <wd@denx.de>
3 years agosandbox: Update the test MAC/IP addresses
Simon Glass [Fri, 22 Oct 2021 03:08:51 +0000 (21:08 -0600)]
sandbox: Update the test MAC/IP addresses

These conflict with real-word addresses. Use locally administered
MAC addresses and a suitable IPv4 address from 192.0.2.0/24
(TEST-NET-1).

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Alexander Dahl <ada@thorsis.com>