platform/kernel/u-boot.git
2 years agoimx: engicam-imx8mm: drop unused macro
Peng Fan [Sat, 11 Jun 2022 12:21:04 +0000 (20:21 +0800)]
imx: engicam-imx8mm: drop unused macro

Drop unused WDOG macro

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
2 years agoimx: imx8mm-cl-iot-gate: enable pinctrl_wdog in SPL
Peng Fan [Sat, 11 Jun 2022 12:21:03 +0000 (20:21 +0800)]
imx: imx8mm-cl-iot-gate: enable pinctrl_wdog in SPL

Mark pinctrl_wdog as u-boot,dm-spl to clean up board code,

The set_wdog_reset() function is not necessary as this is handled by
the imx_watchdog.c driver due to the 'fsl,ext-reset-output' property
being set.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx: imx8mm_beacon: enable pinctrl_wdog in SPL
Peng Fan [Sat, 11 Jun 2022 12:21:02 +0000 (20:21 +0800)]
imx: imx8mm_beacon: enable pinctrl_wdog in SPL

Mark pinctrl_wdog as u-boot,dm-spl to clean up board code,

The set_wdog_reset() function is not necessary as this is handled by
the imx_watchdog.c driver due to the 'fsl,ext-reset-output' property
being set.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoconfigs: drop CONFIG_SPL_ABORT_ON_RAW_IMAGE
Peng Fan [Sat, 11 Jun 2022 12:21:01 +0000 (20:21 +0800)]
configs: drop CONFIG_SPL_ABORT_ON_RAW_IMAGE

CONFIG_SPL_RAW_IMAGE_SUPPORT default y has been used to replace
CONFIG_SPL_ABORT_ON_RAW_IMAGE for quite some time, so drop
CONFIG_SPL_ABORT_ON_RAW_IMAGE.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx: kontron-sl-mx8mm: enable DM_SERIAL
Peng Fan [Sat, 11 Jun 2022 12:21:00 +0000 (20:21 +0800)]
imx: kontron-sl-mx8mm: enable DM_SERIAL

Enable CONFIG_DM_SERIAL. uart and its pinmux was already
marked with u-boot,dm-spl.
Move preloader_console_init after spl_init to make sure driver
model work.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Acked-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Tested-by: Frieder Schrempf <frieder.schrempf@kontron.de>
2 years agoimx: imx8mn_var_som: enable DM_SERIAL
Peng Fan [Sat, 11 Jun 2022 12:20:59 +0000 (20:20 +0800)]
imx: imx8mn_var_som: enable DM_SERIAL

Enable CONFIG_DM_SERIAL. uart and its pinmux was already
marked with u-boot,dm-spl.
Move preloader_console_init after spl_init to make sure driver
model work.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Ariel D'Alessandro <ariel.dalessandro@collabora.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
2 years agoimx: imx8m[m/p]_phycore: Enable DM_SERIAL
Peng Fan [Sat, 11 Jun 2022 12:20:58 +0000 (20:20 +0800)]
imx: imx8m[m/p]_phycore: Enable DM_SERIAL

Enable CONFIG_DM_SERIAL. uart and its pinmux was already
marked with u-boot,dm-spl.
Move preloader_console_init after spl_early_init to make sure driver
model work.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Tested-by: Teresa Remmet <t.remmet@phytec.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
2 years agoimx: imx8mm_icore: Enable SPL_DM_SERIAL
Peng Fan [Sat, 11 Jun 2022 12:20:57 +0000 (20:20 +0800)]
imx: imx8mm_icore: Enable SPL_DM_SERIAL

Enable CONFIG_SPL_DM_SERIAL. uart2 and its pinmux was already
marked with u-boot,dm-spl.
Move preloader_console_init after spl_early_init to make sure driver
model work.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
2 years agoimx: imx8mm-cl-iot-gate: Enable DM_SERIAL
Peng Fan [Sat, 11 Jun 2022 12:20:56 +0000 (20:20 +0800)]
imx: imx8mm-cl-iot-gate: Enable DM_SERIAL

Enable CONFIG_DM_SERIAL. uart3 and its pinmux was already
marked with u-boot,dm-spl.
Move preloader_console_init after spl_early_init to make sure driver
model work.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
2 years agoimx: imx8m[m/n]_beacon: Enable SPL_DM_SERIAL
Peng Fan [Sat, 11 Jun 2022 12:20:55 +0000 (20:20 +0800)]
imx: imx8m[m/n]_beacon: Enable SPL_DM_SERIAL

Enable CONFIG_SPL_DM_SERIAL. uart2 and its pinmux was already
marked with u-boot,dm-spl.
Move preloader_console_init after spl_init to make sure driver
model work.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Tested-by: Adam Ford <aford173@gmail.com> #imx8mm_beacon
Reviewed-by: Fabio Estevam <festevam@denx.de>
Tested-by: Adam Ford <aford173@gmail.com> #imx8mn_beacon
2 years agoimx: drop CONFIG_MXC_UART_BASE
Peng Fan [Sat, 11 Jun 2022 12:20:54 +0000 (20:20 +0800)]
imx: drop CONFIG_MXC_UART_BASE

Since these boards has CONFIG_DM_SERIAL and/or CONFIG_SPL_DM_SERIAL,
the legacy macro no need to be defined.

Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Acked-by: Soeren Moch <smoch@web.de>
Acked-by: Tim Harvey <tharvey@gateworks.com>
2 years agoMerge branch '2022-06-10-assorted-platform-updates' into next
Tom Rini [Fri, 10 Jun 2022 20:02:42 +0000 (16:02 -0400)]
Merge branch '2022-06-10-assorted-platform-updates' into next

- TI J721E hyperflash support, TI OMAP3 updates, TI AM654 updates,
  TI AM62 initial support, Broadcom bcmbca 47622 SoC support, NPCM7xx
  pinctrl and rng drivers, Synquacer updates

2 years agodoc: ti: Add readme for AM62x SK
Vignesh Raghavendra [Wed, 25 May 2022 08:08:50 +0000 (13:38 +0530)]
doc: ti: Add readme for AM62x SK

Add info of boot flow and build steps for AM62x SK.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Reviewed-by: Bryan Brattlof <bb@ti.com>
2 years agoconfigs: Add configs for AM62x SK
Vignesh Raghavendra [Wed, 25 May 2022 08:08:49 +0000 (13:38 +0530)]
configs: Add configs for AM62x SK

Add am62x_evm_r5_defconfig for R5 SPL and am62x_evm_a53_defconfig for
A53 SPL and U-Boot support.

To keep the changes to minimum. Only UART And SD boot related configs
are included. This should serve as good starting point for new board
bringup with AM62x.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
[trini: Migrate a number of CONFIG symbols, have re-tested]
Tested-by: Georgi Vlaev <g-vlaev@ti.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoarm: dts: Add support for AM62-SK
Nishanth Menon [Wed, 25 May 2022 08:08:48 +0000 (13:38 +0530)]
arm: dts: Add support for AM62-SK

AM62 StarterKit (SK) board is a low cost, small form factor board
designed for TI’s AM625 SoC. It supports the following interfaces:
* 2 GB DDR4 RAM
* x2 Gigabit Ethernet interfaces capable of working in Switch and MAC mode
* x1 HDMI Port with audio + x1 OLDI/LVDS Display interface for Dual Display
* x1 Headphone Jack
* x1 USB2.0 Hub with two Type A host and x1 USB Type-C DRP Port
* x1 UHS-1 capable µSD card slot
* 2.4/5 GHz WLAN + Bluetooth 4.2 through WL1837
* 512 Mbit OSPI flash
* x4 UART through UART-USB bridge
* XDS110 for onboard JTAG debug using USB
* Temperature sensors, user push buttons and LEDs
* 40-pin User Expansion Connector
* 24-pin header for peripherals in MCU island (I2C, UART, SPI, IO)
* 20-pin header for Programmable Realtime Unit (PRU) IO pins
* 15-pin CSI header

Add basic support for AM62-SK.

To keep the changes to minimum. Only UART And SD are supported at the
moment. This should serve as good example for adding new board support
based on AM62x SoC

Schematics: https://www.ti.com/lit/zip/sprr448

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
2 years agoboard: ti: Introduce the basic files to support AM62 SK board
Suman Anna [Wed, 25 May 2022 08:08:47 +0000 (13:38 +0530)]
board: ti: Introduce the basic files to support AM62 SK board

Add basic support for AM62 SK. This has 2GB DDR.
Note that stack for R5 SPL is in OCRAM @ 0x7000ffff so that is away from
BSS and does not step on BSS section

Add only the bare minimum required to support UART and SD.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agoarm: dts: Introduce base AM62 SoC dtsi files
Suman Anna [Wed, 25 May 2022 08:08:46 +0000 (13:38 +0530)]
arm: dts: Introduce base AM62 SoC dtsi files

Introduce the basic AM62 SoC description dtsi files describing most
peripherals as per kernel dts.

Signed-off-by: Gowtham Tammana <g-tammana@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
2 years agofirmware: ti_sci_static_data: add static DMA chan data
Vignesh Raghavendra [Wed, 25 May 2022 08:08:45 +0000 (13:38 +0530)]
firmware: ti_sci_static_data: add static DMA chan data

Add range of DMA channels available for R5 SPL usage before DM firmware
is loaded.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
2 years agodma: ti: Add PSIL data for AM62x DMASS
Vignesh Raghavendra [Wed, 25 May 2022 08:08:44 +0000 (13:38 +0530)]
dma: ti: Add PSIL data for AM62x DMASS

Add PSIL data for AM62x SoC.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
2 years agoarm: mach-k3: am62: Introduce autogenerated SoC data
Suman Anna [Wed, 25 May 2022 08:08:43 +0000 (13:38 +0530)]
arm: mach-k3: am62: Introduce autogenerated SoC data

Introduce autogenerated SoC data support clk and device data for the
AM62. Hook it upto to power-domain and clk frameworks of U-Boot.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
2 years agoarm: mach-k3: Introduce the basic files to support AM62
Suman Anna [Wed, 25 May 2022 08:08:42 +0000 (13:38 +0530)]
arm: mach-k3: Introduce the basic files to support AM62

The AM62 SoC family is the follow on AM335x built on K3 Multicore SoC
architecture platform, providing ultra-low-power modes, dual display,
multi-sensor edge compute, security and other BOM-saving integration.
The AM62 SoC targets broad market to enable applications such as
Industrial HMI, PLC/CNC/Robot control, Medical Equipment, Building
Automation, Appliances and more.

Some highlights of this SoC are:

* Quad-Cortex-A53s (running up to 1.4GHz) in a single cluster.
  Pin-to-pin compatible options for single and quad core are available.
* Cortex-M4F for general-purpose or safety usage.
* Dual display support, providing 24-bit RBG parallel interface and
  OLDI/LVDS-4 Lane x2, up to 200MHz pixel clock support for 2K display
  resolution.
* Selectable GPUsupport, up to 8GFLOPS, providing better user experience
  in 3D graphic display case and Android.
* PRU(Programmable Realtime Unit) support for customized programmable
  interfaces/IOs.
* Integrated Giga-bit Ethernet switch supporting up to a total of two
  external ports (TSN capable).
* 9xUARTs, 5xSPI, 6xI2C, 2xUSB2, 3xCAN-FD, 3x eMMC and SD, GPMC for
  NAND/FPGA connection, OSPI memory controller, 3xMcASP for audio,
  1x CSI-RX-4L for Camera, eCAP/eQEP, ePWM, among other peripherals.
* Dedicated Centralized System Controller for Security, Power, and
  Resource Management.
* Multiple low power modes support, ex: Deep sleep,Standby, MCU-only,
  enabling battery powered system design.

AM625 is the first device of the family. Add DT bindings for the same.

More details can be found in the Technical Reference Manual:
https://www.ti.com/lit/pdf/spruiv7

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Gowtham Tammana <g-tammana@ti.com>
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agosoc: ti: k3-socinfo: Add entry for AM62X SoC family
Suman Anna [Wed, 25 May 2022 08:08:41 +0000 (13:38 +0530)]
soc: ti: k3-socinfo: Add entry for AM62X SoC family

Add support for AM62x SoC identification.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agodt-bindings: pinctrl: k3: Introduce pinmux definitions for AM62
Suman Anna [Wed, 25 May 2022 08:08:40 +0000 (13:38 +0530)]
dt-bindings: pinctrl: k3: Introduce pinmux definitions for AM62

Add pinctrl macros for AM62x SoCs. These macro definitions are similar
to that of previous platforms, but adding new definitions to avoid any
naming confusions in the SoC dts files.

checkpatch insists the following error exists:
ERROR: Macros with complex values should be enclosed in parentheses

However, we do not need parentheses enclosing the values for this
macro as we do intend it to generate two separate values as has been
 done for other similar platforms.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
2 years agodrivers: mmc: am654_sdhci: Add new compatible for AM62 SoC
Aswath Govindraju [Wed, 25 May 2022 08:08:39 +0000 (13:38 +0530)]
drivers: mmc: am654_sdhci: Add new compatible for AM62 SoC

The phy used in the 8 bit instance has been changed to the phy used in 4
bit instance on AM62 SoC. This implies the phy configuration required for
both the instances of mmc are similar. Therefore, add a new compatible
for AM62 SoC using the driver data of am64 4 bit instance.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agorng: nuvoton: Add NPCM7xx rng driver
Jim Liu [Tue, 24 May 2022 08:56:57 +0000 (16:56 +0800)]
rng: nuvoton: Add NPCM7xx rng driver

Add Nuvoton BMC NPCM750 rng driver.

Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
2 years agoconfigs: am65_evm_r5_usb*_defconfig: Sync the checks for size of image and stack...
Aswath Govindraju [Wed, 18 May 2022 11:19:14 +0000 (16:49 +0530)]
configs: am65_evm_r5_usb*_defconfig: Sync the checks for size of image and stack from generic r5 defconfig

Sync the configs required for enabling checks for size of image and stack
from generic r5 defconfig file.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
2 years agoarm: mach-k3: am6_init: Fix the path and value's length in the fixup performed for...
Aswath Govindraju [Wed, 18 May 2022 11:19:13 +0000 (16:49 +0530)]
arm: mach-k3: am6_init: Fix the path and value's length in the fixup performed for usb boot

The node name of the bus in the device tree has changed. Also, the length
argument to be passed should be the length of new value. Therefore, fix the
path to usb device tree node as well as the length argument passed.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
2 years agoarm: dts: k3-am654-r5-base-board: Fix the dt properties in usb0 instance
Aswath Govindraju [Wed, 18 May 2022 11:19:12 +0000 (16:49 +0530)]
arm: dts: k3-am654-r5-base-board: Fix the dt properties in usb0 instance

For dfu boot mode, the clocks property needs to be deleted and dr_mode
needs to be set to peripheral. Therefore, add the required fixes for the
same.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
2 years agospi: synquacer: simplify tx completion checking
Masahisa Kojima [Tue, 17 May 2022 08:41:39 +0000 (17:41 +0900)]
spi: synquacer: simplify tx completion checking

There is a TX-FIFO and Shift Register empty(TFES) status
bit in spi controller. This commit checks the TFES bit
to wait the TX transfer completes.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Signed-off-by: Satoru Okamoto <okamoto.satoru@socionext.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
2 years agospi: synquacer: DMSTART bit must not be set while transferring
Masahisa Kojima [Tue, 17 May 2022 08:41:38 +0000 (17:41 +0900)]
spi: synquacer: DMSTART bit must not be set while transferring

DMSTART bit must not be set while there is active transfer.
This commit sets the DMSTART bit only when the transfer begins.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Signed-off-by: Satoru Okamoto <okamoto.satoru@socionext.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
2 years agospi: synquacer: wait until slave is deselected
Masahisa Kojima [Tue, 17 May 2022 08:41:37 +0000 (17:41 +0900)]
spi: synquacer: wait until slave is deselected

synquacer_cs_set() function does not wait the chip select
is deasserted when the driver sets the DMSTOP to deselect
the slave.
This commit checks the Slave Select Released(SRS) bit to wait
until the slave is deselected.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Signed-off-by: Satoru Okamoto <okamoto.satoru@socionext.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
2 years agospi: synquacer: busy variable must be initialized before use
Masahisa Kojima [Tue, 17 May 2022 08:41:36 +0000 (17:41 +0900)]
spi: synquacer: busy variable must be initialized before use

"busy" variable is ORed without being initialized,
must be zeroed before use.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Signed-off-by: Satoru Okamoto <okamoto.satoru@socionext.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
2 years agopinctrl: nuvoton: Add NPCM7xx pinctrl driver
Jim Liu [Tue, 17 May 2022 08:30:32 +0000 (16:30 +0800)]
pinctrl: nuvoton: Add NPCM7xx pinctrl driver

Add Nuvoton BMC NPCM750 Pinmux and Pinconf support.

Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
2 years agoARM: omap3: evm: Fix 'fitImage' booting
Derald D. Woods [Mon, 16 May 2022 03:25:05 +0000 (22:25 -0500)]
ARM: omap3: evm: Fix 'fitImage' booting

This commit sets two additional variables in the default BOOTCOMMAND.
Adding 'boot=mmc' and 'addr_fit=0x8b000000' removes the need for a
special 'uEnv.txt' to be created. The 'addr_fit' variable is the key
piece here. It is normally defined as 0x90000000, in the macro
DEFAULT_FIT_TI_ARGS. For this OMAP34XX board, 0x8b000000 works without
touching other varibles. This was tested with a 'fitImage' created
using the following FIT source:

----------------------------------------------------------------------
/dts-v1/;

/ {
description = "Simple image with single Linux kernel and FDT blob";
#address-cells = <1>;

images {
kernel {
description = "Linux kernel: omap2plus";
data = /incbin/("./zImage");
type = "kernel";
arch = "arm";
os = "linux";
compression = "none";
load = <0x80008000>;
entry = <0x80008000>;
hash-1 {
algo = "sha256";
};
};
fdt-omap3-evm.dtb {
description = "FDT: omap3-evm.dtb";
data = /incbin/("./omap3-evm.dtb");
type = "flat_dt";
arch = "arm";
compression = "none";
load = <0x8ff00000>;
hash-1 {
algo = "sha256";
};
};
};

configurations {
default = "conf-omap3-evm.dtb";
conf-omap3-evm.dtb {
description = "Boot Linux kernel with FDT blob";
kernel = "kernel";
fdt = "fdt-omap3-evm.dtb";
};
};
};
----------------------------------------------------------------------

Additionally, the default environment is now stored in "uboot.env" on
the FAT partition of MMC '0'.

Fixes: 11e2ab3f0b ("ARM: omap3: evm: Enable booting 'fitImage' with DEFAULT_FIT_TI_ARGS")
Signed-off-by: Derald D. Woods <woods.technical@gmail.com>
2 years agoARM: omap3: evm: Complete DM_I2C migration
Derald D. Woods [Mon, 16 May 2022 03:25:04 +0000 (22:25 -0500)]
ARM: omap3: evm: Complete DM_I2C migration

This commits enables DM_I2C and sets the default bus to 0.

Signed-off-by: Derald D. Woods <woods.technical@gmail.com>
2 years agoARM: omap3: evm: Power on MMC when setting up PMIC
Derald D. Woods [Mon, 16 May 2022 03:25:03 +0000 (22:25 -0500)]
ARM: omap3: evm: Power on MMC when setting up PMIC

This commit copies the related code changes from the BeagleBoard.

Reference:
- https://source.denx.de/u-boot/u-boot/-/commit/848cfe098f59c47a2542385513fb554430b874d6

Signed-off-by: Derald D. Woods <woods.technical@gmail.com>
2 years agoarm: bcmbca: introduce the bcmbca architecture and 47622 SOC
William Zhang [Mon, 9 May 2022 16:28:02 +0000 (09:28 -0700)]
arm: bcmbca: introduce the bcmbca architecture and 47622 SOC

This is the initial support for Broadcom's ARM-based 47622 SOC.

In this change, our first SOC is an armv7 platform called 47622. The
initial support includes a bare-bone implementation and dts with ARM
PL011 uart.

The SOC-specific code resides in arch/arm/mach-bcmbca/<soc> and board
related code is in board/broadcom/bcmba.

The u-boot image can be loaded from flash or network to the entry
point address in the memory and boot from there.

Signed-off-by: William Zhang <william.zhang@broadcom.com>
Signed-off-by: Kursad Oney <kursad.oney@broadcom.com>
Signed-off-by: Anand Gore <anand.gore@broadcom.com>
Reviewed-by: Philippe Reynes <philippe.reynes@softathome.com>
2 years agoconfigs: j721e_evm_defconfig: Add HBMC related configs
Vaishnav Achath [Mon, 9 May 2022 06:20:17 +0000 (11:50 +0530)]
configs: j721e_evm_defconfig: Add HBMC related configs

Enable HBMC and HyperFlash in R5SPL, A72 SPL and A72 U-Boot

Signed-off-by: Vaishnav Achath <vaishnav.a@ti.com>
[trini: Update j721e_hs_evm_a72 as well]
Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoti: j721e: enable hyperflash spl fixup for j721e
Vaishnav Achath [Mon, 9 May 2022 06:20:16 +0000 (11:50 +0530)]
ti: j721e: enable hyperflash spl fixup for j721e

On j721e, its not possible to use OSPI0 and HBMC simultaneously as they
are muxed within the Flash Subsystem hence disable HBMC by default and
keep OSPI enabled. Bootloader will fixup DT when it detects HyperFlash
mux selection instead of OSPI.

Also updated detect_enable_hyperflash to use correct GPIO when checking
hypermux selection state:
* J7200 - hypermux sel connected to WKUP_GPIO0_6
* J721E - hypermux·sel·connected·to·WKUP_GPIO0_8

Signed-off-by: Vaishnav Achath <vaishnav.a@ti.com>
2 years agoconfigs: j721e_evm.h: define CONFIG_SYS_FLASH_BASE
Vaishnav Achath [Mon, 9 May 2022 06:20:15 +0000 (11:50 +0530)]
configs: j721e_evm.h: define CONFIG_SYS_FLASH_BASE

Define CONFIG_SYS_FLASH_BASE to indicate start address of
Flash memory

Signed-off-by: Vaishnav Achath <vaishnav.a@ti.com>
2 years agoarm: k3: sysfw-loader: add hyperflash support
Vaishnav Achath [Mon, 9 May 2022 06:20:14 +0000 (11:50 +0530)]
arm: k3: sysfw-loader: add hyperflash support

add support for loading system firmware from hyperflash.

Signed-off-by: Vaishnav Achath <vaishnav.a@ti.com>
2 years agoarm: dts: k3-j721e-common-proc-board: enable hyperflash mux sel GPIO
Vaishnav Achath [Mon, 9 May 2022 06:20:13 +0000 (11:50 +0530)]
arm: dts: k3-j721e-common-proc-board: enable hyperflash mux sel GPIO

Add wkup_gpio pinmux setting which will be used for performing the
DT fixup for hbmc node according to mux selection state, on J721E
EVM, hypermux sel is tied to ·WKUP_GPIO0_8.

Signed-off-by: Vaishnav Achath <vaishnav.a@ti.com>
2 years agoarm: dts: k3-j721e-common-proc-board-u-boot: enable HyperFlash in SPL
Vaishnav Achath [Mon, 9 May 2022 06:20:12 +0000 (11:50 +0530)]
arm: dts: k3-j721e-common-proc-board-u-boot: enable HyperFlash in SPL

add u-boot,dm-spl pre-relocation property to enable hbmc in SPL.

Signed-off-by: Vaishnav Achath <vaishnav.a@ti.com>
2 years agoarm: dts: k3-j721e-r5-common-proc-board: Add HyperFlash node
Vaishnav Achath [Mon, 9 May 2022 06:20:11 +0000 (11:50 +0530)]
arm: dts: k3-j721e-r5-common-proc-board: Add HyperFlash node

J721e SoM as a 64MB HyperFlash on board. Add pinmux and DT node
for the same.

Signed-off-by: Vaishnav Achath <vaishnav.a@ti.com>
2 years agoarm: dts: k3-j721e-som-p0: Add HyperFlash node
Vaishnav Achath [Mon, 9 May 2022 06:20:10 +0000 (11:50 +0530)]
arm: dts: k3-j721e-som-p0: Add HyperFlash node

J721e SoM as a 64MB HyperFlash on board. Add pinmux and DT node
for the same.

Signed-off-by: Vaishnav Achath <vaishnav.a@ti.com>
2 years agoarm: dts: k3-j721e-mcu-wakeup: Add HyperBus Controller node
Vaishnav Achath [Mon, 9 May 2022 06:20:09 +0000 (11:50 +0530)]
arm: dts: k3-j721e-mcu-wakeup: Add HyperBus Controller node

Add DT node for HyperBus Memory Controller and hbmc-mux in the
FSS. hbmc-am654 driver uses syscon_get_regmap() call which fails
with current compatible setting.

Signed-off-by: Vaishnav Achath <vaishnav.a@ti.com>
2 years agoMerge branch '2022-06-09-add-support-for-nvmem-api' into next
Tom Rini [Thu, 9 Jun 2022 19:20:11 +0000 (15:20 -0400)]
Merge branch '2022-06-09-add-support-for-nvmem-api' into next

To quote the author:
This adds support for the nvmem-cells properties cropping up in manyb
device trees. This is an easy way to load configuration, version
information, or calibration data from a non-volatile memory source. For
more information, refer to patch 6 ("misc: Add support for nvmem
cells").

For the moment I have only added some integration tests using the
ethernet addresses. This hits the main code paths (looking up nvmem
cells) but doesn't test writing. I can add a few stand-alone tests if
desired.

2 years agotest: Load mac address using misc device
Sean Anderson [Thu, 5 May 2022 17:11:44 +0000 (13:11 -0400)]
test: Load mac address using misc device

This loads a mac address using a misc device using the nvmem interface.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
2 years agotest: Load mac address using RTC
Sean Anderson [Thu, 5 May 2022 17:11:43 +0000 (13:11 -0400)]
test: Load mac address using RTC

This uses the nvmem API to load a mac address from an RTC.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agotest: Load mac address with i2c eeprom
Sean Anderson [Thu, 5 May 2022 17:11:42 +0000 (13:11 -0400)]
test: Load mac address with i2c eeprom

This uses an i2c eeprom to load a mac address using the nvmem interface.
Enable I2C_EEPROM for sandbox SPL since it is the only sandbox config
which doesn't enable it eeprom.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agonet: Add support for reading mac addresses from nvmem cells
Sean Anderson [Thu, 5 May 2022 17:11:41 +0000 (13:11 -0400)]
net: Add support for reading mac addresses from nvmem cells

This adds support for reading mac addresses from the "mac-address" nvmem
cell. If there is no (local-)mac-address property, then we will try
reading from an nvmem cell.

For some existing examples of this property, refer to imx8mn.dtsi and
imx8mp.dtsi. Unfortunately, fuse drivers have not yet been converted
to DM.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agosandbox: Enable NVMEM
Sean Anderson [Thu, 5 May 2022 17:11:40 +0000 (13:11 -0400)]
sandbox: Enable NVMEM

This enables NVMEM for all sandbox defconfigs, enabling it to be used in
unit tests in the next few commits.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agomisc: Add support for nvmem cells
Sean Anderson [Thu, 5 May 2022 17:11:39 +0000 (13:11 -0400)]
misc: Add support for nvmem cells

This adds support for "nvmem cells" as seen in Linux. The nvmem device
class in Linux is used for various assorted ROMs and EEPROMs. In this
sense, it is similar to UCLASS_MISC, but also includes
UCLASS_I2C_EEPROM, UCLASS_RTC, and UCLASS_MTD. New drivers corresponding
to a Linux-style nvmem device should be implemented as one of the
previously-mentioned uclasses. The nvmem API acts as a compatibility
layer to adapt the (slightly different) APIs of these uclasses. It also
handles the lookup of nvmem cells.

While nvmem devices can be accessed directly, they are most often used
by reading/writing contiguous values called "cells". Cells typically
hold information like calibration, versions, or configuration (such as
mac addresses).

nvmem devices can specify "cells" in their device tree:

qfprom: eeprom@700000 {
#address-cells = <1>;
#size-cells = <1>;
reg = <0x00700000 0x100000>;

/* ... */

tsens_calibration: calib@404 {
reg = <0x404 0x10>;
};
};

which can then be referenced like:

tsens {
/* ... */
nvmem-cells = <&tsens_calibration>;
nvmem-cell-names = "calibration";
};

The tsens driver could then read the calibration value like:

struct nvmem_cell cal_cell;
u8 cal[16];
nvmem_cell_get_by_name(dev, "calibration", &cal_cell);
nvmem_cell_read(&cal_cell, cal, sizeof(cal));

Because nvmem devices are not all of the same uclass, supported uclasses
must register a nvmem_interface struct. This allows CONFIG_NVMEM to be
enabled without depending on specific uclasses. At the moment,
nvmem_interface is very bare-bones, and assumes that no initialization
is necessary. However, this could be amended in the future.

Although I2C_EEPROM and MISC are quite similar (and could likely be
unified), they present different read/write function signatures. To
abstract over this, NVMEM uses the same read/write signature as Linux.
In particular, short read/writes are not allowed, which is allowed by
MISC.

The functionality implemented by nvmem cells is very similar to that
provided by i2c_eeprom_partition. "fixed-partition"s for eeproms does
not seem to have made its way into Linux or into any device tree other
than sandbox. It is possible that with the introduction of this API it
would be possible to remove it.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
2 years agomisc: i2c_eeprom: Add fallbacks
Sean Anderson [Thu, 5 May 2022 17:11:38 +0000 (13:11 -0400)]
misc: i2c_eeprom: Add fallbacks

Add some fallback functions for when i2c_eeprom is disabled. This allows
code to reference i2c_eeprom_* functions without needing to check
whether support has been compiled in.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
2 years agomisc: i2c_eeprom: Make i2c_eeprom_write use a const buf
Sean Anderson [Thu, 5 May 2022 17:11:37 +0000 (13:11 -0400)]
misc: i2c_eeprom: Make i2c_eeprom_write use a const buf

i2c_eeprom_ops->write uses a const buf, so use one for the wrapper
function as well.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agonet: dsa: Fix segmentation fault if master fails to probe
Sean Anderson [Thu, 5 May 2022 17:11:36 +0000 (13:11 -0400)]
net: dsa: Fix segmentation fault if master fails to probe

If the DSA master fails to probe for whatever reason, then DSA devices
will continue on as if nothing is wrong. This can cause incorrect
behavior. In particular, on sandbox, dsa_sandbox_probe attempts to
access the master's private data. This is only safe to do if the master
has been probed first. Fix this by probing the master after we look it
up, and bailing out if we get an error.

Fixes: fc054d563b ("net: Introduce DSA class for Ethernet switches")
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2 years agosandbox: Move some mac addresses to device tree
Sean Anderson [Thu, 5 May 2022 17:11:35 +0000 (13:11 -0400)]
sandbox: Move some mac addresses to device tree

This prevents some conflicts when running sandbox with -D, since the
"rom" mac address will be random and won't match the environment. We
still need to keep addresses for eth1 and eth6 in the environment,
because dm_test_eth_rotate expects to be able to disable them by
removing their envaddr variables. This can likely be fixed in a future
series by adding a function to cause sandbox eth_opts callback for a
particular mac to fail immediately.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agosandbox: Remove eth2addr from environment
Sean Anderson [Thu, 5 May 2022 17:11:34 +0000 (13:11 -0400)]
sandbox: Remove eth2addr from environment

DSA interfaces use the same mac address for each interface, unless
instructed otherwise. Just set eth4addr and let eth2addr and eth7addr be
set automatically.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agosandbox: net: Remove fake-host-hwaddr
Sean Anderson [Thu, 5 May 2022 17:11:33 +0000 (13:11 -0400)]
sandbox: net: Remove fake-host-hwaddr

Instead of reading a pseudo-rom mac address from the device tree, just use
whatever we get from write_hwaddr. This has the effect of using the mac
address from the environment (or from the device tree, if it is
specified).

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Ramon Fried <rfried.dev@gmail.com>
2 years agotest: eth: Add test for ethernet addresses
Sean Anderson [Thu, 5 May 2022 17:11:32 +0000 (13:11 -0400)]
test: eth: Add test for ethernet addresses

This adds a test to make sure that all the ethernet interfaces have
their addresses read properly. At the moment everything is read from the
environment, but the next few commits will add additional sources.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agosandbox: net: Add mac address for eth8 to environment
Sean Anderson [Thu, 5 May 2022 17:11:31 +0000 (13:11 -0400)]
sandbox: net: Add mac address for eth8 to environment

The phy_eth0 interface introduced in commit f3dd213e15 ("net: introduce
helpers to get PHY ofnode from MAC") uses a globally-administered
address. Switch to using a locally-administered address, and add it to
the sandbox environment, like the others.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
2 years agosandbox: net: Add aliases for ethernet devices
Sean Anderson [Thu, 5 May 2022 17:11:30 +0000 (13:11 -0400)]
sandbox: net: Add aliases for ethernet devices

Commit f3dd213e15 ("net: introduce helpers to get PHY ofnode from MAC")
changed the ethernet sequence assignment from

uclass 36: ethernet
0   * eth@10002000 @ 05813460, seq 0
1   * eth@10003000 @ 05813550, seq 5
2   * sbe5 @ 05813640, seq 3
3   * eth@10004000 @ 05813730, seq 6
4   * dsa-test-eth @ 05813820, seq 4
5   * lan0 @ 05813a30, seq 2
6   * lan1 @ 05813b50, seq 7

to

uclass 36: ethernet
0   * eth@10002000 @ 03813630, seq 0
1   * eth@10003000 @ 03813720, seq 5
2   * sbe5 @ 03813810, seq 3
3   * eth@10004000 @ 03813900, seq 6
4     phy-test-eth @ 038139f0, seq 7
5   * dsa-test-eth @ 03813ae0, seq 4
6   * lan0 @ 03813cf0, seq 2
7   * lan1 @ 03813e10, seq 8

This caused the mac address assignment to switch around. Avoid this in
the future by assigning aliases for all ethernet devices. This reverts
the sequence to what it was before the aformentioned commit (with
phy-test-eth as seq 8). There is no ethernet1 for whatever reason.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
2 years agoMerge branch '2022-06-08-virtio-harden-and-test-vring' into next
Tom Rini [Wed, 8 Jun 2022 15:15:28 +0000 (11:15 -0400)]
Merge branch '2022-06-08-virtio-harden-and-test-vring' into next

To quote the author:
Make the virtio ring code resilient against corruption of the buffers
shared with the device.

It follows the example of Linux by keeping a private copy of the
descriptors and metadata for state tracking and only ever writing to the
descriptors that are shared with the device. I was able to test these
hardening steps in the sandbox by simulating device writes to the
queues.

2 years agotest: dm: virtio_rng: Test virtio-rng with faked device
Andrew Scull [Mon, 16 May 2022 10:41:40 +0000 (10:41 +0000)]
test: dm: virtio_rng: Test virtio-rng with faked device

Add a regression test for virtio-rng reading beyond the end of its
buffer if the virtio device provides an invalid length.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agovirtio: rng: Check length before copying
Andrew Scull [Mon, 16 May 2022 10:41:39 +0000 (10:41 +0000)]
virtio: rng: Check length before copying

Check the length of data written by the device is consistent with the
size of the buffers to avoid out-of-bounds memory accesses in case
values aren't consistent.

Signed-off-by: Andrew Scull <ascull@google.com>
Cc: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agotest: dm: virtio: Test virtio device driver probing
Andrew Scull [Mon, 16 May 2022 10:41:38 +0000 (10:41 +0000)]
test: dm: virtio: Test virtio device driver probing

Once the virtio-rng driver has been bound, probe it to trigger the pre
and post child probe hooks of the virtio uclass driver. Check the status
of the virtio device to confirm it reached the expected state.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agovirtio: sandbox: Bind RNG rather than block device
Andrew Scull [Mon, 16 May 2022 10:41:37 +0000 (10:41 +0000)]
virtio: sandbox: Bind RNG rather than block device

The virtio-rng driver is extremely simple, making it suitable for
testing more of the virtio uclass logic. Have the sandbox driver bind
the virtio-rng driver rather than the virtio-blk driver so it can be
used in tests.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agotest: dm: virtio: Split out virtio device tests
Andrew Scull [Mon, 16 May 2022 10:41:36 +0000 (10:41 +0000)]
test: dm: virtio: Split out virtio device tests

Virtio tests that find a child device require the virtio device driver
to be included in the build so it can probe. The sandbox virtio
transport driver currently reports a virtio-blk device so make sure the
corresponding driver is built before running tests that need it.

Signed-off-by: Andrew Scull <ascull@google.com>
2 years agotest: dm: virtio: Test notify before del_vqs
Andrew Scull [Mon, 16 May 2022 10:41:35 +0000 (10:41 +0000)]
test: dm: virtio: Test notify before del_vqs

The virtqueue is passed to virtio_notify() so move the virtqueue
deletion to the end of the test when it's no longer needed. This wasn't
causing any problems because the sandbox virtio transport driver doesn't
do anything for notifications, but it could cause problems if things
change and it was a bad example.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agovirtio: sandbox: Fix device features bitfield
Andrew Scull [Mon, 16 May 2022 10:41:34 +0000 (10:41 +0000)]
virtio: sandbox: Fix device features bitfield

The virtio sandbox transport was setting the device features value to
the bit index rather than shifting a bit to the right index. Fix this
using the bit manipulation macros.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agodm: test: virtio: Test the virtio ring
Andrew Scull [Mon, 16 May 2022 10:41:33 +0000 (10:41 +0000)]
dm: test: virtio: Test the virtio ring

The virtio ring is the basis of virtio communication. Test its basic
functionality and its resilience against corruption from the device.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agovirtio_ring: Check used descriptors are chain heads
Andrew Scull [Mon, 16 May 2022 10:41:32 +0000 (10:41 +0000)]
virtio_ring: Check used descriptors are chain heads

When the device returns used buffers, it should refer to the descriptor
that is the head of the descriptor chain for that buffer. Confirm this
to be the case by tracking the head of descriptor chains that have been
made available to the device.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agovirtio_ring: Maintain a shadow copy of descriptors
Andrew Scull [Mon, 16 May 2022 10:41:31 +0000 (10:41 +0000)]
virtio_ring: Maintain a shadow copy of descriptors

The shared descriptors should only be written by the guest driver,
however, the device is still able to overwrite and corrupt them.
Maintain a private shadow copy of the descriptors for the driver to
use for state tracking, removing the need to read from the shared
descriptors.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agovirtio_ring: Add helper to attach vring descriptor
Andrew Scull [Mon, 16 May 2022 10:41:30 +0000 (10:41 +0000)]
virtio_ring: Add helper to attach vring descriptor

Move the logic for attaching a descriptor to its own function.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agovirtio_ring: Merge identical variables
Andrew Scull [Mon, 16 May 2022 10:41:29 +0000 (10:41 +0000)]
virtio_ring: Merge identical variables

The variables `total_sg` and `descs_used` have the same value. Replace
the few uses of `total_sg` with `descs_used` to simplify the situation.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agoMerge branch '2022-06-07-assorted-improvements' into next
Tom Rini [Tue, 7 Jun 2022 16:21:57 +0000 (12:21 -0400)]
Merge branch '2022-06-07-assorted-improvements' into next

- A wide ranging set of minor clean-ups and improvements

2 years agoserial: Replace CONFIG_DEBUG_UART_BASE by CONFIG_VAL(DEBUG_UART_BASE)
Pali Rohár [Fri, 27 May 2022 20:15:24 +0000 (22:15 +0200)]
serial: Replace CONFIG_DEBUG_UART_BASE by CONFIG_VAL(DEBUG_UART_BASE)

CONFIG_VAL(DEBUG_UART_BASE) expands to CONFIG_DEBUG_UART_BASE or
CONFIG_SPL_DEBUG_UART_BASE or CONFIG_TPL_DEBUG_UART_BASE and allows boards
to set different values for SPL, TPL and U-Boot Proper.

For ns16550 driver this support is there since commit d293759d55cc
("serial: ns16550: Add support for SPL_DEBUG_UART_BASE").

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoqfw: Don't fail if setup data size is 0
Pierre-Clément Tosi [Wed, 25 May 2022 13:38:55 +0000 (14:38 +0100)]
qfw: Don't fail if setup data size is 0

Skip missing setup data (which is valid) rather than failing with an
error.

Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Reported-by: Andrew Walbran <qwandor@google.com>
Signed-off-by: Pierre-Clément Tosi <ptosi@google.com>
2 years agoubifs: Add missing dependency on GZIP
Pali Rohár [Mon, 23 May 2022 20:50:36 +0000 (22:50 +0200)]
ubifs: Add missing dependency on GZIP

GZIP option can be manually de-selected when UBIFS is enabled. This cause
following compile error because ubifs calls gzip functions.

  /tmp/ccxVrh2c.ltrans1.ltrans.o: in function `gzip_decompress.lto_priv.566':
  <artificial>:(.text+0x768): undefined reference to `zunzip'
  collect2: error: ld returned 1 exit status
  make: *** [Makefile:1813: u-boot] Error 1

So add missing dependency on GZIP.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoinclude/configs: Remove rootwait=1 to all the affected boards
Michael Trimarchi [Sun, 22 May 2022 13:22:08 +0000 (15:22 +0200)]
include/configs: Remove rootwait=1 to all the affected boards

rootwait=1 is not a valid kernel boot parameters. According
to the documenation is only rootwait

rootwait [KNL] Wait (indefinitely) for root device to show up.
Useful for devices that are detected asynchronously
(e.g. USB and MMC devices).

Fix:
Unknown kernel command line parameters "rootwait=1", will be passed to user space.

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
2 years agocommon/board_r.c: drop legacy and unused bi_enetaddr
Rasmus Villemoes [Fri, 20 May 2022 11:19:08 +0000 (13:19 +0200)]
common/board_r.c: drop legacy and unused bi_enetaddr

The bi_enetaddr field in struct bd_info is write-only; nothing ever
reads back the value.

Moreover, the value we write is more or less random, and certainly not
something one can rely on: If the board has a writable environment and
the mac address has been stored there, we fetch that value. But if the
board doesn't, this code runs before initr_net() -> eth_initialize(),
and thus before the code in eth-uclass which fetches MAC addresses
from eeprom, fuses or whatnot and populates the (run-time) environment
with those values.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agobootm: Fix Linux silent console on newer kernels
Sean Anderson [Thu, 19 May 2022 22:26:05 +0000 (18:26 -0400)]
bootm: Fix Linux silent console on newer kernels

Linux determines its console based on several sources:

1. the console command line parameter
2. device tree (e.g. /chosen/stdout-path)
3. various other board- and arch-specific sources

If the console parameter specifies a real console (e.g. ttyS0) then that is
used as /dev/console. However, if it does not specify a real console (e.g.
ttyDoesntExist) then *nothing* will be used as /dev/console.
Reading/writing it will return ENODEV. Additionally, no other source will
be used as a console source.

Linux commit ab4af56ae250 ("printk/console: Allow to disable console output
by using console="" or console=null") recently changed the semantics of the
parameter. Previously, specifying console="" would be treated like
specifying some other bad console. This commit changed things so that it
added /dev/ttynull as a console (if available).  However, it also allows
for other console sources. If the device tree specifies a console (such as
if U-Boot and Linux share a device tree), then it will be used in addition
to /dev/ttynull. This can result in a non-silent console.

To avoid this, explicitly set ttynull as the console. This will disable
other console sources. If CONFIG_NULL_TTY is disabled, then this will have
the same behavior as in the past (no output, and writing /dev/console
returns ENODEV).

[1] and [2] have additional background on this kernel change.

[1] https://lore.kernel.org/all/20201006025935.GA597@jagdpanzerIV.localdomain/
[2] https://lore.kernel.org/all/20201111135450.11214-1-pmladek@suse.com/

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
2 years agopci: Handle failed calloc in decode_regions()
Pierre-Clément Tosi [Thu, 19 May 2022 16:48:30 +0000 (17:48 +0100)]
pci: Handle failed calloc in decode_regions()

Add a check for calloc() failing to allocate the requested memory.

Make decode_regions() return an error code.

Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stefan Roese <sr@denx.de>
Signed-off-by: Pierre-Clément Tosi <ptosi@google.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agofdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ
Rasmus Villemoes [Thu, 19 May 2022 09:10:43 +0000 (11:10 +0200)]
fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ

Asking if the alias we found actually points at the device tree node
we passed in (in the guise of its offset from blob) can be done simply
by asking if the fdt_path_offset() of the alias' path is identical to
offset.

In fact, the current method suffers from the possibility of false
negatives: dtc does not necessarily emit a phandle property for a node
just because it is referenced in /aliases; it only emits a phandle
property for a node if it is referenced in <angle brackets>
somewhere. So if both the node we passed in and the alias node we're
considering don't have phandles, fdt_get_phandle() returns 0 for both.

Since the proper check is so simple, there's no reason to hide that
behind a config option (and if one really wanted that, it should be
called something else because there's no need to involve phandle in
the check).

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Acked-by: Aswath Govindraju <a-govindraju@ti.com>
2 years agodrivers:optee:rpmb: initialize drivers of mmc devices in UCLASS_BLK for rpmb access
Judy Wang [Tue, 3 May 2022 06:04:40 +0000 (14:04 +0800)]
drivers:optee:rpmb: initialize drivers of mmc devices in UCLASS_BLK for rpmb access

CONFIG_MMC only initializes drivers for devices in UCLASS_MMC, we need
to initialize drivers for devices of type IF_TYPE_MMC in UCLASS_BLK as
well because they are the child devices of devices in UCLASS_MMC.  This
is required for feature RPMB since it will access eMMC in optee-os.

Signed-off-by: Judy Wang <wangjudy@microsoft.com>
[trini: Add my SoB line and adjust Judy's name in git, having emailed
off-list]
Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoserial: smh: Fake tstc
Sean Anderson [Tue, 17 May 2022 17:55:07 +0000 (13:55 -0400)]
serial: smh: Fake tstc

ARM semihosting provides no provisions for determining if there is
pending input. The only way to determine if there is console input is to
do a read (and block until the user types something). For this reason,
we always return true for tstc (since you will always get input if you
try). However, this behavior can cause problems for code which expects
tstc to eventually be empty. In query_console_serial, there is the
following construct:

/* empty input buffer */
while (tstc())
getchar();

with the current implementation, this effectively turns into an infinite
loop. To avoid this, fake tstc by returning false half of the time. This
is generally OK because the other common construct looks like

do {
if (tstc())
process(getchar());
} while (!timeout());

so it's fine if we only read a new character every other loop. This will
break things like CYGACC_COMM_IF_GETC_TIMEOUT, but that could be
reworked to test on the timeout instead of calling tstc again (and
ymodem over semihosted serial is not that useful in the first place).

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
2 years agodm: core: convert of_machine_is_compatible to livetree
Patrick Delaunay [Tue, 17 May 2022 12:37:05 +0000 (14:37 +0200)]
dm: core: convert of_machine_is_compatible to livetree

Replace in the function of_machine_is_compatible(), the used API
fdt_node_check_compatible() by ofnode_device_is_compatible()
to support a live tree.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2 years agomkimage: Support signing 'auto' FITs
Sean Anderson [Mon, 16 May 2022 20:11:08 +0000 (16:11 -0400)]
mkimage: Support signing 'auto' FITs

This adds support for signing images in auto-generated FITs. To do this,
we need to add a signature node. The algorithm name property already has
its own option, but we need one for the key name hint. We could have
gone the -G route and added an explicit name for the public key (like
what is done for the private key). However, many places assume the
public key can be constructed from the key dir and hint, and I don't
want to do the refactoring necessary.

As a consequence of this, it is now easier to add public keys to an
existing image without signing something. This could be done all along,
but now you don't have to create an its just to do it. Ideally, we
wouldn't create a FIT at the end. This could be done by calling
fit_image_setup_sig/info.crypto->add_verify_data directly.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
2 years agomkimage: Document more misc options
Sean Anderson [Mon, 16 May 2022 20:11:07 +0000 (16:11 -0400)]
mkimage: Document more misc options

Document -G and the secondary image types which can be used with -R.
Also reword the documentation of -s for clarity.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
2 years agoevent: fix static events for CONFIG_NEEDS_MANUAL_RELOC
Ovidiu Panait [Sun, 15 May 2022 18:40:29 +0000 (21:40 +0300)]
event: fix static events for CONFIG_NEEDS_MANUAL_RELOC

Static events do not currently work post-relocation for boards that enable
CONFIG_NEEDS_MANUAL_RELOC. Relocate event handler pointers for all event
spies to fix this.

Tested on Microblaze.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
2 years agoevent: remove CONFIG_EVENT_DYNAMIC check in event_register()
Ovidiu Panait [Sun, 15 May 2022 18:40:28 +0000 (21:40 +0300)]
event: remove CONFIG_EVENT_DYNAMIC check in event_register()

The whole event_register() function is wrapped in EVENT_DYNAMIC #ifdef
checks, so the inner check is not needed:

 #if CONFIG_IS_ENABLED(EVENT_DYNAMIC)
 ...
 int event_register(...)
 {
     ...
     if (!CONFIG_IS_ENABLED(EVENT_DYNAMIC))
         return -ENOSYS;
 }
 #endif

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
2 years agomtd: mtdpart: Change size type from fdt_addr_t to fdt_size_t
Pali Rohár [Fri, 13 May 2022 20:24:51 +0000 (22:24 +0200)]
mtd: mtdpart: Change size type from fdt_addr_t to fdt_size_t

Set correct type for 3rd argument of ofnode_get_addr_size_index_notrans()
function. It expects fdt_size_t * and not fdt_addr_t *.

When these two types do not have same size then U-Boot throw compile
warning:

    drivers/mtd/mtdpart.c: In function ‘add_mtd_partitions_of’:
    drivers/mtd/mtdpart.c:906:57: warning: passing argument 3 of ‘ofnode_get_addr_size_index_notrans’ from incompatible pointer type [-Wincompatible-pointer-types]
       offset = ofnode_get_addr_size_index_notrans(child, 0, &size);
                                                             ^~~~~
    In file included from include/dm/device.h:13,
                     from include/linux/mtd/mtd.h:26,
                     from include/ubi_uboot.h:28,
                     from drivers/mtd/mtdpart.c:27:
    include/dm/ofnode.h:530:25: note: expected ‘fdt_size_t *’ {aka ‘long long unsigned int *’} but argument is of type ‘fdt_addr_t *’ {aka ‘long unsigned int *’}
                 fdt_size_t *size);
                 ~~~~~~~~~~~~^~~~

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
2 years agoscripts: Introduce {quiet_,}cmd_bin2c
Pierre-Clément Tosi [Wed, 11 May 2022 09:36:07 +0000 (10:36 +0100)]
scripts: Introduce {quiet_,}cmd_bin2c

Add a make command to compile binary files as C data through bin2c with

    $(call,bin2c,<data_name_prefix>)

Note that this requires BUILD_BIN2C=y.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Pierre-Clément Tosi <ptosi@google.com>
2 years agofs/squashfs: fix sqfs_read_sblk()
Heinrich Schuchardt [Tue, 10 May 2022 19:53:25 +0000 (21:53 +0200)]
fs/squashfs: fix sqfs_read_sblk()

Setting sblk = NULL has no effect on the caller.
We want to set *sblk = NULL if an error occurrs to avoid usage after free.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agobtrfs: simplify lookup_data_extent()
Heinrich Schuchardt [Tue, 10 May 2022 19:43:38 +0000 (21:43 +0200)]
btrfs: simplify lookup_data_extent()

After returning if ret <= 0 we know that ret > 0. No need to check it.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Anand Jain <anand.jain>
2 years agozlib: Port fix for CVE-2018-25032 to U-Boot
Tom Rini [Tue, 10 May 2022 18:36:59 +0000 (14:36 -0400)]
zlib: Port fix for CVE-2018-25032 to U-Boot

While our copy of zlib is missing upstream commit 263b1a05b04e ("Allow
deflatePrime() to insert bits in the middle of a stream.") we do have
Z_FIXED support, and so the majority of the code changes in 5c44459c3b28
("Fix a bug that can crash deflate on some input when using Z_FIXED.")
apply here directly and cleanly.  As this has been assigned a CVE, lets
go and apply these changes.

Link: https://github.com/madler/zlib/commit/5c44459c3b28a9bd3283aaceab7c615f8020c531
Reported-by: "Gan, Yau Wai" <yau.wai.gan@intel.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agomisc: Correct Kconfig dependencies for a number of options
Tom Rini [Tue, 10 May 2022 16:51:47 +0000 (12:51 -0400)]
misc: Correct Kconfig dependencies for a number of options

We have many cases of SPL (or TPL or VPL) drivers that don't depend on
SPL_MISC (and so on) but rather just MISC.

Cc: Sean Anderson <sean.anderson@seco.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sean Anderson <sean.anderson@seco.com>
2 years agodoc: regulator: Add regulator-force-boot-off binding
Chris Packham [Mon, 9 May 2022 21:58:28 +0000 (09:58 +1200)]
doc: regulator: Add regulator-force-boot-off binding

The actual support was added in commit fec8c900c8b2 ("power: regulator:
Add support for regulator-force-boot-off"), update the docs to include
this.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2 years agocmd: dm: migrate dm command to use U_BOOT_CMD_WITH_SUBCMDS()
Ovidiu Panait [Sun, 8 May 2022 10:01:42 +0000 (13:01 +0300)]
cmd: dm: migrate dm command to use U_BOOT_CMD_WITH_SUBCMDS()

Migrate dm command to use U_BOOT_CMD_WITH_SUBCMDS() helper macro, to reduce
duplicated code. We can also drop the CONFIG_NEEDS_MANUAL_RELOC exception,
as the command list is updated post relocation in board_r.c initcall
initr_manual_reloc_cmdtable().

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
2 years agodm: fix DM_EVENT dependencies
Heinrich Schuchardt [Sat, 7 May 2022 20:39:01 +0000 (22:39 +0200)]
dm: fix DM_EVENT dependencies

CONFIG_DM_EVENT without CONFIG_EVENT is non-functional.
Let CONFIG_DM_EVENT depend on CONFIG_EVENT.

Remove superfluous stub in include/event.h.

Fixes: 5b896ed5856f ("event: Add events for device probe/remove")
Reported-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>