]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
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>
9 months agoserial: msm: fix clock handling and pinctrl
Caleb Connolly [Mon, 26 Feb 2024 17:26:12 +0000 (17:26 +0000)]
serial: msm: fix clock handling and pinctrl

Use the modern helpers to fetch the clock and use the correct property
("clocks" instead of "clock"). Drop the call to pinctrl_select_state()
as no boards have a "uart" pinctrl state and this prints confusing
errors.

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 agoserial: msm: add debug UART
Caleb Connolly [Mon, 26 Feb 2024 17:26:11 +0000 (17:26 +0000)]
serial: msm: add debug UART

Introduce support for early debugging. This relies on the previous stage
bootloader to initialise the UART clocks, when running with U-Boot as
the primary bootloader this feature doesn't work. It will require a way
to configure the clocks before the driver model is available.

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 agoclock/qcom: qcs404: fix clk_set_rate
Caleb Connolly [Mon, 26 Feb 2024 17:26:10 +0000 (17:26 +0000)]
clock/qcom: qcs404: fix clk_set_rate

We should be returning the rate that we set the clock to, drivers like
MMC rely on this. So fix it.

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 agoclk/qcom: use upstream compatible properties
Caleb Connolly [Mon, 26 Feb 2024 17:26:09 +0000 (17:26 +0000)]
clk/qcom: use upstream compatible properties

Adjust the apq8016 and apq8096 drivers to use the upstream compatible
properties, and adjust the associated dts files in U-Boot.

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 agodt-bindings: drop msm_sdhci binding
Caleb Connolly [Mon, 26 Feb 2024 17:26:08 +0000 (17:26 +0000)]
dt-bindings: drop msm_sdhci binding

The upstream DT is supported here, so drop the U-Boot specific binding
docs.

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 agommc: msm_sdhci: use modern clock handling
Caleb Connolly [Mon, 26 Feb 2024 17:26:07 +0000 (17:26 +0000)]
mmc: msm_sdhci: use modern clock handling

Use the clk_* helper functions and the correct property name for clocks.

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 agousb: dwc3-generic: support external vbus regulator
Caleb Connolly [Mon, 26 Feb 2024 17:26:06 +0000 (17:26 +0000)]
usb: dwc3-generic: support external vbus regulator

Add support for a vbus-supply regulator specified in devicetree. This
provides generic support to avoid hardcoded GPIO configuration in board
init code.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
9 months agoarm: init: export prev_bl_fdt_addr
Caleb Connolly [Mon, 26 Feb 2024 17:26:05 +0000 (17:26 +0000)]
arm: init: export prev_bl_fdt_addr

When booting U-Boot on board with a locked down first-stage bootloader,
we emulate the Linux boot header. By passing the U-Boot FDT through this
first-stage bootloader and retrieving it afterwards we can pre-populate
the memory nodes and other info like the KASLR address.

Add a function to export the FDT addr so that boards can use it over the
built-in FDT.

Don't check is_addr_accessible() here because we might not yet have a
valid mem_map if it's going to be populated from the FDT, let the board
do their own validation instead.

Reviewed-by: Tom Rini <trini@konsulko.com>
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 agoMerge patch series "An effort to bring DT bindings compliance within U-Boot"
Tom Rini [Fri, 1 Mar 2024 03:24:23 +0000 (22:24 -0500)]
Merge patch series "An effort to bring DT bindings compliance within U-Boot"

Sumit Garg <sumit.garg@linaro.org> says:

Prerequisite
------------

This patch series requires devicetree-rebasing git repo to be added as a
subtree to the main U-Boot repo via:

$ git subtree add --prefix dts/upstream \
      https://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git \
      v6.7-dts --squash

Background
----------

This effort started while I was reviewing patch series corresponding to
Qcom platforms [1] which was about to import modified devicetree source
files from Linux kernel. I suppose keeping devicetree files sync with
Linux kernel without any DT bindings schema validation has been a pain
for U-Boot SoC/platform maintainers. There has been past discussions
about a single DT repo but that hasn't come up and Linux kernel remained
the place where DT source files as well as bindings are placed and
maintained.

However, Linux kernel DT maintainers proposed [2] for U-Boot to rather
use devicetree-rebasing repo [3] which is a forked copy from Linux
kernel for DT source files as well as bindings. It is tagged at every
Linux kernel major release or intermideate release candidates. So here I
have tried to reuse that to bring DT bingings compliance as well as a
standard way to maintain a regular sync of DT source files with Linux
kernel.

In order to maintain devicetree files sync, U-Boot will maintains a Git
subtree for devicetee-rebasing repo as `dts/upstream` sub-directory.
U-Boot will regularly sync `dts/upstream/` subtree whenever the next window
opens with the next available kernel major release.
`dts/update-dts-subtree.sh` script provides a wrapper around git subtree
pull command, usage from the top level U-Boot source tree, run:

$ ./dts/update-dts-subtree.sh pull <devicetree-rebasing-release-tag>

If required it is also possible to cherry-pick fixes from
devicetree-rebasing tree prior to next sync, usage:

$ ./dts/update-dts-subtree.sh pick <devicetree-rebasing-commit-id>

The RFC/prototype for this series has been discussed with Linux DT
maintainers as well as U-Boot maintainers here [4]. Now we would like to
reach out to wider U-Boot community to seek feedback.

[1] https://lore.kernel.org/all/CAFA6WYMLUD9cnkr=R0Uur+1UeTMkKjM2zDdMJtXb3nmrLk+pDg@mail.gmail.com/
[2] https://lore.kernel.org/all/CAL_JsqKEjv2tSGmT+0ZiO7_qbBfhTycbGnhJhYpKDFzfO9jzDg@mail.gmail.com/
[3] https://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git/
[4] https://github.com/u-boot/u-boot/pull/451

Changes
-------

Traditionally, U-Boot placed copies of devicetree source files from Linux
kernel into `arch/<arch>/dts/<name>.dts` which can be selected via setting
"<name>" when prompted for `DEFAULT_DEVICE_TREE` by Kconfig.

SoC/board maintainers are encouraged to migrate to use synced copies from
`dts/upstream/src/<arch>/<vendor>`. To do that enable `OF_UPSTREAM` for the
SoC being used via Kconfig and set up "<vendor>/<name>" when prompted for
`DEFAULT_DEVICE_TREE` by Kconfig.

An example have been shown for Amlogic meson-gxbb SoC and corresponding
derived boards via patch #10 and #11.

Devicetree bindings schema checks
---------------------------------

With devicetee-rebasing Git subtree, the devicetree bindings are also
regularly synced with Linux kernel as `dts/upstream/Bindings/`
sub-directory. This allows U-Boot to run devicetree bindings schema checks
which will bring compliance to U-Boot core/drivers regarding usage of
devicetree.

Dependencies
------------

The DT schema project must be installed in order to validate the DT schema
binding documents and validate DTS files using the DT schema. The DT schema
project can be installed with pip:

$ pip3 install dtschema

Note that 'dtschema' installation requires 'swig' and Python development
files installed first. On Debian/Ubuntu systems:

$ apt install swig python3-dev

Several executables (dt-doc-validate, dt-mk-schema, dt-validate) will be
installed. Ensure they are in your PATH (~/.local/bin by default).

Recommended is also to install yamllint (used by dtschema when present).

$ apt install yamllint

Running checks
--------------

In order to perform validation of DTB files, use the ``dtbs_check`` target:

$ make dtbs_check

It is also possible to run checks with a subset of matching schema files by
setting the ``DT_SCHEMA_FILES`` variable to 1 or more specific schema files
or patterns (partial match of a fixed string). Each file or pattern should
be separated by ':'.

$ make dtbs_check DT_SCHEMA_FILES=trivial-devices.yaml:rtc.yaml
$ make dtbs_check DT_SCHEMA_FILES=/gpio/
$ make dtbs_check DT_SCHEMA_FILES=trivial-devices.yaml

9 months agodts: meson-gxbb: Drop redundant devicetree files
Sumit Garg [Thu, 22 Feb 2024 09:36:07 +0000 (15:06 +0530)]
dts: meson-gxbb: Drop redundant devicetree files

Since meson-gxbb based boards switched to using upstream DT, so drop
redundant files from arch/arm/dts directory. Only *-u-boot.dtsi files
kept in arch/arm/dts directory for these boards.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
9 months agodts: meson-gxbb: Switch to using upstream DT
Sumit Garg [Thu, 22 Feb 2024 09:36:06 +0000 (15:06 +0530)]
dts: meson-gxbb: Switch to using upstream DT

Although there were still some variations in board DTS files based on
meson-gxbb SoC but I think those were minor differences from upstream
and shouldn't impact boot on these devices.

So enable OF_UPSTREAM to use upstream DT and add amlogic/ prefix to the
DEFAULT_DEVICE_TREE. And thereby directly build DTB from dts/upstream/src/
including *-u-boot.dtsi files from arch/$(ARCH)/dts/ directory.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
9 months agoMAINTAINERS: Add myself as devicetree-rebasing maintainer
Sumit Garg [Thu, 22 Feb 2024 09:36:05 +0000 (15:06 +0530)]
MAINTAINERS: Add myself as devicetree-rebasing maintainer

Add myself as devicetree-rebasing maintainer.

Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
9 months agodoc: devicetree: Updates for devicetree-rebasing subtree
Sumit Garg [Thu, 22 Feb 2024 09:36:04 +0000 (15:06 +0530)]
doc: devicetree: Updates for devicetree-rebasing subtree

Encourage SoC/board maintainers to migrate to using devicetree-rebasing
subtree and maintain a regular sync with Linux kernel devicetree files
and bindings.

Along with that add documentation regarding how to run DT bindings
schema checks.

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
9 months agodoc: devicetree: Align documentation to use Kconfig options
Sumit Garg [Thu, 22 Feb 2024 09:36:03 +0000 (15:06 +0530)]
doc: devicetree: Align documentation to use Kconfig options

Since U-Boot switched away from manual CONFIG_* defines to Kconfig
options, align devicetree documentation accordingly.

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
9 months agodts: Add script to uprev dts/upstream subtree
Sumit Garg [Thu, 22 Feb 2024 09:36:02 +0000 (15:06 +0530)]
dts: Add script to uprev dts/upstream subtree

dts/update-dts-subtree.sh is just a wrapper around git subtree commands.
Usage from the top level U-Boot source tree, run:

$ ./dts/update-dts-subtree.sh pull <release-tag>
$ ./dts/update-dts-subtree.sh pick <commit-id>

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
9 months agodts: Add alternative location for upstream DTB builds
Sumit Garg [Thu, 22 Feb 2024 09:36:01 +0000 (15:06 +0530)]
dts: Add alternative location for upstream DTB builds

Allow platform owners to mirror devicetree files from devitree-rebasing
directory into dts/upstream/src/$(ARCH) (special case for arm64). Then
build then along with any *-u-boot.dtsi file present in arch/$(ARCH)/dts
directory. Also add a new Makefile for arm64.

This will help easy migration for platforms which currently are compliant
with upstream Linux kernel devicetree files.

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
9 months agoMakefile: Allow upstream DT subtree to provide DT includes
Sumit Garg [Thu, 22 Feb 2024 09:36:00 +0000 (15:06 +0530)]
Makefile: Allow upstream DT subtree to provide DT includes

Allow platforms to reuse DT headers and dtsi includes directly form
upstream DT subtree which will be frequently synced with Linux kernel.
This will further allow us to drop corresponding DT includes copy from
U-Boot tree.

Also, since the DT includes from upstream DT subtree are done after DT
includes from U-Boot tree, so it shouldn't cause any conflicts.

Tested-by: Bryan Brattlof <bb@ti.com>
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
9 months agoscripts/Makefile.lib: Statically define *-u-boot.dtsi files location
Sumit Garg [Thu, 22 Feb 2024 09:35:59 +0000 (15:05 +0530)]
scripts/Makefile.lib: Statically define *-u-boot.dtsi files location

Allow u-boot to build DTB from a different directory tree such that
*-u-boot.dtsi files can be included from a common location. Currently
that location is arch/$(ARCH)/dts/, so statically define that common
location.

This is needed for platform owners to start building DTB files from
devicetree-rebasing directory but still being able to include
*-u-boot.dtsi files.

Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
9 months agoMakefile: Add support for DT bindings schema checks
Sumit Garg [Thu, 22 Feb 2024 09:35:58 +0000 (15:05 +0530)]
Makefile: Add support for DT bindings schema checks

This adds the build infrastructure for checking DT binding schema
documents and validating dtb files using the binding schema. Here we use
devicetree-rebasing subtree to provide the DT bindings. Along with that
adapt dts/upstream/Bindings/Makefile to align with old U-Boot Kbuild
infrastructure.

Dependency:
-----------

The DT schema project must be installed in order to validate the DT schema
binding documents and validate DTS files using the DT schema. The DT schema
project can be installed with pip::

    pip3 install dtschema

Note that 'dtschema' installation requires 'swig' and Python development
files installed first. On Debian/Ubuntu systems::

    apt install swig python3-dev

Testing:
--------

Build dts files and check using DT binding schema:
$ make dtbs_check

Optionally, DT_SCHEMA_FILES can be passed in with a schema file(s) to
use for validation. This makes it easier to find and fix errors
generated by a specific schema.

Note, at this point dtbs_check is an optional build target as there are
many warnings generated due to custom DT properties used by many
platforms in u-boot. It is expected with these checks that compliance
with DT bindings to take place. Once that's done it can be added to CI
builds to remain compliant with DT bindings.

Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
9 months agoCI: Exclude devicetree-rebasing subtree for CONFIG checks
Sumit Garg [Thu, 22 Feb 2024 09:35:57 +0000 (15:05 +0530)]
CI: Exclude devicetree-rebasing subtree for CONFIG checks

Since devicetree-rebasing is an external repo with its own coding style,
exclude it from Azure and gitlab CI CONFIG checks.

Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
9 months agoMerge commit '53633a893a06bd5a0c807287d9cc29337806eaf7' as 'dts/upstream'
Tom Rini [Thu, 29 Feb 2024 17:33:36 +0000 (12:33 -0500)]
Merge commit '53633a893a06bd5a0c807287d9cc29337806eaf7' as 'dts/upstream'

9 months agoSquashed 'dts/upstream/' content from commit aaba2d45dc2a
Tom Rini [Thu, 29 Feb 2024 17:33:36 +0000 (12:33 -0500)]
Squashed 'dts/upstream/' content from commit aaba2d45dc2a

git-subtree-dir: dts/upstream
git-subtree-split: aaba2d45dc2a1b3bbb710f2a3808ee1c9f340abe

9 months agoMerge patch series "Handoff bloblist from previous boot stage"
Tom Rini [Thu, 29 Feb 2024 14:24:49 +0000 (09:24 -0500)]
Merge patch series "Handoff bloblist from previous boot stage"

Raymond Mao <raymond.mao@linaro.org> says:

This patch set adds/adapts a few bloblist APIs and implements Arm arch
custom function to retrieve the bloblist (aka. Transfer List) from
previous loader via boot arguments when BLOBLIST option is enabled and
all boot arguments are compliant to the register conventions defined
in the Firmware Handoff spec v0.9.

If an arch wishes to have different behaviors for loading bloblist
from the previous boot stage, it is required to implement the custom
function xferlist_from_boot_arg().

9 months agodts: OF_HAS_PRIOR_STAGE should depend on !BLOBLIST
Raymond Mao [Sat, 3 Feb 2024 16:36:27 +0000 (08:36 -0800)]
dts: OF_HAS_PRIOR_STAGE should depend on !BLOBLIST

When BLOBLIST is enabled, FDT is expected to be from bloblist
carried from previous stage, instead of from OF_BOARD, therefore
only enable OF_HAS_PRIOR_STAGE when BLOBLIST is disabled.

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
9 months agobloblist: Load the bloblist from the previous loader
Raymond Mao [Sat, 3 Feb 2024 16:36:26 +0000 (08:36 -0800)]
bloblist: Load the bloblist from the previous loader

During bloblist initialization, load the bloblist via boot arguments
from the previous loader.
If a valid bloblist exists in boot arguments, relocate it into the
fixed bloblist memory region.
If not, fallback to support BLOBLIST_ADDR or BLOBLIST_ALLOC.

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
9 months agoarm: Get bloblist from boot arguments
Raymond Mao [Sat, 3 Feb 2024 16:36:25 +0000 (08:36 -0800)]
arm: Get bloblist from boot arguments

Add arch custom function to get bloblist from boot arguments.
Check whether boot arguments aligns with the register conventions
defined in FW Handoff spec v0.9.

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
9 months agoarm: armv8: save boot arguments
Raymond Mao [Sat, 3 Feb 2024 16:36:24 +0000 (08:36 -0800)]
arm: armv8: save boot arguments

Save boot arguments x[0-3] into an array for handover of bloblist from
previous boot stage.

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Suggested-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
9 months agoarm: armv7: save boot arguments
Raymond Mao [Sat, 3 Feb 2024 16:36:23 +0000 (08:36 -0800)]
arm: armv7: save boot arguments

Save boot arguments r[0-3] into an array for handover of bloblist from
previous boot stage.

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Suggested-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
9 months agobloblist: refactor of bloblist_reloc()
Raymond Mao [Sat, 3 Feb 2024 16:36:22 +0000 (08:36 -0800)]
bloblist: refactor of bloblist_reloc()

The current bloblist pointer and size can be retrieved from global
data, so we don't need to pass them from the function arguments.
This change also help to remove all external access of gd->bloblist
outside of bloblist module.

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
9 months agobloblist: check bloblist with specified buffer size
Raymond Mao [Sat, 3 Feb 2024 16:36:21 +0000 (08:36 -0800)]
bloblist: check bloblist with specified buffer size

Instead of expecting the bloblist total size to be the same as the
pre-allocated buffer size, practically we are more interested in
whether the pre-allocated buffer size is bigger than the bloblist
total size.

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
9 months agobloblist: add API to check the register conventions
Raymond Mao [Sat, 3 Feb 2024 16:36:20 +0000 (08:36 -0800)]
bloblist: add API to check the register conventions

Add bloblist_check_reg_conv() to check whether the bloblist is compliant
to the register conventions defined in Firmware Handoff specification.
This API can be used for all Arm platforms.

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
9 months agoMerge patch series "mux: Drop usage of "u-boot,mux-autoprobe""
Tom Rini [Thu, 29 Feb 2024 00:20:00 +0000 (19:20 -0500)]
Merge patch series "mux: Drop usage of "u-boot,mux-autoprobe""

Roger Quadros <rogerq@kernel.org> says:

MUX driver should autoprobe if the device tree has "idle-states"
property. Drop using the custom "u-boot,mux-autoprobe" property
in TI device trees.

9 months agoarm: dts: k3-u-boot: Add missing "bootph-all" property to MUX nodes.
Roger Quadros [Wed, 31 Jan 2024 13:33:48 +0000 (15:33 +0200)]
arm: dts: k3-u-boot: Add missing "bootph-all" property to MUX nodes.

As it is present for USB and USB won't work without the MUX
initialized correctly, add "bootph-all" property to MUX nodes.

Signed-off-by: Roger Quadros <rogerq@kernel.org>
9 months agoarm: dts: k3-u-boot: Drop usage of "u-boot, mux-autoprobe"
Roger Quadros [Wed, 31 Jan 2024 13:33:47 +0000 (15:33 +0200)]
arm: dts: k3-u-boot: Drop usage of "u-boot, mux-autoprobe"

MUX driver should autoprobe if the device tree has "idle-states"
property. Drop using the custom "u-boot,mux-autoprobe" property.

Signed-off-by: Roger Quadros <rogerq@kernel.org>
9 months agomux: autoprobe if "idle-states" present in device tree
Roger Quadros [Wed, 31 Jan 2024 13:33:46 +0000 (15:33 +0200)]
mux: autoprobe if "idle-states" present in device tree

Some platforms need the MUX state to be auto initialized at
boot time even if there are no explicit users for the MUX.
In these cases, the MUX device tree has "idle-states" property
which specifies what state the MUX should be initialized to.

So far we were relying on custom u-boot property "u-boot,mux-autoprobe"
to autoprobe such MUXes. This patch causes the MUX to autoprobe
if it has "idle-states" property in device tree.

This should allow us to stop using the custom "u-boot,mux-autoprobe"
property.

Signed-off-by: Roger Quadros <rogerq@kernel.org>
9 months agoMerge tag 'efi-next-2024-02-28' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Wed, 28 Feb 2024 20:09:30 +0000 (15:09 -0500)]
Merge tag 'efi-next-2024-02-28' of https://source.denx.de/u-boot/custodians/u-boot-efi into next

Pull request efi-next-2024-02-28

* set IMAGE_DLLCHARACTERISTICS_NX_COMPAT in EFI binaries
* provide SBI based runtime system reset
* page align EFI binary section on ARMv7
* separate .data and .text sections of EFI binaries on ARMv7

9 months agoarm: separate .data and .text sections of EFI binaries
Heinrich Schuchardt [Mon, 26 Feb 2024 21:24:08 +0000 (22:24 +0100)]
arm: separate .data and .text sections of EFI binaries

EFI binaries should not contain sections that are both writable and
executable. Separate the RX .text section from the RW .data section.

We currently don't created relocation sections (.rel.*) for our EFI
binaries. Anyway these would have to be converted to PE/COFF relocations.
Enumerate them under DISCARD and add a comment.

Correct the characteristics of the sections.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
9 months agoarm: page align EFI binary section
Heinrich Schuchardt [Mon, 26 Feb 2024 21:24:07 +0000 (22:24 +0100)]
arm: page align EFI binary section

Change the alignment of the relocation code in EFI binaries to match page
boundaries.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
9 months agoefi_driver: provide SBI based runtime system reset
Heinrich Schuchardt [Mon, 12 Feb 2024 16:18:37 +0000 (17:18 +0100)]
efi_driver: provide SBI based runtime system reset

On RISC-V systems system the Supervisory Binary Interface provides system
reset and poweroff. Use it at EFI runtime.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
9 months agoefi_loader: set IMAGE_DLLCHARACTERISTICS_NX_COMPAT
Heinrich Schuchardt [Wed, 14 Feb 2024 20:43:21 +0000 (21:43 +0100)]
efi_loader: set IMAGE_DLLCHARACTERISTICS_NX_COMPAT

The IMAGE_DLLCHARACTERISTICS_NX_COMPAT flag marks an EFI binary where
the following conditions are met [1]:

* Executable and writable sections are separated.
* The application does not run self-modifying code.
* The application uses the EFI_MEMORY_ATTRIBUTE_PROTOCOL when loading
  executable code.
* The application does not assume that all memory ranges are usable.
* The stack is not expected to be executable.

The only EFI binaries U-Boot provides that do not fulfill these
requirements are the EFI app and the EFI payload.

Once we have implemented separation of writable and executable memory in
U-Boot we can use the IMAGE_DLLCHARACTERISTICS_NX_COMPAT flag to decide
if we will load an EFI binary.

[1] New UEFI CA memory mitigation requirements for signing
    https://techcommunity.microsoft.com/t5/hardware-dev-center/new-uefi-ca-memory-mitigation-requirements-for-signing/ba-p/3608714

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
9 months agoMerge patch series "kbuild: Allow for CONFIG_SYS_CONFIG_NAME to be unset"
Tom Rini [Tue, 27 Feb 2024 19:14:15 +0000 (14:14 -0500)]
Merge patch series "kbuild: Allow for CONFIG_SYS_CONFIG_NAME to be unset"

Perform a little re-organization of Kconfig so that we can have
CONFIG_SYS_CONFIG_NAME be unset and so not require a "board.h" file.
Then go and remove a number of now not required header files.

9 months agoKconfig: Centralize prompting for SYS_CONFIG_NAME
Tom Rini [Mon, 22 Jan 2024 22:39:20 +0000 (17:39 -0500)]
Kconfig: Centralize prompting for SYS_CONFIG_NAME

Generally speaking, we do not prompt for this value and define it in the
board specific Kconfig file. There are some valid use cases however
today where we do prompt for this value, so instead of having this be
done in a number of locations, do this at the top-level location only.

This removes the question from a number of other locations and makes it
consistent that when we do set the value directly, we always do it the
same way. We don't need to specify the type, it's always string.

Signed-off-by: Tom Rini <trini@konsulko.com>
9 months agohc2910-2aghd05: Remove empty config header
Tom Rini [Mon, 22 Jan 2024 22:39:19 +0000 (17:39 -0500)]
hc2910-2aghd05: Remove empty config header

Now that we support having CONFIG_SYS_CONFIG_NAME be unset to indicate a
lack of board.h file, unset this on the hc2910-2aghd05 platform and remove
the otherwise empty file.

Signed-off-by: Tom Rini <trini@konsulko.com>
9 months agoslimbootloader: Remove empty config header
Tom Rini [Mon, 22 Jan 2024 22:39:18 +0000 (17:39 -0500)]
slimbootloader: Remove empty config header

Now that we support having CONFIG_SYS_CONFIG_NAME be unset to indicate a
lack of board.h file, unset this on the slimbootloader platform and remove
the otherwise empty file.

Signed-off-by: Tom Rini <trini@konsulko.com>
9 months agoqemu-x86*: Remove empty config header
Tom Rini [Mon, 22 Jan 2024 22:39:17 +0000 (17:39 -0500)]
qemu-x86*: Remove empty config header

Now that we support having CONFIG_SYS_CONFIG_NAME be unset to indicate a
lack of board.h file, unset this on the qemu-x86* platforms and remove
the otherwise empty file.

Signed-off-by: Tom Rini <trini@konsulko.com>
9 months agominnowmax: Remove empty config header
Tom Rini [Mon, 22 Jan 2024 22:39:16 +0000 (17:39 -0500)]
minnowmax: Remove empty config header

Now that we support having CONFIG_SYS_CONFIG_NAME be unset to indicate a
lack of board.h file, unset this on the minnowmax platform and remove
the otherwise empty file.

Signed-off-by: Tom Rini <trini@konsulko.com>
9 months agogalileo: Remove empty config header
Tom Rini [Mon, 22 Jan 2024 22:39:15 +0000 (17:39 -0500)]
galileo: Remove empty config header

Now that we support having CONFIG_SYS_CONFIG_NAME be unset to indicate a
lack of board.h file, unset this on the galileo platform and remove
the otherwise empty file.

Signed-off-by: Tom Rini <trini@konsulko.com>
9 months agoefi-x86_payload: Remove empty config header
Tom Rini [Mon, 22 Jan 2024 22:39:14 +0000 (17:39 -0500)]
efi-x86_payload: Remove empty config header

Now that we support having CONFIG_SYS_CONFIG_NAME be unset to indicate a
lack of board.h file, unset this on the efi-x86_payload* platforms and remove
the otherwise empty file.

Signed-off-by: Tom Rini <trini@konsulko.com>
9 months agoefi-x86_app: Remove empty config header
Tom Rini [Mon, 22 Jan 2024 22:39:13 +0000 (17:39 -0500)]
efi-x86_app: Remove empty config header

Now that we support having CONFIG_SYS_CONFIG_NAME be unset to indicate a
lack of board.h file, unset this on the efi-x86_app* platforms and remove
the otherwise empty file.

Signed-off-by: Tom Rini <trini@konsulko.com>
9 months agoedison: Remove empty config header
Tom Rini [Mon, 22 Jan 2024 22:39:12 +0000 (17:39 -0500)]
edison: Remove empty config header

Now that we support having CONFIG_SYS_CONFIG_NAME be unset to indicate a
lack of board.h file, unset this on the edison platform and remove
the otherwise empty file.

Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
9 months agocrownbay: Remove empty config header
Tom Rini [Mon, 22 Jan 2024 22:39:11 +0000 (17:39 -0500)]
crownbay: Remove empty config header

Now that we support having CONFIG_SYS_CONFIG_NAME be unset to indicate a
lack of board.h file, unset this on the crownbay platform and remove
the otherwise empty file.

Signed-off-by: Tom Rini <trini@konsulko.com>
9 months agocougarcanyon2: Remove empty config header
Tom Rini [Mon, 22 Jan 2024 22:39:10 +0000 (17:39 -0500)]
cougarcanyon2: Remove empty config header

Now that we support having CONFIG_SYS_CONFIG_NAME be unset to indicate a
lack of board.h file, unset this on the cougarcanyon2 platform and remove
the otherwise empty file.

Signed-off-by: Tom Rini <trini@konsulko.com>