]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
9 months agoboard: ti: rm-cfg: Update rm-cfg to reflect new resource reservation
Vishal Mahaveer [Tue, 20 Feb 2024 20:39:44 +0000 (14:39 -0600)]
board: ti: rm-cfg: Update rm-cfg to reflect new resource reservation

With the latest TIFS firmware, an additional virtual interrupt and
event is reserved for TIFS usage on am62x and am62ax devices.

Update the rm-cfg to reflect this new reservation.

Signed-off-by: Vishal Mahaveer <vishalm@ti.com>
9 months agodma: ti: k3-udma: Fix error handling for setup_resources() in udma_probe()
Siddharth Vadapalli [Tue, 20 Feb 2024 10:04:51 +0000 (15:34 +0530)]
dma: ti: k3-udma: Fix error handling for setup_resources() in udma_probe()

In udma_probe() the return value of setup_resources() is stored in the
u32 "ch_count" member of "struct udma_dev", due to which any negative
return value which indicates an error is masked.

Fix this by storing the return value of setup_resources() in the already
declared integer variable "ret", followed by assigning it to the "ch_count"
member of "struct udma_dev" in case of no error.

While at it, change the "return ret" at the end of udma_probe() to a
"return 0", to explicitly indicate that probe was successful.

Fixes: a8837cf43839 ("dma: ti: k3-udma: Query DMA channels allocated from Resource Manager")
Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
9 months agoconfigs: am64x_evm_r5_defconfig: enlarge simple malloc pool
Thomas Weißschuh [Fri, 9 Feb 2024 08:06:53 +0000 (09:06 +0100)]
configs: am64x_evm_r5_defconfig: enlarge simple malloc pool

With the default size the stack grows into the malloc, pool leading to
stack corruption and boot failure.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
9 months agoarm: mach-k3: am62: Fixup thermal zone critical points
Joao Paulo Goncalves [Thu, 8 Feb 2024 09:29:51 +0000 (10:29 +0100)]
arm: mach-k3: am62: Fixup thermal zone critical points

Read the max temperature for the SoC temperature grade from the hardware
and change the critical trip nodes on each thermal zone of FDT at
runtime so they are correct with the hardware value for its grade.

Signed-off-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
9 months agoarm: mach-k3: am62: Get soc max temperature by grade
Joao Paulo Goncalves [Thu, 8 Feb 2024 09:29:50 +0000 (10:29 +0100)]
arm: mach-k3: am62: Get soc max temperature by grade

AM62x SoC is available in multiple temperature grade:
- Commercial: 0° to 95° C
- Industrial: -40° to 105° C
- Automotive: -40° to 125° C

Add a new function that returns the am62 max temperature value
accordingly to its temperature grade in Celsius.

Signed-off-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
9 months agoarm: mach-k3: Move ARM64 specific code into new arm64 directory
Andrew Davis [Fri, 2 Feb 2024 00:24:48 +0000 (18:24 -0600)]
arm: mach-k3: Move ARM64 specific code into new arm64 directory

Like we did with R5, move ARM64 code into a specific directory to make
it clear what code is only meant to run on each core type.

Signed-off-by: Andrew Davis <afd@ti.com>
9 months agoarm: mach-k3: Move firewall removal into R5 directory
Andrew Davis [Fri, 2 Feb 2024 00:24:47 +0000 (18:24 -0600)]
arm: mach-k3: Move firewall removal into R5 directory

Firewalls are only ever removed by the R5 core, move this code into
the R5 directory.

Signed-off-by: Andrew Davis <afd@ti.com>
9 months agoarm: mach-k3: am62a7: Disable firewalls only after loading SYSFW
Andrew Davis [Fri, 2 Feb 2024 00:24:46 +0000 (18:24 -0600)]
arm: mach-k3: am62a7: Disable firewalls only after loading SYSFW

Currently we do this multiple times, instead just do it once after loading
SYSFW in R5 SPL.

Signed-off-by: Andrew Davis <afd@ti.com>
9 months agoarm: mach-k3: Move tispl.bin loading into R5 directory
Andrew Davis [Fri, 2 Feb 2024 00:24:45 +0000 (18:24 -0600)]
arm: mach-k3: Move tispl.bin loading into R5 directory

ATF, OPTEE, DM (tispl.bin) loading is only ever done by the R5 core,
move the code into the R5 directory.

Signed-off-by: Andrew Davis <afd@ti.com>
9 months agoarm: mach-k3: Move disable_linefill_optimization() into R5 directory
Andrew Davis [Fri, 2 Feb 2024 00:24:44 +0000 (18:24 -0600)]
arm: mach-k3: Move disable_linefill_optimization() into R5 directory

The disable_linefill_optimization() function is only ever loaded by the
R5 core, move the code into the R5 directory.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>
9 months agoarm: mach-k3: Move SYS_K3_SPL_ATF definition into R5 Kconfig
Andrew Davis [Fri, 2 Feb 2024 00:24:43 +0000 (18:24 -0600)]
arm: mach-k3: Move SYS_K3_SPL_ATF definition into R5 Kconfig

Loading ATF is only supported from the R5, move the Kconfig symbol
definition to match.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>
9 months agoMerge patch series "Introduce initial TI's J784S4 and AM69 support"
Tom Rini [Mon, 4 Mar 2024 17:02:49 +0000 (12:02 -0500)]
Merge patch series "Introduce initial TI's J784S4 and AM69 support"

Apurva Nandan <a-nandan@ti.com> says:

Hello Everyone!

This series will introduce basic support (SD and UART) support for Texas
Instruments J784S4 EVM.

The J784S4 SoC device tree patches are taken from kernel patch submissions
and will be updated as they are accepted and merged to the kernel tree.
All other patches are specific to SPL and u-boot and do not have
dependency on other trees. Appreciate a review for acceptance to u-boot
tree.

Here are some of the salient features of the J784S4 automotive grade
application processor:

The J784S4 SoC belongs to the K3 Multicore SoC architecture
platform, providing advanced system integration in automotive,
ADAS and industrial applications requiring AI at the network edge.
This SoC extends the K3 Jacinto 7 family of SoCs with focus on
raising performance and integration while providing interfaces,
memory architecture and compute performance for multi-sensor, high
concurrency applications.

Some highlights of this SoC are:
* Up to 8 Cortex-A72s, four clusters of lockstep capable dual Cortex-R5F MCUs,
  4 C7x floating point vector DSPs with Matrix Multiply Accelerator(MMA) for
  deep learning and CNN.
* 3D GPU: Automotive grade IMG BXS-4-64 MC1
* Vision Processing Accelerator (VPAC) with image signal processor and Depth
  and Motion Processing Accelerator (DMPAC)
* Three CSI2.0 4L RX plus two CSI2.0 4L TX, two DSI Tx, one eDP/DP and one
  DPI interface.
* Integrated gigabit ethernet switch, up to 8 ports (TDA4VH), two ports
  support 10Gb USXGMII; Two 4 lane PCIe-GEN3 controllers, USB3.0 Dual-role
  device subsystems, Up to 20 MCANs, among other peripherals.

See J784S4 Technical Reference Manual (SPRUJ52 - JUNE 2022)
for further details: http://www.ti.com/lit/zip/spruj52

In addtion, the J784S4 EVM board is designed for TI J784S4 SoC. It
supports the following interfaces:
* 32 GB DDR4 RAM
* x2 Gigabit Ethernet interfaces capable of working in Switch and MAC mode
* x1 Input Audio Jack, x1 Output Audio Jack
* x1 USB2.0 Hub with two Type A host and x1 USB 3.1 Type-C Port
* x2 4L PCIe connector
* x1 UHS-1 capable micro-SD card slot
* 512 Mbit OSPI flash, 1 Gbit Octal NAND flash, 512 Mbit QSPI flash,
  UFS flash.
* x6 UART through UART-USB bridge
* XDS110 for onboard JTAG debug using USB
* Temperature sensors, user push buttons and LEDs
* 40-pin User Expansion Connector
* x2 ENET Expansion Connector, x1 GESI expander, x2 Display connector
* x1 15-pin CSI header
* x6 MCAN instances

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

AM69 SD mode bootlog: https://gist.githubusercontent.com/apurvanandan1997/1b2c55d0204ff0f5a47ebbc196a97e99/raw/
J784S4 SD mode bootlog: https://gist.githubusercontent.com/apurvanandan1997/5e2ef85ee4322798d22b57a60dc917db/raw/
eMMC UDA moode bootlog: https://gist.githubusercontent.com/apurvanandan1997/3cffada252d50a8aa0c00a91f1f2f856/raw/

9 months agodoc: board: ti: k3: Add J784S4 EVM and AM69 SK documentation
Apurva Nandan [Fri, 23 Feb 2024 20:21:53 +0000 (01:51 +0530)]
doc: board: ti: k3: Add J784S4 EVM and AM69 SK documentation

TI K3 J784S4 and AM69 are new additions to the K3 SoC family.
Add documentation about the J784S4 EVM and AM69 SK.

Signed-off-by: Dasnavis Sabiya <sabiya.d@ti.com>
Signed-off-by: Apurva Nandan <a-nandan@ti.com>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> # AM69-SK
9 months agoconfigs: am69_sk: Add defconfig for AM69 SK board
Dasnavis Sabiya [Fri, 23 Feb 2024 20:21:52 +0000 (01:51 +0530)]
configs: am69_sk: Add defconfig for AM69 SK board

Add defconfig for AM69 SK A72 and R5 configuration.

This inlcudes and modifies the J784S4 EVM defconfigs:
j784s4_evm_a72_defconfig -> am69_sk_a72_defconfig
j784s4_evm_r5_defconfig -> am69_sk_r5_defconfig

Signed-off-by: Dasnavis Sabiya <sabiya.d@ti.com>
Signed-off-by: Apurva Nandan <a-nandan@ti.com>
Reviewed-by: Andrew Davis <afd@ti.com>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> # AM69-SK
9 months agoconfigs: j784s4_evm: Add defconfig for J784S4 EVM board
Apurva Nandan [Fri, 23 Feb 2024 20:21:51 +0000 (01:51 +0530)]
configs: j784s4_evm: Add defconfig for J784S4 EVM board

Add defconfigs for building R5 U-Boot SPL and A72 U-Boot.

Signed-off-by: Hari Nagalla <hnagalla@ti.com>
Signed-off-by: Apurva Nandan <a-nandan@ti.com>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> # AM69-SK
9 months agoarm: dts: Introduce am69-sk u-boot dts files
Dasnavis Sabiya [Fri, 23 Feb 2024 20:21:50 +0000 (01:51 +0530)]
arm: dts: Introduce am69-sk u-boot dts files

Introduce the base dts files needed for u-boot or to augment the linux
dtbs for use in the u-boot-spl and u-boot binaries.

Signed-off-by: Dasnavis Sabiya <sabiya.d@ti.com>
Signed-off-by: Apurva Nandan <a-nandan@ti.com>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> # AM69-SK
9 months agoarm: dts: Introduce j784s4 u-boot dts files
Apurva Nandan [Fri, 23 Feb 2024 20:21:49 +0000 (01:51 +0530)]
arm: dts: Introduce j784s4 u-boot dts files

Introduce the base dts files needed for u-boot or to augment the linux
dtbs for use in the u-boot-spl and u-boot binaries.

Signed-off-by: Hari Nagalla <hnagalla@ti.com>
[ add binman and ddr dtsi files ]
Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
Signed-off-by: Dasnavis Sabiya <sabiya.d@ti.com>
Signed-off-by: Apurva Nandan <a-nandan@ti.com>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> # AM69-SK
9 months agoboard: ti: j784s4: Add boot environment variables
Apurva Nandan [Fri, 23 Feb 2024 20:21:48 +0000 (01:51 +0530)]
board: ti: j784s4: Add boot environment variables

Add env file with necessary boot variables.

[ added env files ]
Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
[ cleaned up the env files ]
Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
Signed-off-by: Apurva Nandan <a-nandan@ti.com>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> # AM69-SK
9 months agoboard: ti: j748s4: Add board config yaml files
Apurva Nandan [Fri, 23 Feb 2024 20:21:47 +0000 (01:51 +0530)]
board: ti: j748s4: Add board config yaml files

Add board-cfg, rm-cfg, pm-cfg, sec-cfg, tifs-rm-cfg yaml for buidling
u-boot sysfw data.

[ added board specific yaml files for binman ]
Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
Signed-off-by: Apurva Nandan <a-nandan@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> # AM69-SK
9 months agoboard: ti: j784s4: Add board support for J784S4 EVM
Apurva Nandan [Fri, 23 Feb 2024 20:21:46 +0000 (01:51 +0530)]
board: ti: j784s4: Add board support for J784S4 EVM

Add board files for J784S4 EVM.

SYS_DISABLE_DCACHE_OPS is selected in the Kconfig because
J784S4/AM69 are a coherent architecture at A72 level by
MSMC support.

Signed-off-by: Hari Nagalla <hnagalla@ti.com>
Signed-off-by: Dasnavis Sabiya <sabiya.d@ti.com>
Signed-off-by: Apurva Nandan <a-nandan@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> # AM69-SK
9 months agodrivers: dma: Add support for J784S4 SoC
Apurva Nandan [Fri, 23 Feb 2024 20:21:45 +0000 (01:51 +0530)]
drivers: dma: Add support for J784S4 SoC

Add support for DMA in J784S4 SoC.

Signed-off-by: Jayesh Choudhary <j-choudhary@ti.com>
Signed-off-by: Hari Nagalla <hnagalla@ti.com>
Signed-off-by: Apurva Nandan <a-nandan@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Roger Quadros <rogerq@kernel.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> # AM69-SK
9 months agoarm: mach-k3: j784s4: Add clk and power support
Apurva Nandan [Fri, 23 Feb 2024 20:21:44 +0000 (01:51 +0530)]
arm: mach-k3: j784s4: Add clk and power support

Add clk and device data which can be used by respective drivers
to configure clocks and PSC.

Signed-off-by: Hari Nagalla <hnagalla@ti.com>
Signed-off-by: Apurva Nandan <a-nandan@ti.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Roger Quadros <rogerq@kernel.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> # AM69-SK
9 months agosoc: ti: k3-socinfo: Add entry for J784S4 SoC
Apurva Nandan [Fri, 23 Feb 2024 20:21:43 +0000 (01:51 +0530)]
soc: ti: k3-socinfo: Add entry for J784S4 SoC

Add support for J784S4 SoC Identification.

Signed-off-by: Hari Nagalla <hnagalla@ti.com>
Signed-off-by: Apurva Nandan <a-nandan@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Roger Quadros <rogerq@kernel.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> # AM69-SK
9 months agoarm: mach-k3: Sort SoC JTAG_ID entries
Apurva Nandan [Fri, 23 Feb 2024 20:21:42 +0000 (01:51 +0530)]
arm: mach-k3: Sort SoC JTAG_ID entries

Sort JTAG_IDs for K3 SoCs in hardware.h in alphabetical order.

Signed-off-by: Apurva Nandan <a-nandan@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Roger Quadros <rogerq@kernel.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> # AM69-SK
9 months agoarm: mach-k3: Add basic support for J784S4 SoC definition
Apurva Nandan [Fri, 23 Feb 2024 20:21:41 +0000 (01:51 +0530)]
arm: mach-k3: Add basic support for J784S4 SoC definition

Add J784S4 initialization files for initial SPL boot.

config SYS_K3_MCU_SCRATCHPAD_BASE default value is same
for J721E, J721S2, J784S4. So combined them into a single
default.

Signed-off-by: Hari Nagalla <hnagalla@ti.com>
[ add firewall configurations and change the R5 MCU scratchpad ]
Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
Signed-off-by: Dasnavis Sabiya <sabiya.d@ti.com>
Signed-off-by: Apurva Nandan <a-nandan@ti.com>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> # AM69-SK
9 months agoarm: mach-k3: Kconfig: Sort SOC_K3 config entries
Apurva Nandan [Fri, 23 Feb 2024 20:21:40 +0000 (01:51 +0530)]
arm: mach-k3: Kconfig: Sort SOC_K3 config entries

Sort SOC_K3 config entries in alphabetical order
for clean up.

Signed-off-by: Apurva Nandan <a-nandan@ti.com>
Reviewed-by: Roger Quadros <rogerq@kernel.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> # AM69-SK
9 months agoMerge patch series "board: beagle: Enable 32k and debounce configuration and fixups"
Tom Rini [Mon, 4 Mar 2024 16:50:26 +0000 (11:50 -0500)]
Merge patch series "board: beagle: Enable 32k and debounce configuration and fixups"

Nishanth Menon <nm@ti.com> says:

Hi,

Rev 2 of the series.

This is a follow up from [1] - Without the 32k crystal configuration,
wlan doesn't work. Debounce is needed for HDMI Hot plug detect(hpd)
gpio interrupt not storming.

At least the 32k configuration has been done for toradex and phytec
boards, follow similar model of programming.

Series is now based off master branch.

Bootlog: https://gist.github.com/nmenon/75df38bee907785d1d78d1ec4abd7304

Changes from V2:
- Removed depedency on [2] - depending on which way
  the merge sequence goes, one of the series will need a rebase.
- Added a patch for a bug that Jan noticed
- Fixup for the fat finger missing 0x in 0x4080 :(

[1] https://lore.kernel.org/u-boot/20230725185253.2123433-4-nm@ti.com/
[2] https://lore.kernel.org/u-boot/20240212194726.1093771-1-nm@ti.com/

9 months agoboard: beagle: beagleplay: env: Drop usb and pxe as boot targets
Nishanth Menon [Tue, 20 Feb 2024 18:39:52 +0000 (12:39 -0600)]
board: beagle: beagleplay: env: Drop usb and pxe as boot targets

We had enabled USB and network pxe boot with the hope to get it all
merged on time. However, it has not panned out. Drop usb and pxe boot
else bootflow scan -l throws in:
a) Unknown uclass 'usb' in label
b) Crashes when attempting pxe - cpsw/mdio driver apparently has missing
   error handling of what ever form. This is the one that Jan noticed in
   his log.

We can enable these on a later date once things are working.

Cc: Roger Quadros <rogerq@kernel.org>
Reported-by: Jan Kiszka <jan.kiszka@siemens.com>
Closes: https://lore.kernel.org/all/782ea2c0-eef5-478d-a122-cc6e2d066762@siemens.com/
Signed-off-by: Nishanth Menon <nm@ti.com>
9 months agoboard: beagle: beagleplay: Configure debounce registers
Nishanth Menon [Tue, 20 Feb 2024 18:39:51 +0000 (12:39 -0600)]
board: beagle: beagleplay: Configure debounce registers

Configure the debounce configuration that makes sense for BeaglePlay
usage model.

Signed-off-by: Nishanth Menon <nm@ti.com>
9 months agoarm: mach-k3: am62: Add Debounce configuration register definitions
Nishanth Menon [Tue, 20 Feb 2024 18:39:50 +0000 (12:39 -0600)]
arm: mach-k3: am62: Add Debounce configuration register definitions

Add the Debounce configuration registers that need to be configured one
time for the platform for the entire SoC.

Signed-off-by: Nishanth Menon <nm@ti.com>
9 months agoconfigs: am62x_beagleplay_r5_defconfig: Enable SPL_BOARD_INIT
Nishanth Menon [Tue, 20 Feb 2024 18:39:49 +0000 (12:39 -0600)]
configs: am62x_beagleplay_r5_defconfig: Enable SPL_BOARD_INIT

Enable CONFIG_SPL_BOARD_INIT to configure the 32k crystal.

Signed-off-by: Nishanth Menon <nm@ti.com>
9 months agoboard: beagle: beagleplay: Enable 32k crystal
Nishanth Menon [Tue, 20 Feb 2024 18:39:48 +0000 (12:39 -0600)]
board: beagle: beagleplay: Enable 32k crystal

Enable the external 32k crystal similar to that found on other
production AM62X board. The trim settings for the crystal is board
dependent, so the sequences tend to be board specific. Since this is
a configuration that needs to be done prior to DM managing the system
and all other muxes get set, do the same from R5 context.

Tested-by: Robert Nelson <robertcnelson@gmail.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
9 months agoMerge branch '2024-03-02-assorted-updates' into next
Tom Rini [Mon, 4 Mar 2024 15:13:01 +0000 (10:13 -0500)]
Merge branch '2024-03-02-assorted-updates' into next

- Assorted MediaTek, ASPEED, xenguest, s5p4418 and qemu-arm fixes
- Assorted test fixes/updates/additions.
- A few bootstd/related fixes.
- Remove common.h from some files
- Drop reiserfs
- A few other assorted fixes throughout the tree.

9 months agoboard: synquacer: developerbox: add myself as maintainer
Masahisa Kojima [Fri, 1 Mar 2024 04:38:39 +0000 (13:38 +0900)]
board: synquacer: developerbox: add myself as maintainer

Add myself as maintainer for SynQuacer Developerbox,
as I'm currently working on it.
This commit also removes Jassi from maintainer since he
no longer has a Developerbox.

Cc: Jassi Brar <jassisinghbrar@gmail.com>
Signed-off-by: Masahisa Kojima <kojima.masahisa@socionext.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
9 months agocmd: eeprom: Fix config dependency
Ivan Orlov [Fri, 23 Feb 2024 17:14:20 +0000 (17:14 +0000)]
cmd: eeprom: Fix config dependency

We should have CONFIG_DM_I2C or CONFIG_SYS_I2C_LEGACY enabled in
order for `cmd/eeprom.c` to compile as it depends on the i2c functions
which are not compiled otherwise. Update the Kconfig entry for the
'eeprom' command correspondingly.

Signed-off-by: Ivan Orlov <ivan.orlov@codethink.co.uk>
Reviewed-by: Tom Rini <trini@konsulko.com>
9 months agoMakefile: pass -undef option to cmd_gen_envp
Sébastien Szymanski [Fri, 23 Feb 2024 11:42:06 +0000 (12:42 +0100)]
Makefile: pass -undef option to cmd_gen_envp

Without the '-undef' option, the 'linux' string in .env files is
replaced with the string '1 '.
For example, in the board/armadeus/opos6uldev/opos6uldev.env file,

kernelimg=opos6ul-linux.bin

becomes

kernelimg=opos6ul-1 .bin

in the include/generated/env.in file.

That's because 'linux' is a System-specific Predefined Macros. [1]

Pass the '-undef' option to fix this issue.

[1] https://gcc.gnu.org/onlinedocs/gcc-13.2.0/cpp/System-specific-Predefined-Macros.html

Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
9 months agobootstd: support scanning a single partition
Nam Cao [Wed, 21 Feb 2024 12:41:44 +0000 (13:41 +0100)]
bootstd: support scanning a single partition

The "bootflow" command currently doesn't support scanning a single
partition. This is inconvenient in setups with multiple bootable
partitions within a single disk, but only one is desired.

Support scanning a single disk partition. Specifically, support the
syntax:
bootflow scan mmc1:4
which scans only mmc device 1, partition 4.

Signed-off-by: Nam Cao <namcao@linutronix.de>
9 months agobootstd: fix build error when CONFIG_MMC is disabled
Dan Carpenter [Wed, 21 Feb 2024 06:26:21 +0000 (09:26 +0300)]
bootstd: fix build error when CONFIG_MMC is disabled

This code assumes that CONFIG_MMC and it causes a build error when
the config is disabled.

aarch64-linux-gnu-ld.bfd: test/boot/bootstd_common.o: in function `bootstd_test_check_mmc_hunter':
test/boot/bootstd_common.c:83:(.text.bootstd_test_check_mmc_hunter+0x70):
    undefined reference to `_u_boot_list_2_bootdev_hunter_2_mmc_bootdev_hunter'

Fixes: 66e3dce78750 ("bootstd: Allow hunting for a bootdev by label")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
9 months agobootflow: Fix build error when BOOTMETH_CROS is disabled
Dan Carpenter [Wed, 21 Feb 2024 06:26:09 +0000 (09:26 +0300)]
bootflow: Fix build error when BOOTMETH_CROS is disabled

The bootflow testing assumes that BOOTMETH_CROS is enabled but it
might not be which leads to a build error.

aarch64-linux-gnu-ld.bfd: test/boot/bootflow.o: in function `prep_mmc_bootdev':
test/boot/bootflow.c:549:(.text.prep_mmc_bootdev+0x1c8):
    undefined reference to `_u_boot_list_2_driver_2_bootmeth_cros'

Fixes: d08db02d2d3d ("bootstd: Add a test for bootmeth_cros")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
9 months agoext4: detect directories in ext4fs_exists()
Heinrich Schuchardt [Tue, 20 Feb 2024 11:54:23 +0000 (12:54 +0100)]
ext4: detect directories in ext4fs_exists()

While fat_exists() reports directories and files as existing
ext4fs_exists() only recognizes files. This lead to errors
when using systemd-boot with an ext4 file-system.

Change ext4fs_exists() to find any type of inode:
files, directories, symbolic links.

Fixes: a1596438a689 ("ext4fs ls load support")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
9 months agofs: drop reiserfs
Peter Robinson [Sun, 18 Feb 2024 23:59:35 +0000 (23:59 +0000)]
fs: drop reiserfs

It was only included by a single board which doesn't appear to have
ever used it for any default use cases so drop the filesystem now
that isn't used by any in-tree configurations.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
9 months agoconfigs: ethernut5: Drop reiserfs
Peter Robinson [Sun, 18 Feb 2024 23:59:34 +0000 (23:59 +0000)]
configs: ethernut5: Drop reiserfs

This is the only board that enables it, and looking generally I don't
believe it's used. All use cases I could fine for the board rub by
default off jffs on the nand and it doesn't enable USB storage.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Cc: egnite GmbH <info@egnite.de>
9 months agoremove Broadcom Northstar 2 Target entry
Peter Robinson [Sun, 18 Feb 2024 11:16:20 +0000 (11:16 +0000)]
remove Broadcom Northstar 2 Target entry

The Broadcom Northstar 2 support was removed when the
bcm958712k board was removed but the target entry was
missed so clean that up as well.

Fixes: d59bc09d829 ("arm: Remove bcm958712k board")
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
9 months agodm: core: Fix address translation in devfdt_get_addr_index()
Jonas Karlman [Sat, 17 Feb 2024 13:19:41 +0000 (13:19 +0000)]
dm: core: Fix address translation in devfdt_get_addr_index()

During address translation #address/size-cells props are expected to
apply to child nodes. However, devfdt_get_addr_index() incorrectly use
the parent offset of the udevice parent instead of getting the offset of
the node parent. This will work in most cases when there is only one
udevice tied to a node.

On e.g. an Orange Pi R1 Plus TLS board the dwc3-generic (parent) and
dwc3-generic-host (child) udevice is tied to the same node.

In that case both the offset and parent values end up being the same.
As a result, the #address/size-cells props intended for child nodes
incorrectly gets applied to the node itself resulting in wrong addr
being returned, 0x0 instead of 0xff600000.

The following can be seen on console:

  dwc3-generic-host usb@ff600000: this is not a DesignWare USB3 DRD Core
  dwc3-generic-host usb@ff600000: failed to initialize core

Fix this by using the offset of the parent node and not the offset to
the node the parent udevice is tied to.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
9 months agopinctrl: Check pinconfig nodes pre-reloc status recursively
Jonas Karlman [Sat, 17 Feb 2024 12:08:40 +0000 (12:08 +0000)]
pinctrl: Check pinconfig nodes pre-reloc status recursively

Pinconfig nodes normally bind recursively with PINCTRL_FULL and
PINCONF_RECURSIVE enabled. However, during U-Boot proper pre-relocation
any node marked with e.g. bootph-all will not bind unless its parent is
also marked for pre-reloc.

  group1 {
      pinconf1 {
          bootph-all;
      };
  };

This cause the following warning message to be shown during U-Boot
proper pre-reloc stage on Rockchip devices, e.g on RK3568:

  ns16550_serial serial@fe660000: pinctrl_select_state_full: uclass_get_device_by_phandle_id: err=-19

and on RK3328:

  ns16550_serial serial@ff130000: pinctrl_select_state_full: uclass_get_device_by_phandle_id: err=-19

Check pinconfig nodes pre-reloc status recursively to fix this and to
make pinconfig_post_bind work same at both U-Boot proper pre-reloc and
at TPL/SPL stage.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
9 months agoMakefile: remove hardcoded device tree source directory
Bryan Brattlof [Mon, 4 Mar 2024 12:12:57 +0000 (17:42 +0530)]
Makefile: remove hardcoded device tree source directory

Some boards that choose to utilize the OF_UPSTREAM directory for their
device tree files will need to specify that directory instead of the
traditional arch/$(ARCH)/dts/* path.

Include the correct path to the board's dtbs depending on if OF_UPSTREAM
is selected or not.

Signed-off-by: Bryan Brattlof <bb@ti.com>
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Tested-by: Fabio Estevam <festevam@gmail.com>
9 months agoboot: Only define checksum algos when the hashes are enabled
Sean Anderson [Thu, 15 Feb 2024 17:12:18 +0000 (12:12 -0500)]
boot: Only define checksum algos when the hashes are enabled

Don't define checksum algos when the underlying hashes are not enabled.
This allows disabling these hashes in SPL (or U-Boot).

Fixes: d16b38f4270 ("Add support for SHA384 and SHA512")
Fixes: 646257d1f40 ("rsa: add sha256-rsa2048 algorithm")
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
9 months agopci-host-ecam-generic: Convert to ofnode functions
Maksim Kiselev [Wed, 14 Feb 2024 20:30:01 +0000 (23:30 +0300)]
pci-host-ecam-generic: Convert to ofnode functions

FDT functions is not working when OF_LIVE is enabled.
Convert fdt parsing functions to ofnode parsing functions

Signed-off-by: Maksim Kiselev <bigunclemax@gmail.com>
9 months agolog: fixup log_head after relocating global data
Thomas Weißschuh [Tue, 13 Feb 2024 17:13:28 +0000 (18:13 +0100)]
log: fixup log_head after relocating global data

When `gd` is relocated during `spl_relocate_stack_gd()` the
doubly-linked circular list in the `log_head` member is broken.

The last element of the list should point back to the initial
`list_head`, but as the initial `list_head` is moved the pointer becomes
stale. As a result the loop in `log_dispatch` would never finish.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
9 months agorng: eliminate common.h include from RNG drivers
Heinrich Schuchardt [Mon, 12 Feb 2024 23:44:47 +0000 (00:44 +0100)]
rng: eliminate common.h include from RNG drivers

Usage of common.h is deprecated.

* Remove common.h from RNG drivers.
* Sort includes.
* Add time.h to sandbox driver.
* Add linux/types.h to rng.h to provide size_t.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
9 months agocmd: remove common.h from exception command implementations
Heinrich Schuchardt [Mon, 12 Feb 2024 16:53:29 +0000 (17:53 +0100)]
cmd: remove common.h from exception command implementations

The common.h should not be used anymore.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
9 months agobootdev: drop unnecessary assert on bootflow->bdev
Thomas Weißschuh [Mon, 12 Feb 2024 09:35:12 +0000 (10:35 +0100)]
bootdev: drop unnecessary assert on bootflow->bdev

Not all flows have a device and the function already contains logic to
handle this case.

Fixes: eccb25cd5922 ("bootstd: Allow the bootdev to be optional in bootflows")
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
9 months agocmd: setexpr: fix no matching string in gsub return empty value
Massimiliano Minella [Thu, 8 Feb 2024 14:58:27 +0000 (15:58 +0100)]
cmd: setexpr: fix no matching string in gsub return empty value

In gsub, when the destination string is empty, the string 't' is
provided and the regular expression doesn't match, then the final result
is an empty string.

Example:

=> echo ${foo}

=> setenv foo
=> setexpr foo gsub e a bar
=> echo ${foo}

=>

The variable ${foo} should contain "bar" and the lack of match shouldn't
be considered an error.

This patch fixes the erroneous behavior by removing the return
statement and breaking out of the loop in case of lack of match.

Also add a test for the no match case.

Signed-off-by: Massimiliano Minella <massimiliano.minella@se.com>
9 months agoFWU: developerbox: read boot index from NOR flash
Masahisa Kojima [Thu, 8 Feb 2024 02:33:44 +0000 (11:33 +0900)]
FWU: developerbox: read boot index from NOR flash

The FWU Multi Bank Update feature allows the platform to boot the
firmware images from one of the partitions(banks).
On the Developerbox, SCP-firmware running on the SCB(Cortex-M3)
passes the value of the boot index on the NOR flash.
Add a function to read the boot index value from the NOR flash.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
9 months agonet: macb: Add support for fixed link
BELOUARGA Mohamed [Tue, 6 Feb 2024 19:04:02 +0000 (20:04 +0100)]
net: macb: Add support for fixed link

The actual driver does not work when there is no linked PHY. These
changes add support for fixed-link feature in the device tree.

Signed-off-by: BELOUARGA Mohamed <m.belouarga@technologyandstrategy.com>
9 months agoscripts: dtc-version: Don't show error messages
Dragan Simic [Tue, 6 Feb 2024 11:00:04 +0000 (12:00 +0100)]
scripts: dtc-version: Don't show error messages

Prevent the error messages produced by which(1), such as the one quoted
below, from being visible in the build outputs.

    which: no dtc in (./scripts/dtc)

This makes the build outputs look a tiny bit cleaner.

Signed-off-by: Dragan Simic <dsimic@manjaro.org>
Reviewed-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
9 months agotest: cmd: mbr: Fix Smatch static checker warning
Alexander Gendin [Sat, 3 Feb 2024 02:56:19 +0000 (02:56 +0000)]
test: cmd: mbr: Fix Smatch static checker warning

This patch fixes Smatch static checker warning:
        test/cmd/mbr.c:243 mbr_test_run()
        warn: sizeof(NUMBER)?

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Alexander Gendin <agendin@matrox.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
9 months agoqemu-arm: round down memory to multiple of 2MB for LPAE
Igor Opaniuk [Thu, 1 Feb 2024 12:40:54 +0000 (13:40 +0100)]
qemu-arm: round down memory to multiple of 2MB for LPAE

QEMU's -m option can take fractional megabyte values,
and lowest granularity seems to be 0x2000.
For example, run qemu with amount of memory set to 100005k (0x61A9400):

$ qemu-system-arm -machine virt -cpu cortex-a15 -m 100005k \
-bios denx/u-boot.bin -nographic

=> fdt addr $fdt_addr
=> fdt print /memory@40000000
memory@40000000 {
        reg = <0x00000000 0x40000000 0x00000000 0x061aa000>;
        device_type = "memory";
};

When LPAE is enabled, 1:1 mapping is created using 2 MB blocks.
In case amount of memory provided to QEMU is not multiple
of 2 MB, hang occurs during MMU initialization.

How to reproduce:
qemu-system-arm -machine virt -m 1058 -nographic -bios u-boot.bin - boots
qemu-system-arm -machine virt -m 1057 -nographic -bios u-boot.bin - hangs

DRAM:  1 GiB
initcall: 60011df8
initcall: 60011904
New Stack Pointer is: 80fffe90
initcall: 60011a20
initcall: 60011bcc
initcall: 60011bd4
initcall: 600119b4
Relocation Offset is: 22042000
Relocating to 82042000, new gd at 81001ed0, sp at 80fffe90
initcall: 60011b8c
initcall: 82053ea0
initcall: 82053ea8
initcall: 60012040 (relocated to 82054040)
dram_bank_mmu_setup: bank: 0
- hang here during mmu init -

This patches rounds down to the nearest multiple of 2MB when
CONFIG_ARMV7_LPAE=y.

Fixes: 3fa914af82("arm: qemu: implement enable_caches()")
Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
9 months agotest/py: net: Add dhcp abort test
Love Kumar [Tue, 30 Jan 2024 08:07:01 +0000 (13:37 +0530)]
test/py: net: Add dhcp abort test

Abort the dhcp request in the middle by pressing ctrl + c on u-boot
prompt and validate the abort status.

Signed-off-by: Love Kumar <love.kumar@amd.com>
9 months agoarm: s5p4418: fix relocation of vectors
Stefan Bosch [Fri, 26 Jan 2024 12:50:56 +0000 (12:50 +0000)]
arm: s5p4418: fix relocation of vectors

The header (NSIH) used for the s5p4418-SoC is not loaded into RAM by the
2nd-bootloader, see boot0.h. Therefore, use an adapted version of
relocate_vectors which relocates the vectors after the header (at _start)
instead of the 'dummy'-vectors at the start of the header (at
__image_copy_start).

Signed-off-by: Stefan Bosch <stefan_b@posteo.net>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>
9 months agocommon: board_f: change calculation of gd->mon_len to fix s5p4418 reloc
Stefan Bosch [Fri, 26 Jan 2024 12:50:55 +0000 (12:50 +0000)]
common: board_f: change calculation of gd->mon_len to fix s5p4418 reloc

ARCH_NEXELL: Change calculation of monitor length (gd->mon_len) to fix
relocation at boards with s5p4418-SoC (ARCH_NEXELL). At s5p4418, _start
is after the header (NSIH). Therefore the monitor length has to be
calculated using __image_copy_start instead of _start in order the
whole monitor code is relocated.

Signed-off-by: Stefan Bosch <stefan_b@posteo.net>
9 months agoxen: xenguest_arm64: map all VIRTIO MMIO region
Peng Fan [Fri, 26 Jan 2024 10:29:38 +0000 (18:29 +0800)]
xen: xenguest_arm64: map all VIRTIO MMIO region

When run `virtio scan` on i.MX95, there is abort when accessing virtio
mmio region. The issue is the mmio region is not mapped. So let's map
all virtio mmio regions.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
9 months agoboot: pxe_utils: skip fdt setup in case legacy kernel is booted
Svyatoslav Ryhel [Thu, 25 Jan 2024 20:16:54 +0000 (22:16 +0200)]
boot: pxe_utils: skip fdt setup in case legacy kernel is booted

Currently, if boot with extlinux.conf and do not set the fdt
U-Boot will provide its own device tree. This behavior is
beneficial if the U-Boot device tree is in sync with Linux,
but it totally halts the booting of pre-dtb kernels (3.4 for
example) since it uses ATAGs. To fix this, pass `-` in the
fdt extlinux field as a signal that no tree should be used.

Suggested-by: Jonas Schwöbel <jonasschwoebel@yahoo.de>
Tested-by: Jethro Bull <jethrob@hotmail.com>
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
9 months agonet: mediatek: add support for XGMII interface
Weijie Gao [Mon, 22 Jan 2024 02:08:16 +0000 (10:08 +0800)]
net: mediatek: add support for XGMII interface

This patch add XGMII support for connecting 2.5G PHY.

Signed-off-by: Bo-Cun Chen <bc-bocun.chen@mediatek.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
9 months agonet: mediatek: add support for adjusting MDIO clock
Weijie Gao [Mon, 22 Jan 2024 02:08:11 +0000 (10:08 +0800)]
net: mediatek: add support for adjusting MDIO clock

User can assign a specific MDC speed to the eth node as follow:

&eth {
...
phy-mode = "usxgmii";
phy-handle = <&phy8>;

mdio {
clock-frequency = <10500000>;
};

phy8: eth-phy@8 {
      compatible = "ethernet-phy-id31c3.1c12";
...
};

Signed-off-by: Bo-Cun Chen <bc-bocun.chen@mediatek.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
9 months agoarm: dts: mt7988-sd-rfb: add SD pin driving settings
Weijie Gao [Mon, 22 Jan 2024 02:07:54 +0000 (10:07 +0800)]
arm: dts: mt7988-sd-rfb: add SD pin driving settings

Set SD pin driving to 4mA

Signed-off-by: Dong Huang <dong.huang@mediatek.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
9 months agopinctrl: aspeed: add pass-through pins and siopbi/siopbo
Ivan Mikhaylov [Sat, 20 Jan 2024 23:28:13 +0000 (02:28 +0300)]
pinctrl: aspeed: add pass-through pins and siopbi/siopbo

Add THRU0-3 and SIOPBI/SIOPBO pin groups/functions.

Signed-off-by: Ivan Mikhaylov <fr0st61te@gmail.com>
9 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-snapdragon into next
Tom Rini [Fri, 1 Mar 2024 18:54:49 +0000 (13:54 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-snapdragon into next

- Reworks Qualcomm support to be more generic, dropping board specific
  build targets and relying on DT as the only source of truth
- Switches all Qualcomm devices to use upstream devicetree

9 months agoclk/qcom: apq8016: allow apq8016_clk_init_uart() to be called externally
Caleb Connolly [Fri, 1 Mar 2024 15:00:24 +0000 (15:00 +0000)]
clk/qcom: apq8016: allow apq8016_clk_init_uart() to be called externally

When U-Boot as running as the first stage bootloader on MSM8916 devices,
early debug UART requires turning on the clocks (for some reason the
pre-loader turns them off?!).

To simplify developing for this platform, allow the
apq8016_clk_init_uart() function to be called externally. Developers can
call this from the serial_msm debug uart driver to configure the clocks
before the driver model is available.

As it is only possible to enable early debug UART in custom builds of
U-Boot, this solution at least gives developers the option.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agoMAINTAINERS: Qualcomm: add some missing paths
Caleb Connolly [Mon, 26 Feb 2024 17:26:43 +0000 (17:26 +0000)]
MAINTAINERS: Qualcomm: add some missing paths

Add drivers and DTS files, as well as regex matches for
qcom/qualcomm/snapdragon.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agodts: qcs404-evb: replace with upstream DT
Caleb Connolly [Mon, 26 Feb 2024 17:26:42 +0000 (17:26 +0000)]
dts: qcs404-evb: replace with upstream DT

Drop the U-Boot specific DTS in favour of upstream. We'll only include
the -4000 variant as that is what U-Boot already supported.

Taken from kernel tag v6.7

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agodt-bindings: import headers for qcs404
Caleb Connolly [Mon, 26 Feb 2024 17:26:41 +0000 (17:26 +0000)]
dt-bindings: import headers for qcs404

Import the headers needed for QCS404-evb.

Taken from kernel tag v6.7

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agodts: msm8996: replace with upstream DTS
Caleb Connolly [Mon, 26 Feb 2024 17:26:40 +0000 (17:26 +0000)]
dts: msm8996: replace with upstream DTS

Drop the U-Boot specific dragonboard820c.dts file in favour of the
upstream apq8096-db820c.dts and an additional -u-boot.dtsi with the
U-Boot specific additions.

Taken from kernel tag v6.7

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agodts: dragonboard820c: use correct bindings for clocks
Caleb Connolly [Mon, 26 Feb 2024 17:26:39 +0000 (17:26 +0000)]
dts: dragonboard820c: use correct bindings for clocks

Don't use hardcoded clock IDs, use the IDs from the dt-bindings to be
compatible with upstream.

Taken from kernel tag v6.7

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agodts: msm8996: import PMIC dtsi files
Caleb Connolly [Mon, 26 Feb 2024 17:26:38 +0000 (17:26 +0000)]
dts: msm8996: import PMIC dtsi files

Import PM8994 and PMI8994 DTSI files in preparation for switching
MSM8996 boards to upstream DTS.

Taken from kernel tag v6.7

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agodt-bindings: import headers for MSM8996
Caleb Connolly [Mon, 26 Feb 2024 17:26:37 +0000 (17:26 +0000)]
dt-bindings: import headers for MSM8996

Import dt-binding headers for MSM8996/APQ8096 from Linux.

Taken from kernel tag v6.7

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agodts: msm8916: replace with upstream DTS
Caleb Connolly [Mon, 26 Feb 2024 17:26:36 +0000 (17:26 +0000)]
dts: msm8916: replace with upstream DTS

Drop the U-Boot specific dragonboard410c.dts in favour of the upstream
msm8916-sbc.dts. No additional changes are needed to this DTS for U-Boot
support.

Taken from kernel tag v6.7

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agodts: msm8916: import PMIC dtsi files
Caleb Connolly [Mon, 26 Feb 2024 17:26:35 +0000 (17:26 +0000)]
dts: msm8916: import PMIC dtsi files

Import the supporting pm8916.dtsi and msm8916-pm8916.dtsi files from
upstream in preparation for switching boards over.

Taken from kernel tag v6.7

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agodt-bindings: import headers for MSM8916
Caleb Connolly [Mon, 26 Feb 2024 17:26:34 +0000 (17:26 +0000)]
dt-bindings: import headers for MSM8916

Import the dt-bindings headers in preparation for switching to upstream
DTS for MSM8916.

Taken from kernel tag v6.7

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agodts: sdm845: replace with upstream DTS
Caleb Connolly [Mon, 26 Feb 2024 17:26:33 +0000 (17:26 +0000)]
dts: sdm845: replace with upstream DTS

Import sdm845.dtsi from upstream, as well as the upstream DTS files for
the db845c and Samsung starqltechn. Delete the old board files.

Taken from kernel tag v6.7

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agodts: sdm845: import supporting dtsi files
Caleb Connolly [Mon, 26 Feb 2024 17:26:32 +0000 (17:26 +0000)]
dts: sdm845: import supporting dtsi files

Import the PM8998 and PMI8998 PMIC DTSI files from Linux as well
as the common audio codec in preperation for replacing board DTS files
with upstream.

Taken from kernel tag v6.7

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agodt-bindings: import headers for SDM845
Caleb Connolly [Mon, 26 Feb 2024 17:26:31 +0000 (17:26 +0000)]
dt-bindings: import headers for SDM845

Import the DT bindings headers that are used by SDM845 from Linux.

Taken from kernel tag v6.7

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agodoc: board/qualcomm: link to APQ8016 TRM
Caleb Connolly [Mon, 26 Feb 2024 17:26:30 +0000 (17:26 +0000)]
doc: board/qualcomm: link to APQ8016 TRM

The MSM8916/APQ8016 Technical Reference Manual is publicly available and
contains a lot of useful register maps for many core parts of the SoC.
Include an archive.org link to it in the dragonboard410c documentation.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agodoc: board/qualcomm: document generic targets
Caleb Connolly [Mon, 26 Feb 2024 17:26:29 +0000 (17:26 +0000)]
doc: board/qualcomm: document generic targets

Replace the board specific docs with a generic board.rst file which
documents the build/boot process for the sdm845 and qcs404 boards now
that the only differences are the DTB in use.

At the same time, create a debugging page to document some useful
snippets and tips for working with Qualcomm platforms.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agoboard: qcs404-evb: drop board code
Caleb Connolly [Mon, 26 Feb 2024 17:26:28 +0000 (17:26 +0000)]
board: qcs404-evb: drop board code

This board is entirely supported by the generic arch code and DTS. The
board code used to handle turning on the vbus regulator, however this is
now handled via DT.

With this, the board specific defconfig is also no longer needed, so
drop it as well.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Tested-by: Sumit Garg <sumit.garg@linaro.org> #qcs404
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agomach-snapdragon: carve out no-map regions
Caleb Connolly [Mon, 26 Feb 2024 17:26:27 +0000 (17:26 +0000)]
mach-snapdragon: carve out no-map regions

On Qualcomm platforms, the TZ may already have certain memory regions
under protection by the time U-Boot starts. There is a rare case on some
platforms where the prefetcher might speculatively access one of these
regions resulting in a board crash (TZ traps and then resets the board).

We shouldn't be accessing these regions from within U-Boot anyway, so
let's mark them all with PTE_TYPE_FAULT to prevent any speculative
access and correctly trap in EL1 rather than EL3.

Some lower level FDT functions are used here relying on some assumptions
about how Qualcomm devicetrees are laid out (#address/size-cells being 2
for reserved-memory), as this is the only way to make this acceptably
fast enough with dcache off. The full fat implementation takes 1800ms on
SDM845, the implementation in this patch takes <1.

Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Tested-by: Sumit Garg <sumit.garg@linaro.org> #qcs404
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agomach-snapdragon: generate fdtfile automatically
Caleb Connolly [Mon, 26 Feb 2024 17:26:26 +0000 (17:26 +0000)]
mach-snapdragon: generate fdtfile automatically

With just a few basic rules, we can generate the $fdtfile environment
variable to match the format used in Linux. This uses the root
compatible property inside u-boot, with specific handling for the
Dragonboard845c which is a special case, and for the qrb robotics
boards.

This is known to work on supported platforms, and lets us avoid having a
big lookup table.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Tested-by: Sumit Garg <sumit.garg@linaro.org> #qcs404
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agomach-snapdragon: dynamic load addresses
Caleb Connolly [Mon, 26 Feb 2024 17:26:25 +0000 (17:26 +0000)]
mach-snapdragon: dynamic load addresses

Heavily inspired by Apple board code. Use the LMB allocator to configure
load addresses at runtime, and implement a lookup table for selecting a
devicetree.

As some Qualcomm RBx boards have different RAM capacities and base
addresses, it isn't possible to hardcode these regions.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Tested-by: Sumit Garg <sumit.garg@linaro.org> #qcs404
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agomach-snapdragon: generalise board support
Caleb Connolly [Mon, 26 Feb 2024 17:26:24 +0000 (17:26 +0000)]
mach-snapdragon: generalise board support

Historically, Qualcomm boards have relied on heavy hardcoding in U-Boot,
in many cases to the specific SoC but also to the board itself (e.g.
memory map). This has been largely resolved by modernising the Qualcomm
drivers in U-Boot, however the board code still largely follows this
model.

This patch removes the board specific memory maps and duplicated board
init code, replacing it with generic init code.

The memory map is now built at runtime based on data read from DT, this
allows for the memory map to be provided without having to recompile
U-Boot. Support is also added for booting with appended DTBs, so that
the first-stage bootloader can populate the memory map for us.

The sdm845 specific init code is dropped entirely, it set an environment
variable depending on if a button was pressed, but this variable wasn't
used in U-Boot, and could be written to use the button command instead.

The KASLR detection is also dropped as with appended dtb, the kaslr seed
can be read directly from the DTB passed to U-Boot.

A new qcom_defconfig is added, with the aim of providing a generic
U-Boot configuration that will work on as many Qualcomm boards as
possible. It replaces the defconfig files for the Dragonboard 845c,
Galaxy S9, and QCS404 EVB. For now the db410c and 820c are excluded as
they still have some board code left.

Similarly, the config headers for db845c, starqltechn, and qcs404-evb
are replaced by a single qcom header.

The previously db410c-specific board_usb_init() function is made to be
generic and is added to mach-snapdragon. While we lack proper modelling
for USB configuration, using a well-known named pinctrl state is a
reasonably generic middleground, and works using upstream DT. This
function will do nothing unless the USB node has a pinctrl state named
"device", in which case it will be set when entering USB peripheral
mode.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Tested-by: Sumit Garg <sumit.garg@linaro.org> #qcs404
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agoboard: dragonboard820c: use LINUX_KERNEL_IMAGE_HEADER
Caleb Connolly [Mon, 26 Feb 2024 17:26:23 +0000 (17:26 +0000)]
board: dragonboard820c: use LINUX_KERNEL_IMAGE_HEADER

db820c predated support for prepending the kernel image header
automatically, drop it's custom linker script and head.S in favour of
this generic support.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Tested-by: Sumit Garg <sumit.garg@linaro.org> #qcs404
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agoboard: dragonboard410c: import board code from mach-snapdragon
Caleb Connolly [Mon, 26 Feb 2024 17:26:22 +0000 (17:26 +0000)]
board: dragonboard410c: import board code from mach-snapdragon

Some of the db410c board support code was written to be generic and
placed in mach-snapdragon. However, as the db410c is the only board
using this, move the code out of mach-snapdragon. This makes is more
obvious what code is relevant for which targets and helps tidy things up
a little more.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Tested-by: Sumit Garg <sumit.garg@linaro.org> #qcs404
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agoboard: dragonboard410c: upstream DT compat
Caleb Connolly [Mon, 26 Feb 2024 17:26:21 +0000 (17:26 +0000)]
board: dragonboard410c: upstream DT compat

Use the root compatible strings from upstream Linux, add missing
'#clock-cells' property to the gcc node.

Adjust some of the msm8916/apq8016 drivers to use the correct upstream
compatible properties and DT bindings.

This prepares us to switch to upstream DT in a future patch.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Tested-by: Sumit Garg <sumit.garg@linaro.org> #qcs404
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agoboard: dragonboard410c: add chainloaded config fragment
Caleb Connolly [Mon, 26 Feb 2024 17:26:20 +0000 (17:26 +0000)]
board: dragonboard410c: add chainloaded config fragment

Add a config fragment for building U-Boot such that it can be
chainloaded by aboot/LK rather than being flashed directly to the aboot
partition.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Tested-by: Sumit Garg <sumit.garg@linaro.org> #qcs404
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agopinctrl: qcom: apq8016: init pre-reloaction
Caleb Connolly [Mon, 26 Feb 2024 17:26:19 +0000 (17:26 +0000)]
pinctrl: qcom: apq8016: init pre-reloaction

On the DB410c we support running as a first stage bootloader. This
requires initialising the GPIOs which are muxed to UART before they can
be used. Add DM_FLAG_PRE_RELOC to the apq8016 pinctrl driver to ensure
that we do this early enough.

This is required to prevent the first few lines of UART log from being
dropped.

Reported-by: Sumit Garg <sumit.garg@linaro.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Tested-by: Sumit Garg <sumit.garg@linaro.org> #qcs404
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agopinctrl: qcom: fix DT compatibility
Caleb Connolly [Mon, 26 Feb 2024 17:26:18 +0000 (17:26 +0000)]
pinctrl: qcom: fix DT compatibility

Upstream devicetrees label GPIOs with "gpioX", not "GPIO_X", fix this
for SoCs where we're now using upstream DT.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Tested-by: Sumit Garg <sumit.garg@linaro.org> #qcs404
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agopinctrl: qcom: stub support for special GPIOs
Caleb Connolly [Mon, 26 Feb 2024 17:26:17 +0000 (17:26 +0000)]
pinctrl: qcom: stub support for special GPIOs

Most platforms have a handful of "special" GPIOs, like the MMC
clock/data lanes, UFS reset, etc. These don't follow the usual naming
scheme of "gpioX" and also have unique capabilities and registers. We
can get away without supporting them all for now, but DT compatibility
is still an issue.

Add support for allowing these to be specified after the other pins, and
make all pinmux/pinconf calls for them nop.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Tested-by: Sumit Garg <sumit.garg@linaro.org> #qcs404
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agosandbox: dts: fix qcom pmic gpio
Caleb Connolly [Mon, 26 Feb 2024 17:26:16 +0000 (17:26 +0000)]
sandbox: dts: fix qcom pmic gpio

Adjust the DT to match upstream bindings.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agogpio: qcom_pmic: add pinctrl driver
Caleb Connolly [Mon, 26 Feb 2024 17:26:15 +0000 (17:26 +0000)]
gpio: qcom_pmic: add pinctrl driver

Introduce a basic pinctrl driver for the SPMI PMIC GPIOs. This is
necessary to make proper use of upstream DT bindings specifically on the
dragonboard410c where they're used to switch between USB host and device
modes.

Only support for driving the pins as output low or high is enabled for
now.

To minimise duplicated code and allow for sharing common DT data, the
pinctrl driver is initialised as a child of the existing GPIO driver.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Tested-by: Sumit Garg <sumit.garg@linaro.org> #qcs404
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agogpio: qcom_pmic: add a quirk to skip GPIO configuration
Caleb Connolly [Mon, 26 Feb 2024 17:26:14 +0000 (17:26 +0000)]
gpio: qcom_pmic: add a quirk to skip GPIO configuration

Some platforms hard reset when attempting to configure PMIC GPIOs. Add
support for quirks specified in match data with a single quirk to skip
this configuration. We rely on the GPIO already be configured correctly,
which is always the case for volume up (the only current user of these
GPIOs).

This is not expected behaviour but appears to be due to a U-Boot
specific bug. This quirk at least allows for the volume buttons to be
used on platforms where this bug is apparent.

Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agogpio: qcom_pmic: 1-based GPIOs
Caleb Connolly [Mon, 26 Feb 2024 17:26:13 +0000 (17:26 +0000)]
gpio: qcom_pmic: 1-based GPIOs

Qualcomm PMICs number their GPIOs starting from 1, implement a custom
.xlate method to handle this.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Tested-by: Sumit Garg <sumit.garg@linaro.org> #qcs404
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>