platform/kernel/u-boot.git
2 years agolib/vsprintf.c: implement printf() in terms of vprintf()
Rasmus Villemoes [Thu, 27 May 2021 22:20:44 +0000 (00:20 +0200)]
lib/vsprintf.c: implement printf() in terms of vprintf()

This saves some code, both in terms of #LOC and .text size, and it is
also the normal convention that foo(...) is implemented in terms of
vfoo().

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2 years agoclk: Detect failure to set defaults
Simon Glass [Fri, 14 May 2021 01:39:31 +0000 (19:39 -0600)]
clk: Detect failure to set defaults

When the default clocks cannot be set, the clock is silently probed and
the error is ignored. This is incorrect, since having the clocks at the
correct speed may be important for operation of the system.

Fix it by checking the return code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agosandbox: Silence coverity warning in state_read_file()
Simon Glass [Fri, 14 May 2021 01:39:30 +0000 (19:39 -0600)]
sandbox: Silence coverity warning in state_read_file()

In this case the value seems save to pass to os_free(). Add a comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 165109)
2 years agotpm: Check outgoing command size
Simon Glass [Fri, 14 May 2021 01:39:29 +0000 (19:39 -0600)]
tpm: Check outgoing command size

In tpm_sendrecv_command() the command buffer is passed in. If a mistake is
somehow made in setting this up, the size could be out of range. Add a
sanity check for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 331152)
2 years agopinctrl: Avoid coverity warning when checking width
Simon Glass [Fri, 14 May 2021 01:39:28 +0000 (19:39 -0600)]
pinctrl: Avoid coverity warning when checking width

The width is set up in single_of_to_plat() and can only have three values,
all of which result in a non-zero divisor. Add a comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 331154)
2 years agocbfs: Check offset range when reading a file
Simon Glass [Fri, 14 May 2021 01:39:27 +0000 (19:39 -0600)]
cbfs: Check offset range when reading a file

Add a check that the offset is within the allowed range.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 331155)
2 years agosandbox: cros_ec: Update error handling when reading matrix
Simon Glass [Fri, 14 May 2021 01:39:26 +0000 (19:39 -0600)]
sandbox: cros_ec: Update error handling when reading matrix

At present the return value of ofnode_get_property() is not checked, which
causes a coverity warning. While we are here, use logging for the errors.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 331157)
2 years agodm: core: Check uclass_get() return value when dumping
Simon Glass [Fri, 14 May 2021 01:39:24 +0000 (19:39 -0600)]
dm: core: Check uclass_get() return value when dumping

Update dm_dump_drivers() to use the return value from uclass_get() to
check the validity of uc. This is equivalent and should be more attractive
to Coverity.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 316601)
2 years agoreset: Avoid a warning in devm_regmap_init()
Simon Glass [Fri, 14 May 2021 01:39:22 +0000 (19:39 -0600)]
reset: Avoid a warning in devm_regmap_init()

The devres_alloc() function is intended to avoid the need for freeing
memory, although in practice it may not be enabled, thus leading to a true
leak.

Nevertheless this is intended. Add a comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 312951)
2 years agoreset: Avoid a warning in devm_reset_bulk_get_by_node()
Simon Glass [Fri, 14 May 2021 01:39:21 +0000 (19:39 -0600)]
reset: Avoid a warning in devm_reset_bulk_get_by_node()

The devres_alloc() function is intended to avoid the need for freeing
memory, although in practice it may not be enabled, thus leading to a true
leak.

Nevertheless this is intended. Add a comment to explain this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 312952)
2 years agotools: Avoid showing return value of clock_gettime()
Simon Glass [Fri, 14 May 2021 01:39:20 +0000 (19:39 -0600)]
tools: Avoid showing return value of clock_gettime()

This value is either 0 for success or -1 for error. Coverity reports that
"ret" is passed to a parameter that cannot be negative, pointing to the
condition 'if (ret < 0)'.

Adjust it to just check for non-zero and avoid showing -1 in the error
message, which is pointless. Perhaps these changes will molify Coverity.

Reported-by: Coverity (CID: 312956)
Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agotest: Rename final check in setexpr_test_backref()
Simon Glass [Fri, 14 May 2021 01:39:19 +0000 (19:39 -0600)]
test: Rename final check in setexpr_test_backref()

The bug in setexpr is fixed now, so this test can be enabled.

Reported-by: Coverity (CID: 316346)
Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agovideo: Check return value in pwm_backlight_of_to_plat()
Simon Glass [Fri, 14 May 2021 01:39:18 +0000 (19:39 -0600)]
video: Check return value in pwm_backlight_of_to_plat()

This cannot actually fail, but check the value anyway to keep coverity
happy.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 316351)
2 years agosandbox: net: Ensure host name is always a valid string
Simon Glass [Fri, 14 May 2021 01:39:17 +0000 (19:39 -0600)]
sandbox: net: Ensure host name is always a valid string

At present if ifname is exactly IFNAMSIZ characters then it will result
in an unterminated string. Fix this by using strlcpy() instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 316358)
Acked-by: Ramon Fried <rfried.dev@gmail.com>
2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-x86
Tom Rini [Thu, 15 Jul 2021 15:06:24 +0000 (11:06 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-x86

- x86: various improvements made in getting Chromium OS verified boot
  running on top of coreboot, booting into U-Boot.

2 years agoNokia RX-51: Add check for /lib/ld-linux.so.2 in test script
Pali Rohár [Fri, 18 Jun 2021 13:31:08 +0000 (15:31 +0200)]
Nokia RX-51: Add check for /lib/ld-linux.so.2 in test script

Unfortunately for testing is required qflasher which works only in 32-bit
x86 mode. Apparently 64-bit x86 Azure CI has no problems as it has
preinstalled 32-bit libraries and can execute also 32-bit x86 executables.

This change just show human readable output why nokia_rx51_test.sh test
script fails.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210618133108.32497-1-pali@kernel.org
2 years agoNokia RX-51: Load bootmenu also from uSD card
Pali Rohár [Fri, 18 Jun 2021 13:27:04 +0000 (15:27 +0200)]
Nokia RX-51: Load bootmenu also from uSD card

By default bootmenu is loaded only from eMMC. After this change U-Boot
first tries to load bootmenu from uSD card and if it fails then fallback to
eMMC. People want to boot alternative OS from removable uSD without need to
modify eMMC content. So this backward compatible change allows it.

Part of this change is also optimization of trymmc* macros so they can be
used in preboot macro for loading bootmenu.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210618132704.32066-2-pali@kernel.org
2 years agoNokia RX-51: Add support for booting kernel in zImage format
Pali Rohár [Fri, 18 Jun 2021 13:27:03 +0000 (15:27 +0200)]
Nokia RX-51: Add support for booting kernel in zImage format

Enable U-Boot bootz command and update env scripts to try loading also
zImage file and to try booting via bootz command.

Update also lowlevel_init.S code for checking validity of zImage magic to
correctly relocate kernel in zImage format.

This change allows U-Boot to directly boot Linux kernel without need for
converting kernel image into U-Boot uImage format.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210618132704.32066-1-pali@kernel.org
2 years agoconfigs: j7200_evm_r5_defconfig: Enable AVS, PMIC and dependent configs
Gowtham Tammana [Wed, 14 Jul 2021 20:53:00 +0000 (15:53 -0500)]
configs: j7200_evm_r5_defconfig: Enable AVS, PMIC and dependent configs

Enable AVS, PMIC and dependent configs.

Signed-off-by: Gowtham Tammana <g-tammana@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210714205300.17424-6-g-tammana@ti.com
2 years agoarm/dts: k3-j7200-r5-common: Hook buck1_reg to vtm supply
Gowtham Tammana [Wed, 14 Jul 2021 20:52:59 +0000 (15:52 -0500)]
arm/dts: k3-j7200-r5-common: Hook buck1_reg to vtm supply

Hook buck1_reg to vtm avs supply.

Signed-off-by: Gowtham Tammana <g-tammana@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210714205300.17424-5-g-tammana@ti.com
2 years agoarm/dts: k3-j7200-r5-common: Add VTM node
Gowtham Tammana [Wed, 14 Jul 2021 20:52:58 +0000 (15:52 -0500)]
arm/dts: k3-j7200-r5-common: Add VTM node

Add voltage and thermal management (VTM) node. The efuse values for the
OPPs are stored under the VTM, and is needed for AVS class 0 support.

Signed-off-by: Gowtham Tammana <g-tammana@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210714205300.17424-4-g-tammana@ti.com
2 years agoarm/dts: k3-j7200-r5-common: Add pmic lp876441 node
Gowtham Tammana [Wed, 14 Jul 2021 20:52:57 +0000 (15:52 -0500)]
arm/dts: k3-j7200-r5-common: Add pmic lp876441 node

Add pmic lp876411 node needed for CPU AVS support.

Signed-off-by: Gowtham Tammana <g-tammana@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210714205300.17424-3-g-tammana@ti.com
2 years agopower: pmic: tps65941: Add compatible for LP876441
Gowtham Tammana [Wed, 14 Jul 2021 20:52:56 +0000 (15:52 -0500)]
power: pmic: tps65941: Add compatible for LP876441

TI J7200 EVM has lp876441 pmic that is similar to tps65941. Add support
for same with existing driver with new compatible.

Signed-off-by: Gowtham Tammana <g-tammana@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Link: https://lore.kernel.org/r/20210714205300.17424-2-g-tammana@ti.com
2 years agoconfigs: am65x_evm: Switch envboot out for distro_bootcmd
Tom Rini [Tue, 13 Jul 2021 14:11:39 +0000 (10:11 -0400)]
configs: am65x_evm: Switch envboot out for distro_bootcmd

Swap out the TI-centric "envboot" logic for the generic distro_bootcmd
logic for the bootcmd we run before trying to do something more complex
involving additional firmware, etc.

Cc: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210713141139.15183-1-trini@konsulko.com
2 years agoarm: omap4: Disable USB_TTY and related options
Tom Rini [Thu, 8 Jul 2021 01:43:48 +0000 (21:43 -0400)]
arm: omap4: Disable USB_TTY and related options

The usbtty functionality is not currently used on these two platforms,
disable it.

Cc: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210708014348.4010-1-trini@konsulko.com
2 years agoconfigs: j721e_evm: Switch envboot out for distro_bootcmd
Tom Rini [Thu, 1 Jul 2021 14:27:43 +0000 (10:27 -0400)]
configs: j721e_evm: Switch envboot out for distro_bootcmd

Swap out the TI-centric "envboot" logic for the generic distro_bootcmd
logic for the bootcmd we run before trying to do something more complex
involving additional firmware, etc.

Cc: Lokesh Vutla <lokeshvutla@ti.com> (maintainer:J721E BOARD)
Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210701142743.26190-1-trini@konsulko.com
2 years agoti: omap5: Switch to generic distro boot for non-Android cases
Tom Rini [Thu, 1 Jul 2021 13:26:12 +0000 (09:26 -0400)]
ti: omap5: Switch to generic distro boot for non-Android cases

Remove the environment support for various legacy boot methods.  With
this, we will now default to booting any distribution that follows the
generic distro boot framework and no longer attempt to boot various
legacy (to this SoC) scripts/etc.  Note that if we do not find anything
here we will continue to try and Android methods and will start by
trying fastboot.

Cc: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210701132612.7559-3-trini@konsulko.com
2 years agoarm: ti: environment: Move <environment/ti/boot.h> in to <configs/ti_omap5_common.h>
Tom Rini [Thu, 1 Jul 2021 13:26:11 +0000 (09:26 -0400)]
arm: ti: environment: Move <environment/ti/boot.h> in to <configs/ti_omap5_common.h>

This include file is only used by ti_omap5_common.h.  Further, the move
is towards using the generic distro boot framework and not this set of
macros.  Start by moving all of the contents in directly to where they
are used.

Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210701132612.7559-2-trini@konsulko.com
2 years agoti: am43xx_evm: Switch to DISTRO_BOOT only
Tom Rini [Thu, 1 Jul 2021 13:26:10 +0000 (09:26 -0400)]
ti: am43xx_evm: Switch to DISTRO_BOOT only

Remove the environment support for various legacy boot methods.  With
this, we will now default to booting any distribution that follows the
generic distro boot framework and no longer attempt to boot various
legacy (to this SoC) scripts/etc.

Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210701132612.7559-1-trini@konsulko.com
2 years agoconfigs: am3517_evm: Fix boot hang
Adam Ford [Sat, 26 Jun 2021 13:42:58 +0000 (08:42 -0500)]
configs: am3517_evm: Fix boot hang

SPL is really tight on space, so decrease a little memory that we
allocate in order to fix boot hang.

Signed-off-by: Adam Ford <aford173@gmail.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Tested-by: Derald D. Woods <woods.technical@gmail.com>
Link: https://lore.kernel.org/r/20210626134258.601331-1-aford173@gmail.com
2 years agoarm: omap3: Make secure_unlock_mem() static
Adam Ford [Fri, 25 Jun 2021 19:23:08 +0000 (14:23 -0500)]
arm: omap3: Make secure_unlock_mem() static

secure_unlock_mem() is only used in one file, so make it static
in that file.

Signed-off-by: Adam Ford <aford173@gmail.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210625192308.277136-4-aford173@gmail.com
2 years agoarm: omap3: Make secureworld_exit() static
Adam Ford [Fri, 25 Jun 2021 19:23:07 +0000 (14:23 -0500)]
arm: omap3: Make secureworld_exit() static

secureworld_exit() is only used in one file, so make it static
to that file and remove it from sys_proto.h. This
may help with some further optimization in the future.

Signed-off-by: Adam Ford <aford173@gmail.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210625192308.277136-3-aford173@gmail.com
2 years agoarm: omap3: Make try_unlock_memory() static
Adam Ford [Fri, 25 Jun 2021 19:23:06 +0000 (14:23 -0500)]
arm: omap3: Make try_unlock_memory() static

try_unlock_memory() is only used in one file, so make it static
in that file,remove it from the sys_proto header file, and relocate
it into the #ifdef section that call it. This will make it only built
under the conditions when it is called, and it may help with some
further optimization in the future.

Signed-off-by: Adam Ford <aford173@gmail.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210625192308.277136-2-aford173@gmail.com
2 years agoconfigs: omap3x_logic: Fix boot hang by reducing SYS_MALLOC_F_LEN
Adam Ford [Fri, 25 Jun 2021 18:57:17 +0000 (13:57 -0500)]
configs: omap3x_logic: Fix boot hang by reducing SYS_MALLOC_F_LEN

The AM3517 uses SYS_MALLOC_F_LEN of size 0x3000, but the rest of
the OMAP3 boards from LogicPD / BeaconEmbedded use 0x4000, but
they don't boot SPL.

Reduce the malloc size to restore booting.

Signed-off-by: Adam Ford <aford173@gmail.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210625185717.243211-1-aford173@gmail.com
2 years agoarm: mach-k3: am642_init: Add missing ddr guard
Gowtham Tammana [Thu, 24 Jun 2021 17:16:14 +0000 (12:16 -0500)]
arm: mach-k3: am642_init: Add missing ddr guard

The `struct udevice *` reference is needed for either of the
K3_LOAD_SYSFW, K3_AM64_DDRSS config guards. Adding the missing
K3_AM64_DDRSS guard.

Signed-off-by: Gowtham Tammana <g-tammana@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210624171614.14244-1-g-tammana@ti.com
2 years agoconfigs: am65x_evm_a53: Enable PRUSS remoteproc
Lokesh Vutla [Tue, 22 Jun 2021 06:34:31 +0000 (12:04 +0530)]
configs: am65x_evm_a53: Enable PRUSS remoteproc

Enable PRUSS remoteproc driver for AM65

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210622063431.3151-6-lokeshvutla@ti.com
2 years agoarm: dts: ti: k3-am65-main: Add ICSSG nodes
Lokesh Vutla [Tue, 22 Jun 2021 06:34:30 +0000 (12:04 +0530)]
arm: dts: ti: k3-am65-main: Add ICSSG nodes

Add the DT nodes for the ICSSG0, ICSSG1 and ICSSG2 processor subsystems
that are present on the K3 AM65x SoCs. The three ICSSGs are identical
to each other for the most part, with the ICSSG2 supporting slightly
enhanced features for supporting SGMII PRU Ethernet. Each ICSSG instance
is represented by a PRUSS subsystem node. These nodes are enabled by
default.

DT nodes are fetch from Linux 5.13 Kernel.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210622063431.3151-5-lokeshvutla@ti.com
2 years agoarm: dts: k3-am654-base-board: Add r5 specific u-boot dtsi
Lokesh Vutla [Tue, 22 Jun 2021 06:34:29 +0000 (12:04 +0530)]
arm: dts: k3-am654-base-board: Add r5 specific u-boot dtsi

So far all the u-boot specific properties for both r5 and a53 are
placed in k3-am654-base-board-u-boot.dtsi. But there are few a53
nodes that should be updated but doesn't belong to r5. So create a
separate r5 specific u-boot dtsi.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210622063431.3151-4-lokeshvutla@ti.com
2 years agoremoteproc: pru: Add support for various PRU cores on K3 AM65x SoCs
Keerthy [Tue, 22 Jun 2021 06:34:28 +0000 (12:04 +0530)]
remoteproc: pru: Add support for various PRU cores on K3 AM65x SoCs

The K3 AM65x family of SoCs have the next generation of the PRU-ICSS
processor subsystem, commonly referred to as ICSSG. Each ICSSG processor
subsystem on AM65x SR1.0 contains two primary PRU cores and two new
auxiliary PRU cores called RTUs. The AM65x SR2.0 SoCs have a revised
ICSSG IP that is based off the subsequent IP revision used on J721E
SoCs. This IP instance has two new custom auxiliary PRU cores called
Transmit PRUs (Tx_PRUs) in addition to the existing PRUs and RTUs.

Each RTU and Tx_PRU cores have their own dedicated IRAM (smaller than
a PRU), Control and debug feature sets, but is different in terms of
sub-modules integrated around it and does not have the full capabilities
associated with a PRU core. The RTU core is typically used to aid a
PRU core in accelerating data transfers, while the Tx_PRU cores is
normally used to control the TX L2 FIFO if enabled in Ethernet
applications. Both can also be used to run independent applications.
The RTU and Tx_PRU cores though share the same Data RAMs as the PRU
cores, so the memories have to be partitioned carefully between different
applications. The new cores also support a new sub-module called Task
Manager to support two different context thread executions.
The driver currently supports the AM65xx SoC

Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210622063431.3151-3-lokeshvutla@ti.com
2 years agosoc: ti: pruss: Add a platform driver for PRUSS in TI SoCs
Keerthy [Tue, 22 Jun 2021 06:34:27 +0000 (12:04 +0530)]
soc: ti: pruss: Add a platform driver for PRUSS in TI SoCs

The Programmable Real-Time Unit - Industrial Communication
Subsystem (PRU-ICSS) is present of various TI SoCs such as
AM335x or AM437x or the AM654x family. Each SoC can have
one or more PRUSS instances that may or may not be identical.

The PRUSS consists of dual 32-bit RISC cores called the
Programmable Real-Time Units (PRUs), some shared, data and
instruction memories, some internal peripheral modules, and
an interrupt controller. The programmable nature of the PRUs
provide flexibility to implement custom peripheral interfaces,
fast real-time responses, or specialized data handling.

Add support for pruss driver. Currently am654x family
is supported.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210622063431.3151-2-lokeshvutla@ti.com
2 years agoarm: dts: k3-am64-main: Reserve OCMRAM for DMSC-lite and secure proxy communication
Aswath Govindraju [Wed, 16 Jun 2021 16:38:21 +0000 (22:08 +0530)]
arm: dts: k3-am64-main: Reserve OCMRAM for DMSC-lite and secure proxy communication

The final 128KB in SRAM is reserved by default for DMSC-lite code and
secure proxy communication buffer. The memory region used for DMSC-lite
code can be optionally freed up by secure firmware API[1]. However, the
buffer for secure proxy communication is not configurable. This default
hardware configuration is unique for AM64.

Therefore, indicate the area reserved for DMSC-lite code and secure proxy
communication buffer in the oc_sram device tree node.

[1] - http://downloads.ti.com/tisci/esd/latest/6_topic_user_guides/security_handover.html#triggering-security-handover

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Acked-by: Suman Anna <s-anna@ti.com>
Link: https://lore.kernel.org/r/20210616163821.20457-3-a-govindraju@ti.com
2 years agoconfigs: am64x_evm_a53_defconfig: Move TF-A load address to 0x701c0000
Aswath Govindraju [Wed, 16 Jun 2021 16:38:20 +0000 (22:08 +0530)]
configs: am64x_evm_a53_defconfig: Move TF-A load address to 0x701c0000

Earlier, the region 0x701c0000 to 0x701dffff was firewalled off because of
a bug in SYSFW. In the v2021.05 release of SYSFW this bug has been fixed
and this region can now be used for other allocations.

Therefore, move TF-A's load address to 0x701c0000 and update its location
in the device tree node. Also, increase the size allocated for TF-A to
account for future expansions.

Fixes: defd62ca137b ("arm: dts: k3-am64-main: Update the location of ATF in SRAM and increase its max size")
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Suman Anna <s-anna@ti.com>
Link: https://lore.kernel.org/r/20210616163821.20457-2-a-govindraju@ti.com
2 years agoti: am335x_evm: Switch to DISTRO_BOOT only
Tom Rini [Thu, 10 Jun 2021 23:01:47 +0000 (19:01 -0400)]
ti: am335x_evm: Switch to DISTRO_BOOT only

Remove the environment support for various legacy boot methods.  With
this, we will now default to booting any distribution that follows the
generic distro boot framework and no longer attempt to boot various
legacy (to this SoC) scripts/etc.

Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210610230147.22475-1-trini@konsulko.com
2 years agoconfigs: am335x_guardian: add register maps support
Gireesh Hiremath [Fri, 11 Jun 2021 16:13:50 +0000 (16:13 +0000)]
configs: am335x_guardian: add register maps support

add support to direct memory access of hardware peripherals registers

Signed-off-by: Gireesh Hiremath <Gireesh.Hiremath@in.bosch.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210611161350.2141-19-Gireesh.Hiremath@in.bosch.com
2 years agoconfigs: am335x_guardian: Enable bootcount nvmem support
Gireesh Hiremath [Fri, 11 Jun 2021 16:13:49 +0000 (16:13 +0000)]
configs: am335x_guardian: Enable bootcount nvmem support

include bootcount nvmem support

Signed-off-by: Gireesh Hiremath <Gireesh.Hiremath@in.bosch.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210611161350.2141-18-Gireesh.Hiremath@in.bosch.com
2 years agoam335x, guardian: software update available status is stored in AM3352 RTC scracth...
Gireesh Hiremath [Fri, 11 Jun 2021 16:13:48 +0000 (16:13 +0000)]
am335x, guardian: software update available status is stored in AM3352 RTC scracth register

RTC second scratch register[32-bit]:
  -zero byte hold boot count value
  -first byte hold update available state
  -second byte hold version
  -third byte hold magic number

Signed-off-by: Gireesh Hiremath <Gireesh.Hiremath@in.bosch.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210611161350.2141-17-Gireesh.Hiremath@in.bosch.com
Gbp-Pq: Topic apertis/guardian
Gbp-Pq: Name am335x-guardian-software-update-available-status-is-store.patch

2 years agoam335x, guardian: Enable panel driver Himax HX8238D
Gireesh Hiremath [Fri, 11 Jun 2021 16:13:47 +0000 (16:13 +0000)]
am335x, guardian: Enable panel driver Himax HX8238D

- Enable lcd controller
- Display splash screen

Signed-off-by: Gireesh Hiremath <Gireesh.Hiremath@in.bosch.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210611161350.2141-16-Gireesh.Hiremath@in.bosch.com
2 years agodrivers: video: hx8238 fix build bug
Gireesh Hiremath [Fri, 11 Jun 2021 16:13:46 +0000 (16:13 +0000)]
drivers: video: hx8238 fix build bug

update panel driver hx8238
fix build bug

Signed-off-by: Gireesh Hiremath <Gireesh.Hiremath@in.bosch.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210611161350.2141-15-Gireesh.Hiremath@in.bosch.com
2 years agoconfigs: am335x_guardian: Enable display config
Gireesh Hiremath [Fri, 11 Jun 2021 16:13:45 +0000 (16:13 +0000)]
configs: am335x_guardian: Enable display config

-Enable configuration for display driver
-Disable support for SPL GPIO, CMD LED & SPL GPIO

Signed-off-by: Gireesh Hiremath <Gireesh.Hiremath@in.bosch.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210611161350.2141-14-Gireesh.Hiremath@in.bosch.com
2 years agoam335x, guardian: Enable backlight
Gireesh Hiremath [Fri, 11 Jun 2021 16:13:44 +0000 (16:13 +0000)]
am335x, guardian: Enable backlight

Enable backlight, set brightness value and dimming frequency

Signed-off-by: Gireesh Hiremath <Gireesh.Hiremath@in.bosch.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210611161350.2141-13-Gireesh.Hiremath@in.bosch.com
2 years agoam335x, guardian: update swi logic
Gireesh Hiremath [Fri, 11 Jun 2021 16:13:43 +0000 (16:13 +0000)]
am335x, guardian: update swi logic

read boot mode gpio and set the swi status

Signed-off-by: Gireesh Hiremath <Gireesh.Hiremath@in.bosch.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210611161350.2141-12-Gireesh.Hiremath@in.bosch.com
2 years agoconfigs: am335x_guardian: disable spl command
Gireesh Hiremath [Fri, 11 Jun 2021 16:13:42 +0000 (16:13 +0000)]
configs: am335x_guardian: disable spl command

- disable support for spl command

Signed-off-by: Gireesh Hiremath <Gireesh.Hiremath@in.bosch.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210611161350.2141-11-Gireesh.Hiremath@in.bosch.com
2 years agoconfigs: am335x_guardian: set boot delay
Gireesh Hiremath [Fri, 11 Jun 2021 16:13:41 +0000 (16:13 +0000)]
configs: am335x_guardian: set boot delay

- set boot delay to zero, to increase boot speed

Signed-off-by: Gireesh Hiremath <Gireesh.Hiremath@in.bosch.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210611161350.2141-10-Gireesh.Hiremath@in.bosch.com
2 years agoam335x, guardian: code cleanup and boot optimization
Gireesh Hiremath [Fri, 11 Jun 2021 16:13:40 +0000 (16:13 +0000)]
am335x, guardian: code cleanup and boot optimization

- remove redundant headers and boot modes from board file

Signed-off-by: Gireesh Hiremath <Gireesh.Hiremath@in.bosch.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210611161350.2141-9-Gireesh.Hiremath@in.bosch.com
2 years agoam335x, guardian: set environment variable autoload to no
Gireesh Hiremath [Fri, 11 Jun 2021 16:13:39 +0000 (16:13 +0000)]
am335x, guardian: set environment variable autoload to no

autoload: if set to "no" then rarpb, bootp or dhcp commands will
just perform a configuration lookup from the BOOTP / DHCP server,
but not try to load any image using TFTP

Signed-off-by: Gireesh Hiremath <Gireesh.Hiremath@in.bosch.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210611161350.2141-8-Gireesh.Hiremath@in.bosch.com
2 years agoam335x, guardian: Update pinmux configuration
Moses Christopher [Fri, 11 Jun 2021 16:13:38 +0000 (16:13 +0000)]
am335x, guardian: Update pinmux configuration

pinmux update for guardian board
- control ASP Board Power: GPIO, on/off ASP Board Power
- control Coincell Voltage Measurement: GPIO, enable/disable
  ADC measurements
- powerOff Device GPIO-PowerOff, cut the PMIC supply

Signed-off-by: Moses Christopher <BollavarapuMoses.Christopher@in.bosch.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210611161350.2141-7-Gireesh.Hiremath@in.bosch.com
2 years agoconfigs: am335x_guardian: add memtest configs
Gireesh Hiremath [Fri, 11 Jun 2021 16:13:37 +0000 (16:13 +0000)]
configs: am335x_guardian: add memtest configs

- Add mtest, meminfo commands

Signed-off-by: Gireesh Hiremath <Gireesh.Hiremath@in.bosch.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210611161350.2141-6-Gireesh.Hiremath@in.bosch.com
2 years agoam335x, guardian: set tftp_load_addr in environment
Moses Christopher [Fri, 11 Jun 2021 16:13:36 +0000 (16:13 +0000)]
am335x, guardian: set tftp_load_addr in environment

Set tftp_load_addr to 0x82000000 in MEM_LAYOUT_ENV_SETTINGS

Signed-off-by: Moses Christopher <BollavarapuMoses.Christopher@in.bosch.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210611161350.2141-5-Gireesh.Hiremath@in.bosch.com
2 years agoconfigs: am335x_guardian: add ubi fastmap support
Gireesh Hiremath [Fri, 11 Jun 2021 16:13:35 +0000 (16:13 +0000)]
configs: am335x_guardian: add ubi fastmap support

- Trigger fastmap automatically

Signed-off-by: Gireesh Hiremath <Gireesh.Hiremath@in.bosch.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210611161350.2141-4-Gireesh.Hiremath@in.bosch.com
2 years agoam335x, guardian: mem: Add board dependent mem values
Moses Christopher [Fri, 11 Jun 2021 16:13:34 +0000 (16:13 +0000)]
am335x, guardian: mem: Add board dependent mem values

  - Add mem-guardian.h derived from am33xx/mem.h

    * Add GPMC config values optimized for Bosch Guardian Board
    * NAND Chip used by Bosch Guardian Board is Micron MT29F4G08ABBFA

Signed-off-by: Moses Christopher <BollavarapuMoses.Christopher@in.bosch.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210611161350.2141-3-Gireesh.Hiremath@in.bosch.com
2 years agoconfigs: am335x_guardian: Enable clock driver
Gireesh Hiremath [Fri, 11 Jun 2021 16:13:33 +0000 (16:13 +0000)]
configs: am335x_guardian: Enable clock driver

Enable TI clock driver support for guardian board

Signed-off-by: Gireesh Hiremath <Gireesh.Hiremath@in.bosch.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210611161350.2141-2-Gireesh.Hiremath@in.bosch.com
2 years agox86: Ensure the e820 map is installed in all cases
Simon Glass [Sun, 11 Jul 2021 03:15:21 +0000 (21:15 -0600)]
x86: Ensure the e820 map is installed in all cases

This is a revert of a recent logic change in setup_zimage(). We do
actually need to install this information always. Change it to install
from the Coreboot tables if available, else the normal source.

Fixes: e7bae8283fe ("x86: Allow installing an e820 when booting from coreboot")
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agodoc: Update documentation for cros-2021.04 release
Simon Glass [Sun, 27 Jun 2021 23:51:11 +0000 (17:51 -0600)]
doc: Update documentation for cros-2021.04 release

With the new 2021.04 we have a new version of Chromium OS boot, which
supports sandbox, coral and coral-on-coreboot. Add documentation for
this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agodtoc: Check that a parent is not missing
Simon Glass [Sun, 27 Jun 2021 23:51:10 +0000 (17:51 -0600)]
dtoc: Check that a parent is not missing

With of-platdata-inst we want to set up a reference to each devices'
parent device, if there is one. If we find that the device has a parent
(i.e. is not a root node) but it is not in the list of devices being
written, then we cannot create the reference.

Report an error in this case, since it indicates that the parent node
is either missing a compatible string, is disabled, or perhaps does not
have any properties because it was not tagged for SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agox86: cros: Check ROM exists before building vboot
Simon Glass [Sun, 27 Jun 2021 23:51:09 +0000 (17:51 -0600)]
x86: cros: Check ROM exists before building vboot

All the x86 devicetree files are built at once, whichever board is
actually being built. If coreboot is the target build, CONFIG_ROM_SIZE
is not defined and samus cannot build Chromium OS verified boot. Add
this condition to avoid errors about CONFIG_ROM_SIZE being missing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agox86: coreboot: Document the memory map
Simon Glass [Sun, 27 Jun 2021 23:51:08 +0000 (17:51 -0600)]
x86: coreboot: Document the memory map

Add information about memory usage when U-Boot is started from coreboot.
This is useful when debugging. Also, since coreboot takes a chunk of
memory in the middle of SDRAM for use by PCI devices, it can help avoid
overwriting this with a loaded kernel by accident.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agox86: coreboot: Use vendor in the Kconfig
Simon Glass [Sun, 27 Jun 2021 23:51:07 +0000 (17:51 -0600)]
x86: coreboot: Use vendor in the Kconfig

Use VENDOR_COREBOOT instead of TARGET_COREBOOT so we can have multiple
coreboot boards, sharing options. Only SYS_CONFIG_NAME needs to be
defined TARGET_COREBOOT.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agox86: Add function comments to cb_sysinfo.h
Simon Glass [Sun, 27 Jun 2021 23:51:06 +0000 (17:51 -0600)]
x86: Add function comments to cb_sysinfo.h

Add a function comment for get_coreboot_info() and a declaration for
cb_get_sysinfo(), since this may be called from elsewhere.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agox86: coral: Allow booting from coreboot
Simon Glass [Sun, 27 Jun 2021 23:51:05 +0000 (17:51 -0600)]
x86: coral: Allow booting from coreboot

Set up coral so that it can boot from coreboot, even though it is a
bare-metal build. This helps with testing since the same image can be used
in both cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agox86: coreboot: Show the BIOS date
Simon Glass [Sun, 27 Jun 2021 23:51:04 +0000 (17:51 -0600)]
x86: coreboot: Show the BIOS date

The BIOS version may not be present, e.g. on a Chrome OS build. Add the
BIOS date as well, so we get some sort of indication of coreboot's
vintage.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agox86: Do cache set-up by default when booting from coreboot
Simon Glass [Sun, 27 Jun 2021 23:51:03 +0000 (17:51 -0600)]
x86: Do cache set-up by default when booting from coreboot

A recent change to disable cache setup when booting from coreboot
assumed that this has been done by SPL. The result is that for the
coreboot board, the cache is disabled (in start.S) and never
re-enabled.

If the cache was turned off, as it is on boards without SPL, we should
turn it back on. Add this new condition.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agox86: Update the MP constants to avoid conflicts
Simon Glass [Sun, 27 Jun 2021 23:51:02 +0000 (17:51 -0600)]
x86: Update the MP constants to avoid conflicts

These constants conflict with error codes returned by the MP
implementation when something is wrong. In particular, mp_first_cpu()
returns MP_SELECT_BSP when running without multiprocessing enabled.
Since this is -2, it is interpreted as an error by callers, which
expect a positive CPU number for the first CPU.

Correct this by using a different range for the pre-defined CPU
numbers, above zero and out of the range of possible CPU values. For
now it is safe to assume there are no more than 64K CPUs.

This fixes the 'mtrr' command when CONFIG_SMP is not enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agox86: Don't set up MTRRs if previously done
Simon Glass [Sun, 27 Jun 2021 23:51:01 +0000 (17:51 -0600)]
x86: Don't set up MTRRs if previously done

When starting U-Boot from a previous-stage bootloader we presumably don't
need to set up the variable MTRRs. In fact this could be harmful if the
existing settings are not what U-Boot uses.

Skip that step in this case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agotpm: cr50: Drop unnecessary coral headers
Simon Glass [Sun, 27 Jun 2021 23:51:00 +0000 (17:51 -0600)]
tpm: cr50: Drop unnecessary coral headers

These headers are not actually used. Drop them so that this driver can
be used by other boards, e.g. coreboot.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agospi: ich: Don't require the PCH
Simon Glass [Sun, 27 Jun 2021 23:50:59 +0000 (17:50 -0600)]
spi: ich: Don't require the PCH

When booting from coreboot we may not have a PCH driver available. The
SPI driver can operate without the PCH but currently complains in this
case. Update it to continue to work normally. The only missing feature
is memory-mapping of SPI-flash contents, which is not essential.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2 years agox86: pci: Allow binding of some devices before relocation
Simon Glass [Sun, 27 Jun 2021 23:50:57 +0000 (17:50 -0600)]
x86: pci: Allow binding of some devices before relocation

At present only bridge devices are bound before relocation, to save space
in pre-relocation memory. In some cases we do actually want to bind a
device, e.g. because it provides the console UART. Add a devicetree
binding to support this.

Use the PCI_VENDEV() macro to encode the cell value. This is present in
U-Boot but not used, so move it to the binding header-file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agopci: Use const for pci_find_device_id() etc.
Simon Glass [Sun, 27 Jun 2021 23:50:56 +0000 (17:50 -0600)]
pci: Use const for pci_find_device_id() etc.

These functions don't modify the device-ID struct that is passed in, so
mark the argument as const, so the data structure can be declared that
way. This allows it to be placed in the rodata section.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Thu, 15 Jul 2021 11:11:06 +0000 (07:11 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- Turris_omnia/mox: SPI NOR and MTD related changes / fixes (Marek)
- a37xx: pci: Misc fixes / optimizations (Pali)
- Espressobin: Fix setting $fdtfile env & changes in MMC detection
  (Pali)
- MMC: mmc_get_op_cond: Allow quiet detection of eMMC (Pali)

2 years agommc: mmc_get_op_cond: Allow quiet detection of eMMC
Pali Rohár [Wed, 14 Jul 2021 14:37:29 +0000 (16:37 +0200)]
mmc: mmc_get_op_cond: Allow quiet detection of eMMC

Add a new 'quiet' argument to mmc_get_op_cond() function which avoids
printing error message when SD/eMMC card is not detected.

Espressobin and mx6cuboxi boards use this function for detecting presence
of eMMC and therefore it is expected and normal that eMMC does not have to
be connected. So error message "Card did not respond to voltage select!"
should be skipped in this case as it is not an error.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agoarm: mvebu: Espressobin: Use function mmc_get_op_cond() for detecting eMMC
Pali Rohár [Wed, 14 Jul 2021 14:37:28 +0000 (16:37 +0200)]
arm: mvebu: Espressobin: Use function mmc_get_op_cond() for detecting eMMC

Use function mmc_get_op_cond() instead of mmc_init() for detecting presence
of eMMC. Documentation for this function says that it could be used to
detect the presence of SD/eMMC when no card detect logic is available.

This function is also used by mx6cuboxi board for detecting presence of eMMC.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: Espressobin: Fix setting $fdtfile env
Pali Rohár [Wed, 14 Jul 2021 14:37:27 +0000 (16:37 +0200)]
arm: mvebu: Espressobin: Fix setting $fdtfile env

Ensure that 'env default -a' always set correct value to $fdtfile, even
when custom user variable is already stored in non-volatile env storage
(means that env_get("fdtfile") call returns non-NULL value).

As default value is now correctly set like if specified at compile time in
CONFIG_EXTRA_ENV_SETTINGS, there is no need to set $fdtfile explicitly via
env_set("fdtfile", ...) call.

So remove wrong skip based on env_get("fdtfile") and then also unneeded
env_set("fdtfile", ...) call.

Fixes: c4df0f6f315c ("arm: mvebu: Espressobin: Set default value for $fdtfile env variable")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: armada-3720: remove unused config option
Marek Behún [Fri, 9 Jul 2021 15:40:59 +0000 (17:40 +0200)]
arm: mvebu: armada-3720: remove unused config option

The config option CONFIG_DEBUG_UART_CLOCK is not used by Armada 3720's
serial driver (it wasn't even before the recent update of that driver).

Even if it was used, the value was incorrect (the frequency of the clock
is 25 MHz, not 25.8048 MHz).

Remove it from config files and set the default value to 0.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Cc: Stefan Roese <sr@denx.de>
Cc: Pali Rohár <pali@kernel.org>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: turris_{omnia, mox}: enable MTD command
Marek Behún [Fri, 9 Jul 2021 14:56:14 +0000 (16:56 +0200)]
arm: mvebu: turris_{omnia, mox}: enable MTD command

Now that the MTD subsystem properly supports OF partitions of a SPI NOR,
we can enable the MTD command and start using it instead of the
deprecated sf command.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Cc: Stefan Roese <sr@denx.de>
Cc: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: turris_omnia: force 40 MHz speed on SPI NOR
Marek Behún [Fri, 9 Jul 2021 14:56:13 +0000 (16:56 +0200)]
arm: mvebu: turris_omnia: force 40 MHz speed on SPI NOR

Commit e2e95e5e2542 ("spi: Update speed/mode on change") changed the
boot time on Turris Omnia from ~2.3s to over 8s, due to SPL loading main
U-Boot from SPI NOR at 1 MHz instead of 40 MHz.

This is because the SPL code passes the CONFIG_SF_DEFAULT_SPEED option
to spi_flash_probe(), and with the above commit spi_flash_probe() starts
prefering this parameter instead of the one specified in device-tree.

The proper solution here would probably be to fix the SF subsystem to
prefer the frequency specified in the device-tree, if it is present, but
I am not sure what else will be affected on other boards with such a
change. So until then we need a more simple fix.

Since the CONFIG_SF_DEFAULT_SPEED option is used by the code, put the
correct value there for Turris Omnia. Also put the correct value to
CONFIG_SF_DEFAULT_MODE and use 40 MHz when reading environment.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Cc: Stefan Roese <sr@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Cc: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: a37xx: pci: Fix typo in comment
Pali Rohár [Thu, 8 Jul 2021 18:19:00 +0000 (20:19 +0200)]
arm: a37xx: pci: Fix typo in comment

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Konstantin Porotchkin <kostap@marvell.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: a37xx: pci: Optimize a3700_fdt_fix_pcie_regions() when fixup offset is zero
Pali Rohár [Thu, 8 Jul 2021 18:18:59 +0000 (20:18 +0200)]
arm: a37xx: pci: Optimize a3700_fdt_fix_pcie_regions() when fixup offset is zero

If fixup offset is zero then there is nothing to fix. All calculation in
this case just increase addresses by value zero which results in identity.
So in this case skip whole fixup re-calculation as it is not needed.

This is just an optimization for special case when fix_offset is zero which
skips code path which does only identity operations (meaning nothing). No
functional changes.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Konstantin Porotchkin <kostap@marvell.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: a37xx: pci: Extend validation for PCIe resources and oubound windows
Pali Rohár [Thu, 8 Jul 2021 18:18:58 +0000 (20:18 +0200)]
arm: a37xx: pci: Extend validation for PCIe resources and oubound windows

Remapped address of PCIe outbound window may have set only bits from the
mask. Add additional check that remapped address which is calculated from
PCIe bus address specified in DTS file is valid.

Remove also useless clearing of low 16 bits in win_mask. As win_size is
power of two and is at least 0x10000 it means that it always has zero low
16 bits.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Konstantin Porotchkin <kostap@marvell.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoMerge branch '2021-07-14-build-and-host-updates'
Tom Rini [Thu, 15 Jul 2021 00:10:34 +0000 (20:10 -0400)]
Merge branch '2021-07-14-build-and-host-updates'

- Resync Kbuild with the v4.20 Linux Kernel release
- Update checkpatch.pl
- Assorted other tooling updates

2 years agoscripts/get_default_envs.sh: Update for thin archive support
Tom Rini [Mon, 21 Jun 2021 20:14:18 +0000 (16:14 -0400)]
scripts/get_default_envs.sh: Update for thin archive support

This script was broken by the change to default archives for linking.
This is due to objcopy specifically disallowing copying of thin
archives.  To fix this and re-support external users of this script,
switch to using the same logic the u-boot-initial-env make target uses
to dump the section from the object file.

Reported-by: Jan Kiszka <jan.kiszka@web.de>
Fixes: 958f2e57eff7 ("build: use thin archives instead of incremental linking")
Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoMakefile: Conditionally add defaultenv_h to envtools target
Joel Stanley [Fri, 18 Jun 2021 02:05:59 +0000 (11:35 +0930)]
Makefile: Conditionally add defaultenv_h to envtools target

When building the envtools target with CONFIG_USE_DEFAULT_ENV_FILE=y,
the tools require generated/defaultenv_autogenerated.h.

 In file included from tools/env/fw_env.c:126:
 include/env_default.h:115:10: fatal error: generated/defaultenv_autogenerated.h: No such file or directory
   115 | #include "generated/defaultenv_autogenerated.h"
       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Joel Stanley <joel@jms.id.au>
2 years agokconfig / kbuild: Re-sync with Linux 4.20
Tom Rini [Thu, 17 Jun 2021 22:07:25 +0000 (18:07 -0400)]
kconfig / kbuild: Re-sync with Linux 4.20

Align Kconfig and Kbuild logic to Linux 4.20 release with minimal impact
on files outside of this scope.

Our previous Kconfig sync was done by commit 587e4a429698 ("kconfig /
kbuild: Re-sync with Linux 4.19").

As part of this re-sync, a few related changes from previous Linux
releases were found to have been missed and merged in, and are not in
the following list.

The imported Linux commits are:

[From prior to v4.19]
b1e0d8b70fa3 kbuild: Fix gcc -x syntax
a4353898980c kconfig: add CC_IS_GCC and GCC_VERSION
469cb7376c06 kconfig: add CC_IS_CLANG and CLANG_VERSION

[From v4.19 to v4.20]
487c7c7702ab kbuild: prefix Makefile.dtbinst path with $(srctree) unconditionally
0d91bf584fe5 kbuild: remove old check for CFLAGS use
25815cf5ffec kbuild: hide most of targets when running config or mixed targets
00d78ab2ba75 kbuild: remove dead code in cmd_files calculation in top Makefile
23066c3f4e21 Compiler Attributes: enable -Wstringop-truncation on W=1 (gcc >= 8)
37c8a5fafa3b kbuild: consolidate Devicetree dtb build rules
80463f1b7bf9 kbuild: add --include-dir flag only for out-of-tree build
77ec0c20c7e0 kbuild: remove VERSION and PATCHLEVEL from $(objtree)/Makefile
74bc0c09b2da kbuild: remove user ID check in scripts/mkmakefile
4fd61277f662 kbuild: do not pass $(objtree) to scripts/mkmakefile
80d0dda3a4e5 kbuild: simplify command line creation in scripts/mkmakefile
fb073a4b473e kbuild: add -Wno-pointer-sign flag unconditionally
9df3e7a7d7d6 kbuild: add -Wno-unused-but-set-variable flag unconditionally
69ea912fda74 kbuild: remove unneeded link_multi_deps
7d0ea2524202 kbuild: use 'else ifeq' for checksrc to improve readability
04c459d20448 kconfig: remove oldnoconfig target
0085b4191f3e kconfig: remove silentoldconfig target
3f80babd9ca4 kbuild: remove unused cc-fullversion variable
2cd3faf87d2d merge_config.sh: Allow to define config prefix
076f421da5d4 kbuild: replace cc-name test with CONFIG_CC_IS_CLANG
6bbe4385d035 kconfig: merge_config: avoid false positive matches from comment lines

[From post v4.20]
885480b08469 Makefile: Move -Wno-unused-but-set-variable out of GCC only block

There are a number of changes related to additional warnings as well as
being able to drop cc-name entirely that have been omitted for now as
additional work is required first.

Cc: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoget_maintainer.pl: update from Linux kernel v5.13-rc6
Trevor Woerner [Tue, 15 Jun 2021 07:30:29 +0000 (03:30 -0400)]
get_maintainer.pl: update from Linux kernel v5.13-rc6

Update U-Boot's version of scripts/get_maintainer.pl to sync it up with the
latest changes to the Linux kernel's version of the same script.

The last sync was with Linux kernel version v4.16. The commits to the kernel's
get_maintainer.pl since then (starting with the most recent) are:

6343f6b71f83 get_maintainer: exclude MAINTAINERS file(s) from --git-fallback
cdfe2d220476 get_maintainer: add test for file in VCS
e33c9fe8b80c get_maintainer: fix unexpected behavior for path/to//file (double slashes)
0c78c0137621 get_maintainer: add email addresses from .yaml files
0ef82fcefb99 scripts/get_maintainer.pl: deprioritize old Fixes: addresses
ef0c08192ac0 get_maintainer: remove uses of P: for maintainer name
2f5bd343694e scripts/get_maintainer.pl: add signatures from Fixes: <badcommit> lines in commit message
49662503e8e4 get_maintainer: add ability to skip moderated mailing lists
0fbd75fd7fee get_maintainer: allow option --mpath <directory> to read all files in <directory>
5f0baf95b1ed get_maintainer.pl: add -mpath=<path or file> for MAINTAINERS file location
31bb82c9caa9 get_maintainer: allow usage outside of kernel tree
0455c74788fd get_maintainer: improve patch recognition
882ea1d64eb3 scripts: use SPDX tag in get_maintainer and checkpatch

Signed-off-by: Trevor Woerner <twoerner@gmail.com>
2 years agolib: move rtc-lib.c to lib
Heinrich Schuchardt [Sat, 12 Jun 2021 11:20:07 +0000 (13:20 +0200)]
lib: move rtc-lib.c to lib

Function rtc_to_tm() is needed for FAT file system support even if we don't
have a real time clock. So move it from drivers/ to lib/.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agotools: image-host: fix wrong return value
Ming Liu [Mon, 31 May 2021 07:04:51 +0000 (09:04 +0200)]
tools: image-host: fix wrong return value

The return value '-ENOSPC' of fit_set_timestamp function does not match
the caller fit_image_write_sig's expection which is '-FDT_ERR_NOSPACE'.

Fix it by not calling fit_set_timestamp, but call fdt_setprop instead.

This fixes a following mkimage error:
| Can't write signature for 'signature@1' signature node in
| 'conf@imx6ull-colibri-wifi-eval-v3.dtb' conf node: <unknown error>
| mkimage Can't add hashes to FIT blob: -1

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
Tested-by: Igor Opaniuk <igor.opaniuk@foundries.io>
2 years agotools/fitimage: add missing linebreak for some messages
Sven Roederer [Tue, 25 May 2021 21:15:27 +0000 (23:15 +0200)]
tools/fitimage: add missing linebreak for some messages

Add a linebreak to two messages and fix punctuation.

Signed-off-by: Sven Roederer <devel-sven@geroedel.de>
2 years agofixdep: remove leftover handling of IS_BUILTIN/IS_MODULE
Rasmus Villemoes [Thu, 20 May 2021 10:32:17 +0000 (12:32 +0200)]
fixdep: remove leftover handling of IS_BUILTIN/IS_MODULE

I removed CONFIG_IS_BUILTIN and CONFIG_IS_MODULE in commit
7d78a4547d ("linux/kconfig.h: remove unused helper macros"), but
fixdep.c still looks for those. It's harmless, but also pointless and
possibly confusing to a future reader.

Fixes: 7d78a4547d ("linux/kconfig.h: remove unused helper macros")
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2 years agomkimage: allow -l to work on block devices on Linux
Yann Dirson [Tue, 18 May 2021 08:59:04 +0000 (10:59 +0200)]
mkimage: allow -l to work on block devices on Linux

When "mkimage -l" was run on a block device it would fail with
erroneous message, because fstat reports a size of zero for those:

 mkimage: Bad size: "/dev/sdb4" is not valid image

This patch identifies the "is a block device" case and reports it as
such, and if it knows how to determine the size of a block device on
the current OS, proceeds.

As shown in
http://www.mit.edu/afs.new/sipb/user/tytso/e2fsprogs/lib/blkid/getsize.c
this is no portable task, and I only handled the case of a modern
Linux kernel, which is what I can test.

Signed-off-by: Yann Dirson <yann@blade-group.com>
2 years agoMerge branch '2021-07-14-platform-updates'
Tom Rini [Wed, 14 Jul 2021 20:48:23 +0000 (16:48 -0400)]
Merge branch '2021-07-14-platform-updates'

- Assorted platform updates

2 years agousb: musb-new: Add glue driver for ST-Ericsson Ux500
Stephan Gerhold [Thu, 8 Jul 2021 18:33:50 +0000 (20:33 +0200)]
usb: musb-new: Add glue driver for ST-Ericsson Ux500

The ST-Ericsson DB8500 SoC contains a MUSB OTG controller which
supports both host and gadget mode. For some reason there is
nothing special about it - add a simple glue driver for Ux500
that literally just sets up MUSB together with a generic PHY.
There are no SoC-specific registers etc needed to make USB work.

The new Ux500 glue driver is only tested to work with DM_USB
and DM_USB_GADGET. Both host and gadget mode work fine on
the u8500 "stemmy" board that is already present in U-Boot.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2 years agophy: Add driver for ST-Ericsson AB8500 USB PHY
Stephan Gerhold [Thu, 8 Jul 2021 18:33:49 +0000 (20:33 +0200)]
phy: Add driver for ST-Ericsson AB8500 USB PHY

The AB8500 PMIC contains an USB PHY that needs to be set up in
device or host mode to make USB work properly. Add a simple driver
for the generic PHY uclass that allows enabling it.

The if (CONFIG_IS_ENABLED(USB_MUSB_HOST)) might be a bit strange.
The USB PHY must be configured in either host or device mode and
somehow the USB PHY driver must be made aware of the mode.

Actually, the MUSB driver used together with this PHY does not
support dynamic selection of host/device mode in U-Boot at the moment.
Therefore, one very simple approach that works fine is to select
the mode to configure at compile time. When the MUSB driver is
configured in host mode the PHY is configured in host mode, and
similarly when the MUSB driver is configured in device/gadget mode.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>