platform/kernel/u-boot.git
3 years agoarm: dts: am642-sk: Add initial sk dts
Lokesh Vutla [Thu, 6 May 2021 11:14:59 +0000 (16:44 +0530)]
arm: dts: am642-sk: Add initial sk dts

AM642 StarterKit (SK) board is a low cost, small form factor board
designed for TI’s AM642 SoC. It supports the following interfaces:
* 2 GB LPDDR4 RAM
* x2 Gigabit Ethernet interfaces capable of working in switch and MAC mode
* x1 USB 3.0 Type-A port
* x1 UHS-1 capable µSD card slot
* 2.4/5 GHz WLAN + Bluetooth 4.2 through WL1837
* 512 Mbit OSPI flash
* x2 UART through UART-USB bridge
* XDS110 for onboard JTAG debug using USB
* Temperature sensors, user push buttons and LEDs
* 40-pin Raspberry Pi compatible GPIO header
* 24-pin header for peripherals in MCU island (I2C, UART, SPI, IO)
* 54-pin header for Programmable Realtime Unit (PRU) IO pins
* Interface for remote automation. Includes:
* power measurement and reset control
* boot mode change

Add basic support for AM642 SK.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
3 years agoarm: dts: am642-evm: Add I2C nodes
Lokesh Vutla [Thu, 6 May 2021 11:14:58 +0000 (16:44 +0530)]
arm: dts: am642-evm: Add I2C nodes

Add I2C nodes for AM64 and enable pinmux for i2c0 for reading eeprom data.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
3 years agoarm: dts: k3-am642-r5-evm: Do not use power-domains for I2C
Lokesh Vutla [Thu, 6 May 2021 11:14:57 +0000 (16:44 +0530)]
arm: dts: k3-am642-r5-evm: Do not use power-domains for I2C

I2C EEPROM will be probed before SYSFW is available.
So drop the power-domains property for I2C.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
3 years agoarm: dts: k3-am64-evm: Make chip id available before pre-reloc
Lokesh Vutla [Thu, 6 May 2021 11:14:56 +0000 (16:44 +0530)]
arm: dts: k3-am64-evm: Make chip id available before pre-reloc

Chipid will be needed for SoC detection for all stages of U-Boot.
So make it u-boot,dm-spl

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
3 years agoinclude: configs: Update env for selecting right dtb
Lokesh Vutla [Thu, 6 May 2021 11:14:55 +0000 (16:44 +0530)]
include: configs: Update env for selecting right dtb

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

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
3 years agoinclude: configs: am64x_evm: Optimize size of SPL BSS
Lokesh Vutla [Thu, 6 May 2021 11:14:54 +0000 (16:44 +0530)]
include: configs: am64x_evm: Optimize size of SPL BSS

Current BSS allocation of SPL is as below:
size spl/u-boot-spl
   text    data     bss     dec     hex filename
 144572    5484    1752  151808   25100 spl/u-boot-spl

But 20KB is allocated currently for BSS. Reduce it to 4KB and
save some space for stack.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
3 years agoinclude: configs: am64x: Avoid overlap of BSS and stack area
Lokesh Vutla [Thu, 6 May 2021 11:14:53 +0000 (16:44 +0530)]
include: configs: am64x: Avoid overlap of BSS and stack area

Avoid R5 SPL stack writing into ROM index table. Re-use the same space
for storing EEPROM data.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
3 years agoarm: am64x: Add support for selecting DT based on EEPROM
Lokesh Vutla [Thu, 6 May 2021 11:14:52 +0000 (16:44 +0530)]
arm: am64x: Add support for selecting DT based on EEPROM

Enable support for selecting DTB within SPL based on EEPROM.
This will help to use single defconfig for both EVM and SK

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
3 years agoboard: ti: am64x: Add support for detecting multiple device trees
Lokesh Vutla [Thu, 6 May 2021 11:14:51 +0000 (16:44 +0530)]
board: ti: am64x: Add support for detecting multiple device trees

Update the board_fit_config_name_match() to choose the right dtb.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
3 years agoboard: ti: am64x: Enable support for reading EEPROM in R5 SPL
Lokesh Vutla [Thu, 6 May 2021 11:14:50 +0000 (16:44 +0530)]
board: ti: am64x: Enable support for reading EEPROM in R5 SPL

Include the relevant configs to enable support for reading EEPROM in
R5SPL.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
3 years agoboard: ti: am64x: Add support for reading eeprom data
Lokesh Vutla [Thu, 6 May 2021 11:14:49 +0000 (16:44 +0530)]
board: ti: am64x: Add support for reading eeprom data

I2C EEPROM data contains the board name and its revision.
Add support for:
- Reading EEPROM data and store a copy at end of SRAM
- Updating env variable with relevant board info
- Printing board info during boot.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
3 years agosoc: ti: k3-socinfo: Add entry for AM64X SoC family
Lokesh Vutla [Thu, 6 May 2021 11:14:48 +0000 (16:44 +0530)]
soc: ti: k3-socinfo: Add entry for AM64X SoC family

Add support for AM64 SoC identification.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
3 years agoconfigs: am64x_evm_r5: Enable GPIO regulator
Nishanth Menon [Tue, 4 May 2021 23:00:56 +0000 (18:00 -0500)]
configs: am64x_evm_r5: Enable GPIO regulator

Enable GPIO regulator.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoarm: dts: k3-am642-r5-evm: Add GPIO DDR VTT regulator
Nishanth Menon [Tue, 4 May 2021 23:00:55 +0000 (18:00 -0500)]
arm: dts: k3-am642-r5-evm: Add GPIO DDR VTT regulator

Add DDR VTT regulator.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoarm: dts: k3-am64-main: Add GPIO nodes
Nishanth Menon [Tue, 4 May 2021 23:00:54 +0000 (18:00 -0500)]
arm: dts: k3-am64-main: Add GPIO nodes

Add main domain GPIO nodes.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoarm: mach-k3: am642: Add support for triggering ddr init from SPL
Dave Gerlach [Tue, 4 May 2021 23:00:53 +0000 (18:00 -0500)]
arm: mach-k3: am642: Add support for triggering ddr init from SPL

In SPL, DDR should be made available by the end of board_init_f()
so that apis in board_init_r() can use ddr. Adding support for
triggering DDR initialization from board_init_f().

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoarm: dts: k3-am642: Add ddr node
Dave Gerlach [Tue, 4 May 2021 23:00:52 +0000 (18:00 -0500)]
arm: dts: k3-am642: Add ddr node

Introduce ddr node for am642 needed for all ddr configurations.

Also, introduce the 1600MTs DDR4 configuration that is supported on the
am642-evm.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoram: k3-ddrss: Enable vtt regulator if present
Lokesh Vutla [Tue, 11 May 2021 15:22:13 +0000 (10:22 -0500)]
ram: k3-ddrss: Enable vtt regulator if present

Attempt to get and enable a vtt regulator if one is provided from the
dts. If we do not find one, continue as not all platforms have this.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoram: k3-ddrss: Introduce support for AM642 SoCs
Dave Gerlach [Tue, 11 May 2021 15:22:12 +0000 (10:22 -0500)]
ram: k3-ddrss: Introduce support for AM642 SoCs

Introduce support for the AM64 DDRSS controller which uses the 16bit
variation of the controller. This controller shares much functionality
with the existing J721e support, so this patch introduces only the new
code needed for am64 specific support from "_16bit_" files with headers
under "16bit/" include path/.

Also add a CONFIG_K3_AM64_DDRSS option to the choice required for use
with CONFIG_K3_DDRSS to allow selecting AM64 support.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoram: k3-ddrss: Introduce common driver with J7 SoC support
Dave Gerlach [Tue, 11 May 2021 15:22:11 +0000 (10:22 -0500)]
ram: k3-ddrss: Introduce common driver with J7 SoC support

Introduce a new version of the ddr driver which has the ability to
support different variations of the controller. Also introduce support
for the 32bit variation of the controller which is what was already
supported by the previous version used for J721e and J7200.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoram: k3-ddrss: Introduce top-level CONFIG_K3_DDRSS
Dave Gerlach [Tue, 11 May 2021 15:22:10 +0000 (10:22 -0500)]
ram: k3-ddrss: Introduce top-level CONFIG_K3_DDRSS

Create a new CONFIG_K3_DDRSS option to select the common parts of the
k3-ddrss driver. Also introduce a choice that depends on the top level
option to select CONFIG_K3_J721E_DDRSS for j721e support, and update
corresponding Kconfig as required.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoram: k3-j721e: Rename to k3-ddrss
Dave Gerlach [Tue, 11 May 2021 15:22:09 +0000 (10:22 -0500)]
ram: k3-j721e: Rename to k3-ddrss

Rename the k3-j721e folder under drivers/ram to k3-ddrss in preparation
of introducing additional support for other platforms to the same
driver.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoram: k3-j721e: lpddr4_ctl_regs: Fix checkpatch issue for types
Dave Gerlach [Tue, 11 May 2021 15:22:08 +0000 (10:22 -0500)]
ram: k3-j721e: lpddr4_ctl_regs: Fix checkpatch issue for types

Use Linux style u32 instead of uint32_t.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoram: k3-j721e: lpddr4_pi_macros: Fix indentation issues
Dave Gerlach [Tue, 11 May 2021 15:22:07 +0000 (10:22 -0500)]
ram: k3-j721e: lpddr4_pi_macros: Fix indentation issues

Fix the indentation for certain macros to be consistent with the other
macros in the file, as the existing indentation does not make sense in
many places.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoram: k3-j721e: lpddr4_phy_core_macros: Fix indentation issues
Dave Gerlach [Tue, 11 May 2021 15:22:06 +0000 (10:22 -0500)]
ram: k3-j721e: lpddr4_phy_core_macros: Fix indentation issues

Fix the indentation for certain macros to be consistent with the other
macros in the file, as the existing indentation does not make sense in
many places.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoram: k3-j721e: lpddr4_ddr_controller_macros: Fix indentation issues
Dave Gerlach [Tue, 11 May 2021 15:22:05 +0000 (10:22 -0500)]
ram: k3-j721e: lpddr4_ddr_controller_macros: Fix indentation issues

Fix the indentation for certain macros to be consistent with the other
macros in the file, as the existing indentation does not make sense in
many places.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoram: k3-j721e: lpddr4_data_slice_3_macros: Fix indentation issues
Dave Gerlach [Tue, 11 May 2021 15:22:04 +0000 (10:22 -0500)]
ram: k3-j721e: lpddr4_data_slice_3_macros: Fix indentation issues

Fix the indentation for certain macros to be consistent with the other
macros in the file, as the existing indentation does not make sense in
many places.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoram: k3-j721e: lpddr4_data_slice_2_macros: Fix indentation issues
Dave Gerlach [Tue, 11 May 2021 15:22:03 +0000 (10:22 -0500)]
ram: k3-j721e: lpddr4_data_slice_2_macros: Fix indentation issues

Fix the indentation for certain macros to be consistent with the other
macros in the file, as the existing indentation does not make sense in
many places.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoram: k3-j721e: lpddr4_data_slice_1_macros: Fix indentation issues
Dave Gerlach [Tue, 11 May 2021 15:22:02 +0000 (10:22 -0500)]
ram: k3-j721e: lpddr4_data_slice_1_macros: Fix indentation issues

Fix the indentation for certain macros to be consistent with the other
macros in the file, as the existing indentation does not make sense in
many places.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoram: k3-j721e: lpddr4_data_slice_0_macros: Fix indentation issues
Dave Gerlach [Tue, 11 May 2021 15:22:01 +0000 (10:22 -0500)]
ram: k3-j721e: lpddr4_data_slice_0_macros: Fix indentation issues

Fix the indentation for certain macros to be consistent with the other
macros in the file, as the existing indentation does not make sense in
many places.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoram: k3-j721e: lpddr4_address_slice_0_macros: Fix indentation issues
Dave Gerlach [Tue, 11 May 2021 15:22:00 +0000 (10:22 -0500)]
ram: k3-j721e: lpddr4_address_slice_0_macros: Fix indentation issues

Fix the indentation for certain macros to be consistent with the other
macros in the file, as the existing indentation does not make sense in
many places.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agodt-bindings: memory-controller: Add K3 AM64 DDRSS compatible
Dave Gerlach [Tue, 11 May 2021 15:21:59 +0000 (10:21 -0500)]
dt-bindings: memory-controller: Add K3 AM64 DDRSS compatible

Update the k3-ddrss DT binding document to include compatible
for k3,am64-ddrss.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoconfigs: am64x_evm_a53: Add Initial support
Dave Gerlach [Fri, 23 Apr 2021 16:27:48 +0000 (11:27 -0500)]
configs: am64x_evm_a53: Add Initial support

Add initial A53 defconfig support for AM64x SoCs.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoconfigs: am64x_evm_r5: Add Initial support
Dave Gerlach [Fri, 23 Apr 2021 16:27:47 +0000 (11:27 -0500)]
configs: am64x_evm_r5: Add Initial support

Add initial R5 defconfig support for AM64x SoCs.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoarm: dts: k3-am642: Add r5 specific dt support
Dave Gerlach [Fri, 23 Apr 2021 16:27:46 +0000 (11:27 -0500)]
arm: dts: k3-am642: Add r5 specific dt support

Add initial support for dt that runs on r5.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoarm: dts: k3-am642: Add initial support for EVM
Dave Gerlach [Fri, 23 Apr 2021 16:27:45 +0000 (11:27 -0500)]
arm: dts: k3-am642: Add initial support for EVM

The AM642 EValuation Module (EVM) is a board that provides access to
various peripherals available on the AM642 SoC, such as PCIe, USB 2.0,
CPSW Ethernet, ADC, and more.

Add basic support.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoarm: dts: ti: Add Support for AM642 SoC
Dave Gerlach [Fri, 23 Apr 2021 16:27:44 +0000 (11:27 -0500)]
arm: dts: ti: Add Support for AM642 SoC

The AM642 SoC belongs to the K3 Multicore SoC architecture platform,
providing advanced system integration to enable applications such as
Motor Drives, PLC, Remote IO and IoT Gateways.

Some highlights of this SoC are:
* Dual Cortex-A53s in a single cluster, two clusters of dual Cortex-R5F
  MCUs, and a single Cortex-M4F.
* Two Gigabit Industrial Communication Subsystems (ICSSG).
* Integrated Ethernet switch supporting up to a total of two external
  ports.
* PCIe-GEN2x1L, USB3/USB2, 2xCAN-FD, eMMC and SD, UFS, OSPI memory
  controller, QSPI, I2C, eCAP/eQEP, ePWM, ADC, among other
  peripherals.
* Centralized System Controller for Security, Power, and Resource
  Management (DMSC).

See AM64X Technical Reference Manual (SPRUIM2, Nov 2020)
for further details: https://www.ti.com/lit/pdf/spruim2

Introduce basic support for the AM642 SoC to enable SD/MMC boot.
Introduce a limited set of MAIN domain peripherals under cbass_main and
a set of MCU domain peripherals under cbass_mcu.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agodt-bindings: pinctrl: k3: Introduce pinmux definitions for AM64
Dave Gerlach [Fri, 23 Apr 2021 16:27:43 +0000 (11:27 -0500)]
dt-bindings: pinctrl: k3: Introduce pinmux definitions for AM64

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

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoboard: ti: am64x: Add board support for am64x evm
Dave Gerlach [Fri, 23 Apr 2021 16:27:42 +0000 (11:27 -0500)]
board: ti: am64x: Add board support for am64x evm

Add board specific initialization for am64x based boards.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agomailbox: k3-sec-proxy: Extend valid thread IDs
Dave Gerlach [Fri, 23 Apr 2021 16:27:41 +0000 (11:27 -0500)]
mailbox: k3-sec-proxy: Extend valid thread IDs

AM64x uses a different thread mapping that existing K3 SoCs, so update
the valid thread ID list to include those used for AM64x.

Also remove the comment identifying the purpose of each thread ID. The
purpose of the thread ID is specified when describing the threads in the
device tree and the same ID can mean different things on different SoCs,
so the comment is not useful.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agommc: sdhci_am654: Add Support for TI's AM642 SoC
Dave Gerlach [Fri, 23 Apr 2021 16:27:40 +0000 (11:27 -0500)]
mmc: sdhci_am654: Add Support for TI's AM642 SoC

Add support for the controller present on the AM642 SoC.

There are instances:
sdhci0: 8bit bus width, max 400 MBps
sdhci1: 4bit bus width, max 100 MBps

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoarmv8: mach-k3: am642: Add custom MMU support
Keerthy [Fri, 23 Apr 2021 16:27:39 +0000 (11:27 -0500)]
armv8: mach-k3: am642: Add custom MMU support

Change the memory attributes for the DDR regions used by the remote
processors on AM65x so that the cores can see and execute the proper code.

A separate table based on the previous K3 SoCs is introduced since the
number of remote processors and their DDR usage is different between the
SoC families.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoarm: mach-k3: am642: Shut down R5 core after ATF startup on A53
Suman Anna [Fri, 23 Apr 2021 16:27:38 +0000 (11:27 -0500)]
arm: mach-k3: am642: Shut down R5 core after ATF startup on A53

The AM642 SoCs use the Main R5FSS0 as a boot processor, and runs
the R5 SPL that performs the initialization of the System Controller
processor and starting the Arm Trusted Firmware (ATF) on the Arm
Cortex A53 cluster. The Core0 serves as this boot processor and is
parked in WFE after all the initialization. Core1 does not directly
participate in the boot flow, and is simply parked in a WFI.

Power down these R5 cores (and the associated RTI timer resources
that were indirectly powered up) after starting up ATF on A53 by
using the appropriate SYSFW API in release_resources_for_core_shutdown().
This allows these Main R5F cores to be further controlled from the
A53 to run regular applications.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoarm: mach-k3: am642: Use mmc start and stop callbacks
Dave Gerlach [Fri, 23 Apr 2021 16:27:37 +0000 (11:27 -0500)]
arm: mach-k3: am642: Use mmc start and stop callbacks

To avoid any glitches on MMC clock line, make use of pm per and post
callbacks when loading sysfw.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoarm: mach-k3: am642: Load SYSFW binary and config from boot media
Dave Gerlach [Fri, 23 Apr 2021 16:27:36 +0000 (11:27 -0500)]
arm: mach-k3: am642: Load SYSFW binary and config from boot media

Use the System Firmware (SYSFW) loader framework to load and start
the SYSFW as part of the AM642 early initialization sequence. Also
make use of existing logic to detect if ROM has already loaded sysfw
and avoided attempting to reload and instead just prepare to use already
running firmware.

While at it also initialize the MAIN_UART1 pinmux as it is used by SYSFW
to print diagnostic messages.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoarm: mach-k3: am642: Store boot info from ROM
Dave Gerlach [Fri, 23 Apr 2021 16:27:35 +0000 (11:27 -0500)]
arm: mach-k3: am642: Store boot info from ROM

For AM642, ROM supports loading system firmware directly
from boot image. ROM passes information about the number of
images that are loaded to bootloader at a specific address
that is temporary.  Add support for storing this information
somewhere permanent before it gets corrupted.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoarm: mach-k3: am642: Unlock all applicable control MMR registers
Dave Gerlach [Fri, 23 Apr 2021 16:27:34 +0000 (11:27 -0500)]
arm: mach-k3: am642: Unlock all applicable control MMR registers

To access various control MMR functionality the registers need to
be unlocked. Do that for all control MMR regions in the MAIN domain.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoarm: mach-k3: am642: Add support for boot device detection
Keerthy [Fri, 23 Apr 2021 16:27:33 +0000 (11:27 -0500)]
arm: mach-k3: am642: Add support for boot device detection

AM642 allows for booting from primary or backup boot media.
Both media can be chosen individually based on switch settings.
ROM looks for a valid image in primary boot media, if not found
then looks in backup boot media. In order to pass this boot media
information to boot loader, ROM stores a value at a particular
address. Add support for reading this information and determining
the boot media correctly.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoarm: mach-k3: Add basic support for AM642 SoC definition
Dave Gerlach [Fri, 23 Apr 2021 16:27:32 +0000 (11:27 -0500)]
arm: mach-k3: Add basic support for AM642 SoC definition

The AM642 SoC belongs to the K3 Multicore SoC architecture platform,
providing advanced system integration to enable applications such as
Motor Drives, PLC, Remote IO and IoT Gateways.

Some highlights of this SoC are:
* Dual Cortex-A53s in a single cluster, two clusters of dual Cortex-R5F
  MCUs, and a single Cortex-M4F.
* Two Gigabit Industrial Communication Subsystems (ICSSG).
* Integrated Ethernet switch supporting up to a total of two external
  ports.
* PCIe-GEN2x1L, USB3/USB2, 2xCAN-FD, eMMC and SD, UFS, OSPI memory
  controller, QSPI, I2C, eCAP/eQEP, ePWM, ADC, among other
  peripherals.
* Centralized System Controller for Security, Power, and Resource
  Management (DMSC).

See AM64X Technical Reference Manual (SPRUIM2, Nov 2020)
for further details: https://www.ti.com/lit/pdf/spruim2

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
3 years agoRevert "fdt: translate address if #size-cells = <0>"
Dario Binacchi [Sat, 1 May 2021 15:05:26 +0000 (17:05 +0200)]
Revert "fdt: translate address if #size-cells = <0>"

This reverts commit d64b9cdcd475eb7f07b49741ded87e24dae4a5fc.

As pointed by [1] and [2], the reverted patch made every DT 'reg'
property translatable. What the patch was trying to fix was fixed in a
different way from previously submitted patches which instead of
correcting the generic address translation function fixed the issue with
appropriate platform code.

[1] https://patchwork.ozlabs.org/project/uboot/patch/1614324949-61314-1-git-send-email-bmeng.cn@gmail.com/
[2] https://lore.kernel.org/linux-clk/20210402192054.7934-1-dariobin@libero.it/T/

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agoclk: ti: am3-dpll: use custom API for memory access
Dario Binacchi [Sat, 1 May 2021 15:05:25 +0000 (17:05 +0200)]
clk: ti: am3-dpll: use custom API for memory access

Using the custom TI functions required not only replacing common memory
access functions but also rewriting the routines used to set bypass and
lock states. As for readl() and writel(), they also required the address
of the register to be accessed, a parameter that is hidden by the TI clk
module.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
3 years agoclk: ti: gate: use custom API for memory access
Dario Binacchi [Sat, 1 May 2021 15:05:24 +0000 (17:05 +0200)]
clk: ti: gate: use custom API for memory access

Replaces the common memory access functions used by the driver with the
ones exported from the TI clk module.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
3 years agoclk: ti: change clk_ti_latch() signature
Dario Binacchi [Sat, 1 May 2021 15:05:23 +0000 (17:05 +0200)]
clk: ti: change clk_ti_latch() signature

The clock access functions exported by the clk header use the
struct clk_ti_reg parameter to get the address of the register. This
must also apply to clk_ti_latch(). Changes to TI's clk-mux and
clk-divider drivers prevented the patch from generating compile errors.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
3 years agoclk: ti: add custom API for memory access
Dario Binacchi [Sat, 1 May 2021 15:05:22 +0000 (17:05 +0200)]
clk: ti: add custom API for memory access

As pointed by [1] and [2], commit
d64b9cdcd4 ("fdt: translate address if #size-cells = <0>") is wrong:
- It makes every 'reg' DT property translatable. It changes the address
  translation so that for an I2C 'reg' address you'll get back as reg
  the I2C controller address + reg value.
- The quirk must be fixed with platform code.

The clk_ti_get_reg_addr() is the platform code able to make the correct
address translation for the AM33xx clocks registers. Its implementation
was inspired by the Linux Kernel code.

[1] https://patchwork.ozlabs.org/project/uboot/patch/1614324949-61314-1-git-send-email-bmeng.cn@gmail.com/
[2] https://lore.kernel.org/linux-clk/20210402192054.7934-1-dariobin@libero.it/T/

Signed-off-by: Dario Binacchi <dariobin@libero.it>
3 years agoPrepare v2021.07-rc2
Tom Rini [Mon, 10 May 2021 21:03:22 +0000 (17:03 -0400)]
Prepare v2021.07-rc2

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-x86
Tom Rini [Mon, 10 May 2021 12:02:00 +0000 (08:02 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-x86

- x86: correct regwidth prompt in cbsysinfo
- virtio: convert README.virtio to reST

3 years agoMAINTAINERS: Add an entry for VirtIO
Bin Meng [Thu, 29 Apr 2021 09:40:08 +0000 (17:40 +0800)]
MAINTAINERS: Add an entry for VirtIO

This was missed when VirtIO support was initially brought to U-Boot
back in 2018. Add an entry for it and list myself as the maintainer.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
3 years agodoc: develop: Convert README.virtio to reST
Bin Meng [Thu, 29 Apr 2021 09:40:07 +0000 (17:40 +0800)]
doc: develop: Convert README.virtio to reST

This converts the existing README.virtio to reST, and puts it under
the develop/driver-model/ directory.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: Correct regwidth prompt in cbsysinfo
Simon Glass [Fri, 23 Apr 2021 22:04:57 +0000 (10:04 +1200)]
x86: Correct regwidth prompt in cbsysinfo

This should be 'regwidth', not 'baud'. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Fri, 7 May 2021 12:57:32 +0000 (08:57 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-riscv

3 years agoMerge branch '2021-05-06-misc-updates'
Tom Rini [Thu, 6 May 2021 15:00:07 +0000 (11:00 -0400)]
Merge branch '2021-05-06-misc-updates'

- Allow for boards to update bootargs before booting the OS (helpful in
  some forms of secure boot).
- Enhance GPT write support.
- gpio-sysinfo updates
- Allow env to be appended from dtb

3 years agocmd/exception: support ebreak exception on RISC-V
Heinrich Schuchardt [Fri, 9 Apr 2021 10:48:14 +0000 (10:48 +0000)]
cmd/exception: support ebreak exception on RISC-V

The ebreak instruction should generate a breakpoint exception.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
3 years agoatcspi200: Add timeout mechanism in spi_xfer()
Dylan Jhong [Thu, 1 Apr 2021 08:48:51 +0000 (16:48 +0800)]
atcspi200: Add timeout mechanism in spi_xfer()

Adding timeout mechanism to avoid spi driver from stucking
in the while loop in __atcspi200_spi_xfer().

Signed-off-by: Dylan Jhong <dylan@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
3 years agoriscv: cpu: fu740: clear feature disable CSR
Green Wan [Mon, 3 May 2021 06:23:05 +0000 (23:23 -0700)]
riscv: cpu: fu740: clear feature disable CSR

Clear feature disable CSR to turn on all features of hart. The detail
is specified at section, 'SiFive Feature Disable CSR', in user manual

https://sifive.cdn.prismic.io/sifive/aee0dd4c-d156-496e-a6c4-db0cf54bbe68_sifive_U74MC_rtl_full_20G1.03.00_manual.pdf

Signed-off-by: Green Wan <green.wan@sifive.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
3 years agoriscv: cpu: Add callback to init each core
Green Wan [Mon, 3 May 2021 06:23:04 +0000 (23:23 -0700)]
riscv: cpu: Add callback to init each core

Add a callback harts_early_init() to start.S to allow different riscv
hart perform setup code for each hart as early as possible. Since all
the harts enter the callback, they must be able to run the same
setup.

Signed-off-by: Green Wan <green.wan@sifive.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agofdt_support.c: Allow late kernel cmdline modification
Niko Mauno [Mon, 22 Feb 2021 19:18:51 +0000 (19:18 +0000)]
fdt_support.c: Allow late kernel cmdline modification

By declaring board-specific board_fdt_chosen_bootargs() the kernel
command line arguments can be adjusted before injecting to flat dt
chosen node.

Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
3 years agocmd: gpt: Add option to write GPT partitions to environment variable
Farhan Ali [Fri, 26 Feb 2021 18:17:33 +0000 (10:17 -0800)]
cmd: gpt: Add option to write GPT partitions to environment variable

This change would enhance the existing 'gpt read' command to allow
(optionally) writing of the read GPT partitions to an environment
variable in the UBOOT partitions layout format. This would allow users
to easily change the overall partition settings by editing said variable
and then using the variable in the 'gpt write' and 'gpt verify' commands.

Signed-off-by: Farhan Ali <farhan.ali@broadcom.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Corneliu Doban <cdoban@broadcom.com>
Cc: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
Cc: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: add test of CONFIG_ENV_IMPORT_FDT
Rasmus Villemoes [Wed, 21 Apr 2021 09:06:55 +0000 (11:06 +0200)]
sandbox: add test of CONFIG_ENV_IMPORT_FDT

Check that a variable defined in /config/environment is found in the
run-time environment, and that clearing fdt_env_path from within that
node works.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
[trini: Conditionalize the test being linked in]
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoenv: allow environment to be amended from control dtb
Rasmus Villemoes [Wed, 21 Apr 2021 09:06:54 +0000 (11:06 +0200)]
env: allow environment to be amended from control dtb

It can be useful to use the same U-Boot binary for multiple purposes,
say the normal one, one for developers that allow breaking into the
U-Boot shell, and one for use during bootstrapping which runs a
special-purpose bootcmd. Or one can have several board variants that
can share almost all boot logic, but just needs a few tweaks in the
variables used by the boot script.

To that end, allow the control dtb to contain a /config/enviroment
node (or whatever one puts in fdt_env_path variable), whose
property/value pairs are used to update the run-time environment after
it has been loaded from its persistent location.

The indirection via fdt_env_path is for maximum flexibility - for
example, should the user wish (or board logic dictate) that the values
in the DTB should no longer be applied, one simply needs to delete the
fdt_env_path variable; that can even be done automatically by
including a

  fdt_env_path = "";

property in the DTB node.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
3 years agotest: Add gpio-sysinfo test
Sean Anderson [Tue, 20 Apr 2021 14:50:58 +0000 (10:50 -0400)]
test: Add gpio-sysinfo test

This adds a test for the gpio-sysinfo driver.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agosysinfo: Add gpio-sysinfo driver
Sean Anderson [Tue, 20 Apr 2021 14:50:57 +0000 (10:50 -0400)]
sysinfo: Add gpio-sysinfo driver

This uses the newly-added dm_gpio_get_values_as_int_base3 function to
implement a sysinfo device. The revision map is stored in the device tree.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agosysinfo: Require that sysinfo_detect be called before other methods
Sean Anderson [Tue, 20 Apr 2021 14:50:56 +0000 (10:50 -0400)]
sysinfo: Require that sysinfo_detect be called before other methods

This has the uclass enforce calling detect() before other methods.  This
allows drivers to cache information in detect() and perform (cheaper)
retrieval in the other accessors. This also modifies the only instance
where this sequencing was not followed.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agosysinfo: Use global sysinfo IDs for existing sysinfo drivers
Sean Anderson [Tue, 20 Apr 2021 14:50:55 +0000 (10:50 -0400)]
sysinfo: Use global sysinfo IDs for existing sysinfo drivers

Since 07c9e683a4 ("smbios: Allow a few values to come from sysinfo")
there are common global sysinfo IDs. This patch moved existing IDs above
SYSINFO_ID_USER.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodm: gpio: Fix gpio_get_list_count failing with livetree
Sean Anderson [Tue, 20 Apr 2021 14:50:54 +0000 (10:50 -0400)]
dm: gpio: Fix gpio_get_list_count failing with livetree

of_parse_phandle_with_args (called by dev_read_phandle_with_args) does not
support getting the length of a phandle list by using the index -1.
Instead, use dev_count_phandle_with_args which supports exactly this
use-case.

Fixes: 8558217153 ("gpio: Convert to use APIs which support live DT")

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoMerge tag 'dm-pull-29apr21' of https://source.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Fri, 30 Apr 2021 01:03:38 +0000 (21:03 -0400)]
Merge tag 'dm-pull-29apr21' of https://source.denx.de/u-boot/custodians/u-boot-dm

buildman environment fix
binman FMAP improvements
minor test improvements and fixes
minor dm improvements

3 years agoMerge tag 'xilinx-for-v2021.07-rc2' of https://source.denx.de/u-boot/custodians/u...
Tom Rini [Thu, 29 Apr 2021 15:31:06 +0000 (11:31 -0400)]
Merge tag 'xilinx-for-v2021.07-rc2' of https://source.denx.de/u-boot/custodians/u-boot-microblaze

Xilinx changes for v2021.07-rc2

xilinx:
- Enable saving variables based on bootmode
- Cleanup usb dfu setup and wire it up with usb bootmode
- Fix bootscript address logic
- Remove GD references (spi, Versal)
- Enable capsule update

clk:
- Small Kconfig fix

net:
- Fix gmii2rgmii bridge binding

usb:
- Propagate error (dfu gadget)

3 years agospi: zynqmp: Remove gd reference
Michal Simek [Mon, 26 Apr 2021 06:26:33 +0000 (08:26 +0200)]
spi: zynqmp: Remove gd reference

gd is not used in this file that's why doesn't make sense to declare it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-cfi-flash
Tom Rini [Thu, 29 Apr 2021 12:22:17 +0000 (08:22 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-cfi-flash

- mtd: cfi: Fix PPB lock status readout (Marek)

3 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Thu, 29 Apr 2021 12:21:55 +0000 (08:21 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- Add base support for Marvell OcteonTX2 CN9130 CRB (mostly done
  by Kostya)
- Sync Armada 3k/7k/8k SERDES code with Marvell version (misc Marvell
  authors)
- pci-aardvark: Fix processing PIO transfers (Pali)

3 years agotpm: missing event types
Heinrich Schuchardt [Wed, 21 Apr 2021 10:24:29 +0000 (12:24 +0200)]
tpm: missing event types

Add a reference for the TPM event types and provide missing constants.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agotest: dm: add test item for ofnode_get_addr() and ofnode_get_size()
Chen Guanqiao [Mon, 12 Apr 2021 06:51:12 +0000 (14:51 +0800)]
test: dm: add test item for ofnode_get_addr() and ofnode_get_size()

Add test item for getting address and size functions

Test the following function:
- ofnode_get_addr()
- ofnode_get_size()

Signed-off-by: Chen Guanqiao <chenguanqiao@kuaishou.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Add size operations on device tree references
Chen Guanqiao [Mon, 12 Apr 2021 06:51:11 +0000 (14:51 +0800)]
dm: core: Add size operations on device tree references

Add functions to add size of addresses in the device tree using ofnode
references.

If the size is not set, return FDT_SIZE_T_NONE.

Signed-off-by: Chen Guanqiao <chenguanqiao@kuaishou.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agobuildman: Use bytes for the environment
Simon Glass [Sun, 11 Apr 2021 04:27:28 +0000 (16:27 +1200)]
buildman: Use bytes for the environment

At present we sometimes see problems in gitlab where the environment has
0x80 characters or sequences which are not valid UTF-8.

Avoid this by using bytes for the environment, both internal to buildman
and when writing out the 'env' file. Add a test to make sure this works
as expected.

Reported-by: Marek Vasut <marex@denx.de>
Fixes: e5fc79ea718 ("buildman: Write the environment out to an 'env' file")
Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobuildman: Handle exceptions in threads gracefully
Simon Glass [Sun, 11 Apr 2021 04:27:27 +0000 (16:27 +1200)]
buildman: Handle exceptions in threads gracefully

There have been at least a few cases where an exception has occurred in a
thread and resulted in buildman hanging: running out of disk space and
getting a unicode error.

Handle these by collecting a list of exceptions, printing them out and
reporting failure if any are found. Add a test for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobuildman: Use common code to send an result
Simon Glass [Sun, 11 Apr 2021 04:27:26 +0000 (16:27 +1200)]
buildman: Use common code to send an result

At present the code to report a build result is duplicated. Put it in a
common function to avoid this.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobuildman: Tidy up a few comments
Simon Glass [Sun, 11 Apr 2021 04:27:25 +0000 (16:27 +1200)]
buildman: Tidy up a few comments

Add some function comments which are missing, or missing arguments.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Fix uninitialized return value from dm_scan_fdt_node
Sean Anderson [Thu, 8 Apr 2021 21:15:00 +0000 (17:15 -0400)]
dm: core: Fix uninitialized return value from dm_scan_fdt_node

If there are no nodes or if all nodes are disabled, this function would
return err without setting it first. Fix this by initializing err to
zero.

Fixes: 94f7afdf7e ("dm: core: Ignore disabled devices when binding")

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Add address translation in fdt_get_resource
Patrick Delaunay [Tue, 6 Apr 2021 07:38:06 +0000 (09:38 +0200)]
dm: core: Add address translation in fdt_get_resource

Today of_address_to_resource() is called only in
ofnode_read_resource() for livetree support and
fdt_get_resource() is called when livetree is not supported.

The fdt_get_resource() doesn't do the address translation
so when it is required, but the address translation is done
by ofnode_read_resource() caller, for example in
drivers/firmware/scmi/smt.c::scmi_dt_get_smt_buffer() {
...
ret = ofnode_read_resource(args.node, 0, &resource);
if (ret)
return ret;

faddr = cpu_to_fdt32(resource.start);
paddr = ofnode_translate_address(args.node, &faddr);
...

The both behavior should be aligned and the address translation
must be called in fdt_get_resource() and removed for each caller.

Fixes: a44810123f9e ("dm: core: Add dev_read_resource() to read device resources")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
3 years agobinman: Support adding sections to FMAPs
Simon Glass [Fri, 2 Apr 2021 22:05:10 +0000 (11:05 +1300)]
binman: Support adding sections to FMAPs

When used with hierarchical images, use the Chromium OS convention of
adding a section before all the subentries it contains.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Tweak implementation of fmap
Simon Glass [Fri, 2 Apr 2021 22:05:09 +0000 (11:05 +1300)]
binman: Tweak implementation of fmap

Use an interator in two of the fmap tests so it is easier to add new
items. Also check the name first since that is the first indication
that something is wrong. Use a variable for the expected size of the
fmap to avoid repeating the code.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agopatman: Parse checkpatch by message instead of by line
Evan Benn [Thu, 1 Apr 2021 02:49:30 +0000 (13:49 +1100)]
patman: Parse checkpatch by message instead of by line

Parse each empty-line-delimited message separately. This saves having to
deal with all the different line content styles, we only care about the
header ERROR | WARNING | NOTE...

Also make checkpatch print line information for a uboot specific
warning.

Signed-off-by: Evan Benn <evanbenn@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agopatman: Assume we always have pygit2 for tests
Tom Rini [Fri, 26 Feb 2021 12:52:31 +0000 (07:52 -0500)]
patman: Assume we always have pygit2 for tests

Given that we have tests that require pygit2 and it can be installed
like any other python module, fail much more loudly if it is missing.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agotests: patman: Add requests to the module list
Tom Rini [Fri, 26 Feb 2021 12:52:30 +0000 (07:52 -0500)]
tests: patman: Add requests to the module list

The patman tests require the requests module, add it.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoAzure/GitLab: Ensure we use requirements.txt for testsuites
Tom Rini [Fri, 26 Feb 2021 12:52:29 +0000 (07:52 -0500)]
Azure/GitLab: Ensure we use requirements.txt for testsuites

Given that test/py/requirements.txt has all required test modules, make
use of that rather than a manual pip install list before running our
assorted tool testsuites.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agotest: Use positive conditional in test_matches()
Andy Shevchenko [Thu, 11 Feb 2021 14:40:11 +0000 (16:40 +0200)]
test: Use positive conditional in test_matches()

It is easier to read the positive conditional.

While at it, convert hard coded length of "_test_" to strlen("_test_")
which will be converted to a constant bu optimizing compiler.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: Allow simple glob pattern in the test name
Andy Shevchenko [Thu, 11 Feb 2021 14:40:10 +0000 (16:40 +0200)]
test: Allow simple glob pattern in the test name

When run `ut dm [test name]` allow to use simple pattern to run all tests
started with given prefix. For example, to run all ACPI test cases:
ut dm acpi*

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: Correct dtoc output when testing
Simon Glass [Mon, 26 Apr 2021 20:19:48 +0000 (08:19 +1200)]
dtoc: Correct dtoc output when testing

At present each invocation of run_steps() updates OUTPUT_FILES_COMMON,
since it does not make a copy of the dict. This is fine for a single
invocation, but for tests, run_steps() is invoked many times.

As a result it may include unwanted items from the previous run, if it
happens that a test runs twice on the same CPU. The problem has not been
noticied previously, as there are few enough tests and enough CPUs that
is is rare for the 'wrong' combination of tests to run together.

Fix this by making a copy of the dict, before updating it. Update the
tests to suit, taking account of the files that are no-longer generated.

With this fix, we no-longer generate files which are not needed for a
particular state of OF_PLATDATA_INST, so the check_instantiate() function
is not needed anymore. It has become dead code and so fails the
code-coverage test (dtoc -T). Remove it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Correct testSplNoDtb() and Tpl also
Simon Glass [Sat, 24 Apr 2021 20:39:32 +0000 (08:39 +1200)]
binman: Correct testSplNoDtb() and Tpl also

These two tests require an ELF image so that symbol information can be
written into the SPL/TPL binary. At present they rely on other tests
having set it up first, but every test must run independently. This can
cause occasional errors in CI.

Fix this by setting up the required files, as other tests do.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
3 years agonet: phy: xilinx: Break while loop over ethernet phy
Michal Simek [Mon, 26 Apr 2021 12:26:48 +0000 (14:26 +0200)]
net: phy: xilinx: Break while loop over ethernet phy

The commit 6c993815bbea ("net: phy: xilinx: Be compatible with live OF
tree") change driver behavior to while loop which wasn't correct because
the driver was looping over again and again. The reason was that
ofnode_valid() is taking 0 as correct value.
Fix it by changing while loop to ofnode_for_each_subnode() which is only
loop over available nodes.

Fixes: 6c993815bbea ("net: phy: xilinx: Be compatible with live OF tree")
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agoarm: a37xx: pci: Fix processing PIO transfers
Pali Rohár [Thu, 22 Apr 2021 14:23:04 +0000 (16:23 +0200)]
arm: a37xx: pci: Fix processing PIO transfers

Trying to clear PIO_START register when it is non-zero (which indicates
that previous PIO transfer has not finished yet) causes an External
Abort with SError 0xbf000002.

This bug is currently worked around in TF-A by handling External Aborts
in EL3 and ignoring this particular SError.

This workaround was also discussed at:
https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/commit/?id=3c7dcdac5c50
https://lore.kernel.org/linux-pci/20190316161243.29517-1-repk@triplefau.lt/
https://lore.kernel.org/linux-pci/971be151d24312cc533989a64bd454b4@www.loen.fr/
https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/1541

Implement a proper fix to prevent this External Abort. As it is not
possible to cancel a pending PIO transfer, simply do not start a new one
if previous has not finished yet. In this case return an error to the
caller.

In most cases this SError happens when there is no PCIe card connected
or when PCIe link is down. The reason is that in these cases a PIO
transfer takes about 1.44 seconds. For this reason we also increase the
wait timeout in pcie_advk_wait_pio() to 1.5 seconds.

If PIO read transfer for PCI_VENDOR_ID register times out, or if it
isn't possible to read it yet because previous transfer is not finished,
return Completion Retry Status value instead of failing, to give the
caller a chance to send a new read request.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>