pandora-u-boot.git
4 months agotreewide: Replace Maximumm with Maximum in Kconfig symbol description
Marek Vasut [Tue, 21 Jan 2025 15:36:11 +0000 (16:36 +0100)]
treewide: Replace Maximumm with Maximum in Kconfig symbol description

Replace Maximumm with Maximum in Kconfig symbol description, fix a typo.
No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Michal Simek <michal.simek@amd.com>
4 months agoMerge tag 'u-boot-dfu-20250124' of https://source.denx.de/u-boot/custodians/u-boot-dfu
Tom Rini [Fri, 24 Jan 2025 14:48:48 +0000 (08:48 -0600)]
Merge tag 'u-boot-dfu-20250124' of https://source.denx.de/u-boot/custodians/u-boot-dfu

CI: https://source.denx.de/u-boot/custodians/u-boot-dfu/-/pipelines/24323

Android:
- Fix kcmdline null pointer dereference (reported by coverity and
  multiple users)
- Move Igor to reviewers instead of maintainers for avb/ab
- Fix booting Android with AVB built-in, but disabled via
  fastboot flash --disable-verity vbmeta vbmeta.img

4 months agoMerge tag 'u-boot-socfpga-next-20250124' of https://source.denx.de/u-boot/custodians...
Tom Rini [Fri, 24 Jan 2025 04:40:25 +0000 (22:40 -0600)]
Merge tag 'u-boot-socfpga-next-20250124' of https://source.denx.de/u-boot/custodians/u-boot-socfpga

1.  Bug fixed for doorbell in secure device manager mailbox driver
2.  Enhancement on SoCFPGA dwc_eth_xgmac driver
3.  Enhancement on DW MAC driver
4.  Improved the error message and status for SoC64 device FPGA
    configuration driver
5.  Updated existing watchdog in system manager to support new SM device

4 months agofpga: intel_sdm_mb: add support for query SDM config error and status
Boon Khai Ng [Fri, 17 Jan 2025 06:33:31 +0000 (14:33 +0800)]
fpga: intel_sdm_mb: add support for query SDM config error and status

Currently the FPGA reconfig status only return a single error status
which make the debugging of FPGA reconfiguration hard.

This patch is to expose the error status, major error code and
minor error code, for the FPGA reconfig to upper layer app.

Signed-off-by: Boon Khai Ng <boon.khai.ng@intel.com>
Reviewed-by: Tien Fong Chee <tien.fong.chee@intel.com>
4 months agonet: dwc_eth_xgmac_socfpga: Add support for distinct mac-mode and phy mode.
Boon Khai Ng [Fri, 17 Jan 2025 06:14:02 +0000 (14:14 +0800)]
net: dwc_eth_xgmac_socfpga: Add support for distinct mac-mode and phy mode.

This patch adds support for configuring the ethernet MAC mode independently
from the PHY mode on our SoC FPGA board. Specifically, this is necessary
for a scenario where the ethernet controller MAC is connected to the
FPGA HVIO with a different GMII interface, and the FPGA output is routed
to the PHY using a RGMII interface.

To support this configuration, a mechanism is introduced to handle
separate MAC mode settings, ensuring that the MAC controller and PHY
can operate correctly with their respective interface modes.

If mac-mode is not defined, the MAC mode will default to the PHY mode,
ensuring compatibility and proper operation between the MAC and PHY.

Signed-off-by: Boon Khai Ng <boon.khai.ng@intel.com>
Reviewed-by: Tien Fong Chee <tien.fong.chee@intel.com>
4 months agonet: dwc_eth_xgmac: Add device name for the error message.
Boon Khai Ng [Fri, 17 Jan 2025 06:48:23 +0000 (14:48 +0800)]
net: dwc_eth_xgmac: Add device name for the error message.

Agilex5 having several ethernet instance, adding the device
name at the error message to differentiate between which
instance is having issue.

Signed-off-by: Boon Khai Ng <boon.khai.ng@intel.com>
Reviewed-by: Tien Fong Chee <tien.fong.chee@intel.com>
4 months agonet: dwc_eth_xgmac_socfpga: Add support for rgmii-id mode.
Boon Khai Ng [Fri, 17 Jan 2025 06:56:25 +0000 (14:56 +0800)]
net: dwc_eth_xgmac_socfpga: Add support for rgmii-id mode.

An issue was identified where selecting the phy-mode as
rgmii-id in the device tree source (DTS) would cause the
`dwc_eth_xgmac_socfpga` driver to raise an unsupported phy mode error.

From the MAC controller's perspective, the rgmii and rgmii-id
phy modes are effectively identical. To address this, both
modes will now be configured to rgmii in the MAC controller.

This change ensures that the rgmii-id phy mode is properly
supported without error.

Signed-off-by: Boon Khai Ng <boon.khai.ng@intel.com>
Reviewed-by: Tien Fong Chee <tien.fong.chee@intel.com>
4 months agonet: designware: socfpga: Add RGMII-ID support
Rufus Segar [Wed, 4 Dec 2024 11:21:27 +0000 (11:21 +0000)]
net: designware: socfpga: Add RGMII-ID support

This patch adds support for the "rgmii-id", "rgmii-rxid", and
"rgmii-txid" modes for the dwmac_socfpga driver.

Signed-off-by: Rufus Segar <rhs@riseup.net>
4 months agoarch: arm: mach-socfpga: Mailbox buffer and SDM doorbell improvement
Alif Zakuan Yuslaimi [Wed, 22 Jan 2025 02:21:02 +0000 (10:21 +0800)]
arch: arm: mach-socfpga: Mailbox buffer and SDM doorbell improvement

The current write and notify SDM to read mechanism has a flaw where
SDM is not notified enough to be able to read all the data in the buffer.

This is caused by SDM doorbell will only be sent out once the command
buffer overflow check is satisfied. If the command buffer does not reach
overflow status, no SDM doorbell will be sent out, which may cause a
timeout as the mailbox driver will be waiting for the SDM to read the
buffer to empty even though SDM is not notified to do so.

The solution is to remove the command buffer overflow check
and set the SDM doorbell to always trigger at the end of the command
buffer.

This will ensure that the SDM is able to read all of the data.

Signed-off-by: Alif Zakuan Yuslaimi <alif.zakuan.yuslaimi@altera.com>
4 months agoarm: socfpga:agilex5: Fix system manager watchdog mode setting
Muhammad Hazim Izzat Zamri [Mon, 13 Jan 2025 02:08:07 +0000 (10:08 +0800)]
arm: socfpga:agilex5: Fix system manager watchdog mode setting

This commit is to fix the system manager watchdog mode setting to support
until mode_4 for Agilex5. This changes can refer to system manager register
map on wddbg fields.

In Agilex7 it is not detected as an issue because Agilex7 only have 4 watchdog
until mode_3 and it is already been set correctly for it to halt on any CPU in
debug mode. However, in Agilex5 this fix is needed in order to enable the watchdog
pause feature for mode_4 when entering debug mode. If 0xF is not been set on mode_4,
the Watchdog Timers will not halt on any CPU. As by default value, the pause signal
does not assert when any CPU is in debug mode and the watchdog continue to count.

Signed-off-by: Muhammad Hazim Izzat Zamri <muhammad.hazim.izzat.zamri@intel.com>
Reviewed-by: Tien Fong Chee <tien.fong.chee@intel.com>
4 months agoMerge patch series "MediaTek ethernet driver refactor and updates"
Tom Rini [Fri, 24 Jan 2025 00:50:23 +0000 (18:50 -0600)]
Merge patch series "MediaTek ethernet driver refactor and updates"

Weijie Gao <weijie.gao@mediatek.com> says:

This patch series will split the switch initialization code from mtk_eth
driver into their own files and then add new SoC and switch support.

Link: https://lore.kernel.org/r/cover.1736498083.git.weijie.gao@mediatek.com
4 months agoMerge patch series "Add bitbang feature for npcm8xx and driver"
Tom Rini [Fri, 24 Jan 2025 00:45:56 +0000 (18:45 -0600)]
Merge patch series "Add bitbang feature for npcm8xx and driver"

Michael Chang <zhang971090220@gmail.com> says:

I am resubmitting the patch titled "Add bitbang feature for npcm8xx
and driver" for review and inclusion in the upstream project.

Driver didn't support bitbang feature.
Add bb_miiphy_bus function for driver and open feature for npcm8xx

the log is as below:
-------------------------------------------------
U-Boot 2024.10-g30b9cdaf2df5-dirty (Jan 09 2025 - 00:57:37 +0000)

CPU-0: NPCM845 A1 @ Model: Nuvoton npcm845 Development Board (Device Tree)
DRAM:  1 GiB
RNG: NPCM RNG module bind OK
OTP: NPCM OTP module bind OK
AES: NPCM AES module bind OK
SHA: NPCM SHA module bind OK
I/TC: Reserved shared memory is enabled
I/TC: Dynamic shared memory is enabled
I/TC: Normal World virtualization support is disabled
I/TC: Asynchronous notifications are disabled
Core:  649 devices, 28 uclasses, devicetree: separate
WDT:   Not starting watchdog@901c
MMC:   sdhci@f0842000: 0
Loading Environment from SPIFlash... SF:
Detected w25q512jvq with page size 256 Bytes, erase size 64 KiB,
total 64 MiB
OK
In:    serial@0
Out:   serial@0
Err:   serial@0
Net:   eth0: eth@f0802000, eth1: eth@f0804000, eth3: eth@f0808000
Hit any key to stop autoboot:  0
U-Boot>
U-Boot>
U-Boot>setenv ipaddr 192.168.16.3
U-Boot>ping 192.168.16.12
eth@f0802000 Waiting for PHY auto negotiation to complete
......... TIMEOUT !
Could not initialize PHY eth@f0802000
eth@f0804000 Waiting for PHY auto negotiation to complete
......... TIMEOUT !
Could not initialize PHY eth@f0804000
Speed: 100, full duplex
Using eth@f0808000 device
host 192.168.16.12 is alive

Link: https://lore.kernel.org/r/20250117104540.1580343-1-zhang971090220@gmail.com
4 months agonet: designware: Add bitbang feature for designware driver.
Michael Chang [Fri, 17 Jan 2025 10:45:40 +0000 (18:45 +0800)]
net: designware: Add bitbang feature for designware driver.

Add bb_miiphy_bus function for designware bitbang feature.

Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
Signed-off-by: Michael Chang <zhang971090220@gmail.com>
4 months agoARM: configs: nuvoton: add bitbang feature for npcm8xx.
Michael Chang [Fri, 17 Jan 2025 10:45:39 +0000 (18:45 +0800)]
ARM: configs: nuvoton: add bitbang feature for npcm8xx.

Enable bitbang and multiple bitbang feature for npcm8xx platform.

Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
Signed-off-by: Michael Chang <zhang971090220@gmail.com>
4 months agoARM: dts: nuvoton: Add bitbang delay through dts properties.
Michael Chang [Fri, 17 Jan 2025 10:45:38 +0000 (18:45 +0800)]
ARM: dts: nuvoton: Add bitbang delay through dts properties.

Add bitbang delay through dts properties.

Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
Signed-off-by: Michael Chang <zhang971090220@gmail.com>
4 months agonet: mediatek: add support for Airoha AN8855 ethernet switch
Weijie Gao [Fri, 10 Jan 2025 08:41:24 +0000 (16:41 +0800)]
net: mediatek: add support for Airoha AN8855 ethernet switch

Airoha AN8855 is a 5-port gigabit switch with a 2.5G HSGMII CPU port

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 months agonet: mediatek: add support for MediaTek MT7987 SoC
Weijie Gao [Fri, 10 Jan 2025 08:41:20 +0000 (16:41 +0800)]
net: mediatek: add support for MediaTek MT7987 SoC

This patch adds support for MediaTek MT7987.

MT7987 features MediaTek NETSYS v3, similar to MT7988, features three GMACs
which support 2.5Gb HSGMII. One 2.5Gb PHY is also embedded an can be
connected to a dedicated GMAC.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 months agonet: mediatek: split ethernet switch code from mtk_eth.c
Weijie Gao [Fri, 10 Jan 2025 08:41:13 +0000 (16:41 +0800)]
net: mediatek: split ethernet switch code from mtk_eth.c

mtk_eth.c contains not only the ethernet GMAC/DMA driver, but also
some ethernet switch initialization code. As we may add more switch
support in the future, it's better to move them out of mtk_eth.c to
avoid increasing the code complexity.

Since not all switches are supported for a particular board, Kconfig
options are added to allow user to select which switch should be
built into u-boot. If multiple switches are selected, auto-detecting
can also be enabled.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 months agoconfigs: phycore_am64x_a53_defconfig: Fix environment
Daniel Schultz [Thu, 16 Jan 2025 11:29:32 +0000 (03:29 -0800)]
configs: phycore_am64x_a53_defconfig: Fix environment

Enable ENV_OVERWRITE to allow environment variables to be
overwritten within the board code. This is required to add
MAC addresses during SOM detection.

Additionally, set ENV_IS_NOWHERE for boot sources other than MMC.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Reviewed-by: Wadim Egorov <w.egorov@phytec.de>
4 months agoconfigs: phycore_am64x_a53_defconfig: Enable GPIO command
Daniel Schultz [Thu, 16 Jan 2025 11:29:31 +0000 (03:29 -0800)]
configs: phycore_am64x_a53_defconfig: Enable GPIO command

Enable the GPIO command to allow access to the GPIO pins.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Reviewed-by: Wadim Egorov <w.egorov@phytec.de>
4 months agoconfigs: phycore_am64x_a53_defconfig: Fix GPIO controllers
Daniel Schultz [Thu, 16 Jan 2025 11:29:30 +0000 (03:29 -0800)]
configs: phycore_am64x_a53_defconfig: Fix GPIO controllers

The phyBOARD-Electra does not include a PCA953x I2C GPIO multiplexer.
Remove this configuration as it is a remnant from another
defconfig, and enable CONFIG_DA8XX_GPIO for the DA8XX DaVinci GPIO
controller instead.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Reviewed-by: Wadim Egorov <w.egorov@phytec.de>
4 months agoboard: phytec: common: k3: Add missing boot source to env
Daniel Schultz [Thu, 16 Jan 2025 11:29:29 +0000 (03:29 -0800)]
board: phytec: common: k3: Add missing boot source to env

We set the boot source as environment variable 'boot'.
Also include 'uart' and 'usbdfu' as possible boot sources.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Reviewed-by: Wadim Egorov <w.egorov@phytec.de>
4 months agoconfigs: phycore_am62x_r5_defconfig: Increase SPL Malloc Pool
Daniel Schultz [Wed, 15 Jan 2025 10:38:13 +0000 (02:38 -0800)]
configs: phycore_am62x_r5_defconfig: Increase SPL Malloc Pool

Increase the malloc pool size for the SPL by additional 4kB from
0x7000 to 0x8000.

This fixes following error message:
  ...
  alloc space exhausted ptr 7028 limit 7000
  DRAM init failed: -12

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
4 months agoboard: phytec: phycore-am62x: Add DDR size fixups if ECC is enabled
Wadim Egorov [Wed, 15 Jan 2025 09:41:29 +0000 (10:41 +0100)]
board: phytec: phycore-am62x: Add DDR size fixups if ECC is enabled

With commit 22ce56a3ebdb ("ram: k3-ddrss: Add k3_ddrss_ddr_bank_base_size_calc()
to solve 'calculations restricted to 32 bits' issue") we need to provide the
detected RAM size in the device tree node prio to K3 DDRSS driver probe.
This is done by calling fdt_fixup_memory_banks() in do_board_detect().

After probing, call into k3-ddrss driver to fixup device tree and resize
the available amount of DDR if ECC is enabled.

A third fixup is required from A53 SPL to take the fixup
as done from R5 SPL and apply it to DT passed to A53 U-boot,
which in turn passes this to the OS.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
4 months agoMerge patch series "Cumulative fixes and updates for MediaTek platform"
Tom Rini [Thu, 23 Jan 2025 14:20:42 +0000 (08:20 -0600)]
Merge patch series "Cumulative fixes and updates for MediaTek platform"

Weijie Gao <weijie.gao@mediatek.com> says:

This patch series contains fixes and updates for MediaTek platform,
including drivers, board and arch files.

Link: https://lore.kernel.org/r/cover.1737104723.git.weijie.gao@mediatek.com
4 months agoMAINTAINERS: update file list for MediaTek ARM platform
Weijie Gao [Fri, 17 Jan 2025 09:18:59 +0000 (17:18 +0800)]
MAINTAINERS: update file list for MediaTek ARM platform

Add driver files for MediaTek ARM platform

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 months agoarm: dts: mediatek: update mt7981 mmc node
Weijie Gao [Fri, 17 Jan 2025 09:18:55 +0000 (17:18 +0800)]
arm: dts: mediatek: update mt7981 mmc node

1. Fix mmc clock order of mt7981 to match the clock name
2. Limit the max clock of SD to 50MHz to meet SD Card Spec 2.0
3. Increase the CLK pin driving strength to 8mA

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 months agoarm: dts: medaitek: add flash interface driving settings for mt7988
Weijie Gao [Fri, 17 Jan 2025 09:18:41 +0000 (17:18 +0800)]
arm: dts: medaitek: add flash interface driving settings for mt7988

Add driving settings for both SPI and SD/eMMC interfaces to support ensure
flash devices is accessible for ram-booting.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 months agoarm: dts: mediatek: add support for all three GMACs for mt7988
Weijie Gao [Fri, 17 Jan 2025 09:18:27 +0000 (17:18 +0800)]
arm: dts: mediatek: add support for all three GMACs for mt7988

This patch add all three GMACs nodes for mt7988. Each GMAC can be
configured to connect to different ethernet switches/PHYs.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 months agoarm: dts: medaitek: fix internal switch link speed of mt7988
Weijie Gao [Fri, 17 Jan 2025 09:18:22 +0000 (17:18 +0800)]
arm: dts: medaitek: fix internal switch link speed of mt7988

The CPU port of mt7988 internal switch uses 10Gb link speed.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 months agoarm: dts: mediatek: add pcie support for mt7988
Weijie Gao [Fri, 17 Jan 2025 09:18:17 +0000 (17:18 +0800)]
arm: dts: mediatek: add pcie support for mt7988

This patch adds PCIe support for mt7988

Signed-off-by: Sam Shih <sam.shih@mediatek.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 months agopci: mediatek: add support for multiple ports in mediatek pcie gen3 driver
Weijie Gao [Fri, 17 Jan 2025 09:18:11 +0000 (17:18 +0800)]
pci: mediatek: add support for multiple ports in mediatek pcie gen3 driver

One MediaTek PCIe Gen3 controller has only one port, where PCI bus 0
on this port represents the controller itself and bus 1 represents
the external PCIe device.

If multiple PCIe controllers are probed in U-Boot, U-Boot will use
bus numbers greater than 2 as input parameters. Therefore, we should
convert the BDF bus number to either 0 or 1 by subtracting the
offset by controller->seq_.

Signed-off-by: Sam Shih <sam.shih@mediatek.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 months agopwm: mediatek: add pwm3 support for mt7981
Weijie Gao [Fri, 17 Jan 2025 09:18:06 +0000 (17:18 +0800)]
pwm: mediatek: add pwm3 support for mt7981

This patch adds pwm channel 2 (pwm3) support for mt7981

Signed-off-by: Sam Shih <sam.shih@mediatek.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 months agoarm: dts: mediatek: add quad mode capabilities for SPI flashes
Weijie Gao [Fri, 17 Jan 2025 09:18:01 +0000 (17:18 +0800)]
arm: dts: mediatek: add quad mode capabilities for SPI flashes

Explicitly add quad mode capabilities or the SPI controller may
start transfer in single mode.

Signed-off-by: SkyLake.Huang <skylake.huang@mediatek.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 months agospi: mtk_spim: check slave device mode in spi-mem's supports_op
Weijie Gao [Fri, 17 Jan 2025 09:17:55 +0000 (17:17 +0800)]
spi: mtk_spim: check slave device mode in spi-mem's supports_op

Call spi_mem_default_supports_op() in supports_op to honor the
slave's supported single/dual/quad mode settings.

Signed-off-by: SkyLake.Huang <skylake.huang@mediatek.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 months agospi: mtk_spim: add support to use DT live tree
Weijie Gao [Fri, 17 Jan 2025 09:17:51 +0000 (17:17 +0800)]
spi: mtk_spim: add support to use DT live tree

Change devfdt_get_addr_ptr to dev_read_addr_ptr to support DT live tree.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 months agoconfigs: mt7988: move image load address to 0x44000000
Weijie Gao [Fri, 17 Jan 2025 09:17:44 +0000 (17:17 +0800)]
configs: mt7988: move image load address to 0x44000000

This patch sets mt7988 image load address to 0x44000000 to support loading
larger images.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 months agoconfigs: mt7629: move image load address to 0x42000000
Weijie Gao [Fri, 17 Jan 2025 09:17:38 +0000 (17:17 +0800)]
configs: mt7629: move image load address to 0x42000000

Update the image load address to ensure it matches the mt7629 NOR
controller's DMA alignment requirements.

Signed-off-by: Sam Shih <sam.shih@mediatek.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 months agoclk: mediatek: fix uninitialized fields issue in INFRA_MUX struct
Weijie Gao [Fri, 17 Jan 2025 09:16:38 +0000 (17:16 +0800)]
clk: mediatek: fix uninitialized fields issue in INFRA_MUX struct

This patch adds missing initialization of fields in INFRA_MUX struct
which caused uart broken after any other infra mux being enabled by
'clk_prepare_enable'

Signed-off-by: Sam Shih <sam.shih@mediatek.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 months agoboard: mediatek: mt7622: remove board_late_init
Weijie Gao [Fri, 17 Jan 2025 09:16:33 +0000 (17:16 +0800)]
board: mediatek: mt7622: remove board_late_init

The function board_late_init defined for mt7622 is useless now. Just
remove it.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 months agobootstd: android: Allow boot with AVB failures when unlocked
Mattijs Korpershoek [Wed, 8 Jan 2025 14:38:42 +0000 (15:38 +0100)]
bootstd: android: Allow boot with AVB failures when unlocked

When the bootloader is UNLOCKED, it should be possible to boot Android
even if AVB reports verification errors [1].

This allows developers to flash modified partitions on
userdebug/engineering builds.

Developers can do so on unlocked devices with:
$ fastboot flash --disable-verity --disable-verification vbmeta vbmeta.img

In such case, bootmeth_android refuses to boot.

Allow the boot to continue when the device is UNLOCKED and AVB reports
verification errors.

[1] https://source.android.com/docs/security/features/verifiedboot/boot-flow#unlocked-devices

Fixes: 125d9f3306ea ("bootstd: Add a bootmeth for Android")
Reviewed-by: Julien Masson <jmasson@baylibre.com>
Link: https://lore.kernel.org/r/20250108-avb-disable-verif-v2-2-ba7d3b0d5b6a@baylibre.com
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
4 months agobootstd: android: Add missing NULL in the avb partition list
Mattijs Korpershoek [Wed, 8 Jan 2025 14:38:41 +0000 (15:38 +0100)]
bootstd: android: Add missing NULL in the avb partition list

When booting an Android build with AVB enabled, it's still possible to
deactivate the check for development purposes if the bootloader state is
UNLOCKED.

This is very useful for development and can be done at flashing time via:
$ fastboot flash --disable-verity --disable-verification vbmeta vbmeta.img

However, with bootmeth_android, we cannot boot this way:

    Scanning bootdev 'mmc@fa10000.bootdev':
      0  android      ready   mmc          0  mmc@fa10000.bootdev.whole
    ** Booting bootflow 'mmc@fa10000.bootdev.whole' with android
    avb_vbmeta_image.c:188: ERROR: Hash does not match!
    avb_slot_verify.c:732: ERROR: vbmeta_a: Error verifying vbmeta image: HASH_MISMATCH
    get_partition: can't find partition '_a'
    avb_slot_verify.c:496: ERROR: _a: Error determining partition size.
    Verification failed, reason: I/O error occurred while trying to load data
    Boot failed (err=-5)
    No more bootdevs

From the logs we can see that avb tries to read a partition named '_a'.
It's doing so because the last element of requested_partitions implicitly is
'\0', but the doc explicitly request it to be NULL instead.

Add NULL as last element to requested_partitions to avoid this problem.

Fixes: 125d9f3306ea ("bootstd: Add a bootmeth for Android")
Reviewed-by: Julien Masson <jmasson@baylibre.com>
Link: https://lore.kernel.org/r/20250108-avb-disable-verif-v2-1-ba7d3b0d5b6a@baylibre.com
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
4 months agoMAINTAINERS: move myself to reviewers for avb/ab
Igor Opaniuk [Thu, 9 Jan 2025 11:28:22 +0000 (12:28 +0100)]
MAINTAINERS: move myself to reviewers for avb/ab

As Mattijs Korpershoek is in fact doing overall
maintenance of AVB/AB code, move myself to reviewers.

CC: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@gmail.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Link: https://lore.kernel.org/r/20250109112854.825204-1-igor.opaniuk@gmail.com
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
4 months agoboot: android: Check kcmdline's for NULL in android_image_get_kernel()
Aaron Kling [Mon, 13 Jan 2025 09:11:45 +0000 (10:11 +0100)]
boot: android: Check kcmdline's for NULL in android_image_get_kernel()

kcmdline and kcmdline_extra strings can be NULL. In that case, we still
read the content from 0x00000 and pass that to the kernel, which is
completely wrong.

Fix android_image_get_kernel() to check for NULL before checking if
they are empty strings.

Fixes: 53a0ddb6d3be ("boot: android: fix extra command line support")
Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
Reviewed-by: Nicolas Belin <nbelin@baylibre.com>
Reviewed-by: Julien Masson <jmasson@baylibre.com>
Tested-by: Sam Day <me@samcday.com>
Link: https://lore.kernel.org/r/20250113-kcmdline-extra-fix-v1-1-03cc9c039159@baylibre.com
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
4 months agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxi
Tom Rini [Thu, 23 Jan 2025 14:16:15 +0000 (08:16 -0600)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxi

Following the move of the H616 family to OF_UPSTREAM in the last cycle,
now some older SoCs with identical DTs follow the lead: the F1C100s, A10,
A10s, A13. The remaining SoCs suffer from that IRQ cells incompatiblity,
breaking support for Linux < v5.13, so I am holding their move back still.

Otherwise we get proper support for the PinePhone v1.2, and PSTORE support
for all revisions of that device.

This is rounded up by a PMIC related fix for some A80 boards, and two
cleanup patches that are preparations for two new SoCs families, being
worked on as we speak. But they have to wait for the next cycle.

Gitlab CI passed, and I booted that briefly on some boards.

4 months agoMerge patch series "upl: Prerequite patches for updated spec"
Tom Rini [Wed, 22 Jan 2025 22:08:34 +0000 (16:08 -0600)]
Merge patch series "upl: Prerequite patches for updated spec"

Simon Glass <sjg@chromium.org> says:

The current UPL spec[1] has been tidied up and improved over the last
year, since U-Boot's original UPL support was written.

This series includes some prerequisite patches needed for the real UPL
patches. It is split from [2]

[1] https://github.com/UniversalPayload/spec/tree/3f1450d
[2] https://patchwork.ozlabs.org/project/uboot/list/?series=438574&state=*

Link: https://lore.kernel.org/r/20250111000029.245022-1-sjg@chromium.org
4 months agodm: core: Provide ofnode_find_subnode_unit()
Simon Glass [Sat, 11 Jan 2025 00:00:29 +0000 (17:00 -0700)]
dm: core: Provide ofnode_find_subnode_unit()

The ofnode_find_subnode() function currently processes things two
different ways, so the treatment of unit addresses differs depending on
whether OF_LIVE is enabled or not.

Add a new version which uses the ofnode API and add a test to check that
unit addresses can be matched correctly. Leave the old function in place
for the !OF_LIVE case, to avoid a code-size increase, e.g. on
firefly-rk3288

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agodm: core: Provide ofnode_name_eq_unit() to accept a unit address
Simon Glass [Sat, 11 Jan 2025 00:00:28 +0000 (17:00 -0700)]
dm: core: Provide ofnode_name_eq_unit() to accept a unit address

When a unit-address is provided, use it to match against the node
name.

Since this increases code size, put it into a separate function.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agodm: core: Clarify behaviour of ofnode_name_eq()
Simon Glass [Sat, 11 Jan 2025 00:00:27 +0000 (17:00 -0700)]
dm: core: Clarify behaviour of ofnode_name_eq()

This function is somewhat ambiguous, so expand the comments and add a
test for the undefined behaviour.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agox86: emulation: Enable bloblist
Simon Glass [Sat, 11 Jan 2025 00:00:26 +0000 (17:00 -0700)]
x86: emulation: Enable bloblist

Add bloblist support so that tables can be generated and placed in a
bloblist, then passed to a payload using UPL

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agoefi_loader: Avoid mapping the ACPI tables twice
Simon Glass [Sat, 11 Jan 2025 00:00:25 +0000 (17:00 -0700)]
efi_loader: Avoid mapping the ACPI tables twice

The add_u_boot_and_runtime() function paints with a broad brush,
considering all of the memory from the top of U-Boot stack to
gd->ram_top as EFI_RUNTIME_SERVICES_CODE

This is fine, but we need to make sure we don't add a separate entry for
any ACPI tables in this region (which happens when bloblist is used for
tables). Otherwise the memory map looks strange and we get a test
failure on qemu-x86 (only) for the 'virtual address map' test.

Good map:

   Type             Start            End              Attributes
   ================ ================ ================ ==========
   CONVENTIONAL     0000000000000000-00000000000a0000 WB
   RESERVED         00000000000a0000-00000000000f0000 WB
   RUNTIME DATA     00000000000f0000-00000000000f2000 WB|RT
   RESERVED         00000000000f2000-0000000000100000 WB
   CONVENTIONAL     0000000000100000-0000000005cc7000 WB
   BOOT DATA        0000000005cc7000-0000000005ccc000 WB
   RUNTIME DATA     0000000005ccc000-0000000005ccd000 WB|RT
   BOOT DATA        0000000005ccd000-0000000005cce000 WB
   RUNTIME DATA     0000000005cce000-0000000005cf0000 WB|RT
   BOOT DATA        0000000005cf0000-0000000006cf5000 WB
   RESERVED         0000000006cf5000-0000000006cfa000 WB
   ACPI RECLAIM MEM 0000000006cfa000-0000000006d1c000 WB
   RESERVED         0000000006d1c000-0000000006f35000 WB
   RUNTIME CODE     0000000006f35000-0000000006f37000 WB|RT
   RESERVED         0000000006f37000-0000000008000000 WB
   RESERVED         00000000e0000000-00000000f0000000 WB

Bad map: (with BLOBLIST_TABLES but without this patch):

   Type             Start            End              Attributes
   ================ ================ ================ ==========
   CONVENTIONAL     0000000000000000-00000000000a0000 WB
   RESERVED         00000000000a0000-00000000000f0000 WB
   ACPI RECLAIM MEM 00000000000f0000-00000000000f1000 WB
   RESERVED         00000000000f1000-0000000000100000 WB
   CONVENTIONAL     0000000000100000-0000000005ca5000 WB
   BOOT DATA        0000000005ca5000-0000000005caa000 WB
   RUNTIME DATA     0000000005caa000-0000000005cab000 WB|RT
   BOOT DATA        0000000005cab000-0000000005cac000 WB
   RUNTIME DATA     0000000005cac000-0000000005cce000 WB|RT
   BOOT DATA        0000000005cce000-0000000006cd3000 WB
   RUNTIME DATA     0000000006cd3000-0000000006cd5000 WB|RT
   BOOT DATA        0000000006cd5000-0000000006cf4000 WB
   RESERVED         0000000006cf4000-0000000006cf9000 WB
   ACPI RECLAIM MEM 0000000006cf9000-0000000006ce6000 WB

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agox86: Align the SMBIOS table to a 4K boundary
Simon Glass [Sat, 11 Jan 2025 00:00:24 +0000 (17:00 -0700)]
x86: Align the SMBIOS table to a 4K boundary

This isn't strictly needed, but with UPL we use the reserved-memory
nodes to indicate where the SMBIOS table is. Tianocore requires 4KB
alignment on these regions, so it is easier to adjust the alignment
to match.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agox86: Move tables to use SZ macros
Simon Glass [Sat, 11 Jan 2025 00:00:23 +0000 (17:00 -0700)]
x86: Move tables to use SZ macros

Update the tables to use linux/sizes rather than open-coped values.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 months agox86: Enable UPL handoff for SPL
Simon Glass [Sat, 11 Jan 2025 00:00:22 +0000 (17:00 -0700)]
x86: Enable UPL handoff for SPL

Add the GD_FLG_UPL so that a UPL-handoff is created.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agox86: Support jumping to a UPL image
Simon Glass [Sat, 11 Jan 2025 00:00:21 +0000 (17:00 -0700)]
x86: Support jumping to a UPL image

Add a function to allow x86 boards to jump to a UPL images. Currently
only 32-bit entry is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agox86: Show an error if video fails
Simon Glass [Sat, 11 Jan 2025 00:00:20 +0000 (17:00 -0700)]
x86: Show an error if video fails

If video is enabled we expect it to work. Avoid silent failure by adding
a panic if things go wrong.

Expand the SPL malloc-area for qemu-x86_64 to avoid a panic.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agopci: video: Set up the pixel-format field
Simon Glass [Sat, 11 Jan 2025 00:00:19 +0000 (17:00 -0700)]
pci: video: Set up the pixel-format field

Add this information to the handoff structure so that it is available to
U-Boot proper. Update bochs and the video handoff.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agox86: Create more space for SPL with qemu-x86_64
Simon Glass [Sat, 11 Jan 2025 00:00:18 +0000 (17:00 -0700)]
x86: Create more space for SPL with qemu-x86_64

The space here is quite tight and there is plenty of room in the ROM.
Move SPL earlier to allow for expansion.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agoemulation: Use bloblist to hold tables
Simon Glass [Sat, 11 Jan 2025 00:00:17 +0000 (17:00 -0700)]
emulation: Use bloblist to hold tables

QEMU can have its own internal ACPI and SMBIOS tables. At present U-Boot
copies out the SMBIOS tables but points directly to the ACPI ones.

The ACPI tables are not aligned on a 4KB boundary, which means that UPL
cannot use them directly, since it uses a reserved-memory node for the
tables and that it assumed (by EDK2) to be 4KB-aligned.

On x86, QEMU provides the tables in a mapped memory region and U-Boot
makes use of these directly, thus making it difficult to use any common
code.

Adjust the logic to fit within the existing table-generation code. Use a
bloblist always and ensure that the ACPI tables is placed in an aligned
region. Set a size of 8K for QEMU. This does not actually put all the
tables in one place, for QEMU, since it currently adds a pointer to the
tables in QFW.

On ARM, enable bloblist so that SMBIOS tables can be added to the
bloblist.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agoemulation: fdt: Relax condition for OF_HAS_PRIOR_STAGE
Simon Glass [Sat, 11 Jan 2025 00:00:16 +0000 (17:00 -0700)]
emulation: fdt: Relax condition for OF_HAS_PRIOR_STAGE

QEMU always gets its devicetree from the OF_BOARD mechanism so we should
not depend on !BLOBLIST here.

It's not clear why we need to have any relationship with BLOBLIST so
let's remove the entire condition.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 2b71470628c dts: OF_HAS_PRIOR_STAGE should depend on !BLOBLIST
Reviewed-by: Tom Rini <trini@konsulko.com>
4 months agosunxi: switch Allwinner A10s/A13 boards to OF_UPSTREAM
Andre Przywara [Wed, 8 Jan 2025 00:17:55 +0000 (00:17 +0000)]
sunxi: switch Allwinner A10s/A13 boards to OF_UPSTREAM

In contrast to some other Allwinner SoCs, there is no difference between
the DTs for the Allwinner A10s/A13 SoCs (sun5i) between the U-Boot and the
Linux kernel repository.

Remove the old copies of the A10s/A13 related .dts and .dtsi files, and
switch most of sun5i boards over to use OF_UPSTREAM.

There are two boards for which we don't have DTs in the kernel tree.
Keep those two .dts files in the legacy U-Boot DT directory, and let
their defconfig opt out of OF_UPSTREAM.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Sumit Garg <sumit.garg@linaro.org>
4 months agosunxi: switch Allwinner A10 boards to OF_UPSTREAM
Andre Przywara [Wed, 8 Jan 2025 00:17:55 +0000 (00:17 +0000)]
sunxi: switch Allwinner A10 boards to OF_UPSTREAM

In contrast to some other Allwinner SoCs, there is no difference between
the DTs for the Allwinner A10 SoCs (sun4i) between the U-Boot and the
Linux kernel repository.

Remove the old copies of the A10 related .dts and .dtsi files, and switch
most of sun4i boards over to use OF_UPSTREAM.

There are two boards for which we don't have DTs in the kernel tree.
Keep those two .dts files in the legacy U-Boot DT directory, and let
their defconfig opt out of OF_UPSTREAM.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Sumit Garg <sumit.garg@linaro.org>
4 months agosuniv: switch Allwinner F1Cx00 boards to OF_UPSTREAM
Andre Przywara [Tue, 7 Jan 2025 22:49:56 +0000 (22:49 +0000)]
suniv: switch Allwinner F1Cx00 boards to OF_UPSTREAM

In contrast to some other Allwinner SoCs, there is no difference between
the DTs for the Allwinner F1C100/F1C200 SoCs (sunvi) between the U-Boot
and the Linux kernel repository.

Remove the old copies of the F1Cx00 related .dts and .dtsi files, and
switch the whole suniv SoC over to use OF_UPSTREAM.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
4 months agosunxi: pinephone: detect existed magnetometer and fixup dtb
Andrey Skvortsov [Wed, 13 Nov 2024 22:28:48 +0000 (01:28 +0300)]
sunxi: pinephone: detect existed magnetometer and fixup dtb

In newer 1.2 PinePhone board revisions LIS3MDL magnetometer was replaced by
AF8133J. They use the same PB1 pin in different modes.

LIS3MDL uses it as an gpio input to handle interrupt.
AF8133J uses it as an gpio output as a reset signal.

It wasn't possible at runtime to enable both device tree
nodes and detect supported sensor at probe time.

AF8133J has reset pin (PB1) connected to the SoC. By default AF8133J
is in a reset state and don't respond to probe request on I2C
bus. Extra code would be needed to handle reset signal. Therefore this
code uses LIS3MDL magnetometer instead of AF8133J.

Introducing new dts 1.2b with AF8133J sensor would require probing in
SPL. That would lead to pulling in into SPL I2C controller driver,
RSB controller driver, introducing new AXP803 driver to power-up
sensors for probe. It's working, but SPL is pretty size-constrained on
A64 and doesn't have much space. Therefore fdt fixup is done in U-Boot
proper without introducing new board revision and new dts.

Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
Link: https://lore.kernel.org/all/20240908214718.36316-1-andrej.skvortzov@gmail.com/
Link: https://lists.denx.de/pipermail/u-boot/2024-February/545700.html
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
[Andre: fix formatting]
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
4 months agosunxi: defconfig: Add pstore support for pinephone
Andrey Skvortsov [Wed, 6 Nov 2024 07:49:47 +0000 (10:49 +0300)]
sunxi: defconfig: Add pstore support for pinephone

pstore will allow users to catch kernel crashes and report them to
developers. Modern (Android) phones have pstore usually enabled to get
information about kernel crash, since it's the simplest way to get
kernel backtrace on mobile device without serial console. Usually it's
enabled by default in distribution kernels like Debian.

CONFIG_PSTORE=y
CONFIG_PSTORE_RAM=m

systemd has service that automatically handles pstore and saves them
in /var/lib/pstore for later usage.

In general any DRAM address, that isn't overwritten during a boot is
suitable for pstore.

Range from 0x40000000 - 0x50000000 is heavily used by u-boot for
internal use and to load kernel, fdt, fdto, scripts, pxefile and ramdisk
later in the boot process. Ramdisk start address is 0x4FF00000,
initramfs for kernel with some hacking features and debug info enabled
can take more than 100Mb and final address will be around 0x58000000.
Address 0x61000000 will most likely not overlap with that.

Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
4 months agopower: pmic: sunxi: guard DCDC5 separately
Andre Przywara [Sun, 15 Dec 2024 00:22:48 +0000 (00:22 +0000)]
power: pmic: sunxi: guard DCDC5 separately

So far all sunxi boards programming the DCDC1 power rail on the AXP PMIC
also set the DCDC5 rail, so we could handle both with the same DCDC1
guard.
Some boards using the AXP313 will need to set DCDC1 now as well, and
since the AXP313 only has three buck converters, there will be no DCDC5,
so this trick is not going to work anymore.

Don't try to be too clever, and just protect programming the two DCDC
rails with two separate guards.

This has the interesting side effect of fixing operation on A80 boards,
using the AXP809 PMIC. Apparently programming DCDC5 right after DCDC1,
but before the other three rails caused some glitch, which made the board
hang during Linux boot, during the PSCI handler in U-Boot. Just keeping
the old setup order (DCDC1,2,3,4,5) will make those boards boot to the
Linux prompt again.

Fixes: ffb02942fab024d4a9b6a ("sunxi: board: simplify early PMIC setup conditions")
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
4 months agosunxi: H616: DRAM: rename Kconfig parameters to be more generic
Andre Przywara [Mon, 21 Oct 2024 11:47:28 +0000 (12:47 +0100)]
sunxi: H616: DRAM: rename Kconfig parameters to be more generic

The H616 DRAM controller requires some board specific parameters, which
we declare in Kconfig, let each board specify in their defconfig, and
then use in the DRAM init code.

Other DRAM controllers now require a very similar, if not identical
parameter set, with so far the same parameter names used.

To help keep the Kconfig file at bay, rename the existing parameter
names to drop the H616_ part in there, to make them more naturally
reusable for other SoCs.

No functional change, just a rename.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
4 months agosunxi: clock: improve grouping of default clock register values
Andre Przywara [Sun, 5 Nov 2023 11:01:42 +0000 (11:01 +0000)]
sunxi: clock: improve grouping of default clock register values

With each new SoC added to the clock_sun50i_h6.h header file, we add a
list of default values for the bus clock registers. This list gets a bit
hard to read, as the spacing between the lines looks confusing.

Tighten the lines by removing empty lines, to make it more obvious which
values belong together. Also remove those comments that were more or
less duplicating the next code line, and didn't add any information.

This makes it easier to find existing values and to add support for new
SoCs.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
4 months agotest: Fix inpected typo in upl test
Simon Glass [Sat, 11 Jan 2025 00:00:15 +0000 (17:00 -0700)]
test: Fix inpected typo in upl test

Fix a typo in the test comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agoboot: Use fit_image_get_data() to get data
Simon Glass [Sat, 11 Jan 2025 00:00:14 +0000 (17:00 -0700)]
boot: Use fit_image_get_data() to get data

Use this function instead of fit_image_get_emb_data() data, since it
works will FITs that use external data.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agoboot: Rename fit_image_get_data_and_size()
Simon Glass [Sat, 11 Jan 2025 00:00:13 +0000 (17:00 -0700)]
boot: Rename fit_image_get_data_and_size()

This function is really just getting the data. The size comes along for
the ride. In fact this function is only reliable way to obtain the data
for an image in a FIT, since the FIT may use external data.

Rename it to fit_image_get_data()

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agoboot: Rename fit_image_get_data()
Simon Glass [Sat, 11 Jan 2025 00:00:12 +0000 (17:00 -0700)]
boot: Rename fit_image_get_data()

This function can only be used with FITs that use embedded data. Rename
it so this is clear.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 months agoofnode: Update of_add_subnode() to indicate name is alloced
Simon Glass [Sat, 11 Jan 2025 00:00:11 +0000 (17:00 -0700)]
ofnode: Update of_add_subnode() to indicate name is alloced

This function allocates memory for the node name, so mention this in the
function comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agoofnode: Indicate when out of space in a few places
Simon Glass [Sat, 11 Jan 2025 00:00:10 +0000 (17:00 -0700)]
ofnode: Indicate when out of space in a few places

Update ofnode_add_subnode() and ofnode_add_prop() to return a suitable
error when space is exhausted in the FDT. This makes it easier to see
what is going wrong.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 months agoofnode: Use 4K for a default tree-size
Simon Glass [Sat, 11 Jan 2025 00:00:09 +0000 (17:00 -0700)]
ofnode: Use 4K for a default tree-size

At some point it would be nice to have the ofnode API automatically
expand the tree as required, to accommodate new nodes. For now, expand
the default size so that UPL can be supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agox86: Show the timestamp counter with bdinfo
Simon Glass [Sat, 11 Jan 2025 00:00:08 +0000 (17:00 -0700)]
x86: Show the timestamp counter with bdinfo

Add a line to the 'bdinfo' command which shows the current value of the
TSC.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agox86: Enable meminfo command
Simon Glass [Sat, 11 Jan 2025 00:00:07 +0000 (17:00 -0700)]
x86: Enable meminfo command

Enable this command for x86 boards as it is quite useful for seeing
where memory is.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agomkimage: Update map_to_sysmem() to match its prototype
Simon Glass [Sat, 11 Jan 2025 00:00:06 +0000 (17:00 -0700)]
mkimage: Update map_to_sysmem() to match its prototype

Update the version of this function in mkimage so that it uses a const
pointer, as is done in the mapmem.h header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agoserial: Support info() method in ns16550 xPL with UPL
Simon Glass [Sat, 11 Jan 2025 00:00:05 +0000 (17:00 -0700)]
serial: Support info() method in ns16550 xPL with UPL

UPL needs to pass the serial details onto the next stage, so adjust the
condition to support this.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agocpu: Provide a way to get the physical-address size
Simon Glass [Sat, 11 Jan 2025 00:00:04 +0000 (17:00 -0700)]
cpu: Provide a way to get the physical-address size

This concept exists on x86. Declare it as a generic function so that the
value can be accessed by UPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agoabuf: Provide a constant buffer
Simon Glass [Sat, 11 Jan 2025 00:00:03 +0000 (17:00 -0700)]
abuf: Provide a constant buffer

Add a new initialiser which can accept a constant pointer.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agoabuf: Allow use in host tools
Simon Glass [Sat, 11 Jan 2025 00:00:02 +0000 (17:00 -0700)]
abuf: Allow use in host tools

Some header files included on the host are moving to use abuf, so adjust
the header-inclusion to bring in size_t correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agoabuf: Provide a way to get the buffer address
Simon Glass [Sat, 11 Jan 2025 00:00:01 +0000 (17:00 -0700)]
abuf: Provide a way to get the buffer address

In many cases it is useful to get the address of a buffer, e.g. when
booting from it. Add a function to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agobloblist: Make BLOBLIST_ALLOC the default
Simon Glass [Sat, 11 Jan 2025 00:00:00 +0000 (17:00 -0700)]
bloblist: Make BLOBLIST_ALLOC the default

We want to encourage people to use an allocated bloblist since it is
more flexible than a fixed one. Make this the default, being sure not to
change existing users.

The unit tests require BLOBLIST_FIXED so add a dependency in the
Makefile to avoid build errors.

All sandbox builds require BLOBLIST_FIXED so make that the default for
sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-snapdragon
Tom Rini [Wed, 22 Jan 2025 17:23:35 +0000 (11:23 -0600)]
Merge https://source.denx.de/u-boot/custodians/u-boot-snapdragon

The highlights are:

* Fixed boot regression due to broken memory parsing
* Enable HW RNG and KASLR on all platforms
* Add support for Snapdragon X1 Elite hardware (clk/pinctrl)
* Add support for QCS9100 ride automotive development platform (clk/ufs)
* Add support for PCIe on SM8550, SM8650 and X1E
* Implement software debounce for PMIC buttons

Additionally, some minor improvements to "ufetch" have been pulled in:

* Show CPU architecture (arm/mips/etc)
* Make CONFIG_BLK optional
* Fix 32-bit support

4 months agoMerge patch series "spi: Collected fixes"
Tom Rini [Wed, 22 Jan 2025 15:52:38 +0000 (09:52 -0600)]
Merge patch series "spi: Collected fixes"

Alexander Dahl <ada@thorsis.com> says:

Hello,

two patches for header issues I came across when working on (Q)SPI
drivers for atmel boards.

Link: https://lore.kernel.org/r/20250115161621.1551826-1-ada@thorsis.com
4 months agoMerge patch series "Update my email address"
Tom Rini [Wed, 22 Jan 2025 15:51:45 +0000 (09:51 -0600)]
Merge patch series "Update my email address"

Christopher Obbard <christopher.obbard@linaro.org> says:

Update my email address for various locations in the U-Boot project.
This will (hopefully) stop any mails from going to /dev/null.

Link: https://lore.kernel.org/r/20250115-wip-obbardc-update-email-v1-0-0b4cd69c91fd@linaro.org
4 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-watchdog
Tom Rini [Wed, 22 Jan 2025 15:49:14 +0000 (09:49 -0600)]
Merge https://source.denx.de/u-boot/custodians/u-boot-watchdog

CI: https://dev.azure.com/sr0718/u-boot/_build/results?buildId=381&view=results

- cyclic: Fix rollover every 72 min on 32 bits platforms (Patrice)

4 months agoMerge patch series "vbe: Series part F"
Tom Rini [Wed, 22 Jan 2025 15:48:24 +0000 (09:48 -0600)]
Merge patch series "vbe: Series part F"

Simon Glass <sjg@chromium.org> says:

This includes various patches towards implementing the VBE abrec
bootmeth in U-Boot. It mostly focuses on introducing a relocating
SPL-loader so that VBE can run in the limited amount of SRAM available
on many devices.

Another minor new feature is support in VBE for specifying the image
phase when loading from a FIT. This allows a single FIT to include
images for several boot phases, thus simplifying image-creation.

One lingering niggle in this series is that it has a different code path
for sandbox, since it does not support the relocating jump. It should be
possible to resolve this with additional work, but I have not attempted
this so far.

For v2, I have split the first patch into 5 pieces, to make it easier to
see the code-size impact, plus added a few tweaks to reduce code size.

Again, only MMC is supported so far.

Looking ahead, series G will have some more plumbing and H some rk3399
pieces. That should be enough to complete these feature.

Here is a run in my lab, with the VBE ABrec bootmeth. You can see that
VPL runs before memory is set up. SPL sets up memory and can be upgraded
in the field reliably.

$ ub-int vbe
Building U-Boot in sourcedir for rk3399-generic
Bootstrapping U-Boot from dir /tmp/b/rk3399-generic
Writing U-Boot using method rockchip

U-Boot TPL 2025.01-rc3-00345-gdfbdbf1eb56c-dirty (Jan 08 2025 - 10:47:58)
Trying to boot from vbe_abrec
load: Firefly-RK3399 Board
   Using 'config-3' configuration
   Trying 'image-vpl' firmware subimage
   Using 'config-3' configuration
   Trying 'fdt-3' fdt subimage

U-Boot VPL 2025.01-rc3-00345-gdfbdbf1eb56c-dirty (Jan 08 2025 - 10:47:58)
Trying to boot from vbe_abrec
load: Firefly-RK3399 Board
Starting with empty state
VBE: Firmware pick A at 800000
   Using 'config-3' configuration
   Trying 'spl' firmware subimage
   Using 'config-3' configuration
   Trying 'fdt-3' fdt subimage
Channel 0: DDR3, 800MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB
Channel 1: DDR3, 800MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB
256B stride

U-Boot SPL 2025.01-rc3-00345-gdfbdbf1eb56c-dirty (Jan 08 2025 - 10:47:58 -0700)
Trying to boot from vbe_abrec
load: Firefly-RK3399 Board
VBE: Firmware pick A at 900000
load_simple_fit: Skip load 'atf-5': image size is 0!
Relocating bloblist ff8eff00 to 100000: done
ns16550_serial serial@ff1a0000: pinctrl_select_state_full: uclass_get_device_by_phandle_id: err=-19

U-Boot 2025.01-rc3-00345-gdfbdbf1eb56c-dirty (Jan 08 2025 - 10:47:58 -0700)

SoC: Rockchip rk3399
Reset cause: POR
Model: Firefly-RK3399 Board
DRAM:  4 GiB (effective 3.9 GiB)
Core:  314 devices, 33 uclasses, devicetree: separate
MMC:   mmc@fe310000: 3, mmc@fe320000: 1, mmc@fe330000: 0
Loading Environment from SPIFlash... Invalid bus 0 (err=-19)
*** Warning - spi_flash_probe_bus_cs() failed, using default environment

In:    serial,usbkbd
Out:   serial,vidconsole
Err:   serial,vidconsole
Model: Firefly-RK3399 Board
Net:   PMIC:  RK808
eth0: ethernet@fe300000

starting USB...
Bus usb@fe380000: USB EHCI 1.00
Bus usb@fe3a0000: USB OHCI 1.0
Bus usb@fe3c0000: USB EHCI 1.00
Bus usb@fe3e0000: USB OHCI 1.0
Bus usb@fe900000: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
scanning bus usb@fe380000 for devices... 1 USB Device(s) found
scanning bus usb@fe3a0000 for devices... 1 USB Device(s) found
scanning bus usb@fe3c0000 for devices... 2 USB Device(s) found
scanning bus usb@fe3e0000 for devices... 1 USB Device(s) found
scanning bus usb@fe900000 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:  0

Link: https://lore.kernel.org/r/20250116012723.2820301-1-sjg@chromium.org
4 months agovexpress64: Fix bootargs when building without NET
Chanho Park [Wed, 15 Jan 2025 15:31:48 +0000 (00:31 +0900)]
vexpress64: Fix bootargs when building without NET

When building without DHCP/PXE configurations (NET disabled),
compilation errors may occur due to mismatched bootargs.
Ensure bootargs related to DHCP/PXE are not enabled if the
corresponding commands are disabled.

include/config_distro_bootcmd.h:443:9: error: expected ‘}’ before
‘BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE’
  443 |         BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Chanho Park <parkch98@gmail.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
4 months agospi: cadence-quadspi: fix potential malfunction after ~49 days uptime
Ronald Wahl [Wed, 11 Dec 2024 20:51:04 +0000 (21:51 +0100)]
spi: cadence-quadspi: fix potential malfunction after ~49 days uptime

The get_timer function returns an unsigned long which may be calculated
from the ARM system counter. This counter is reset only on a cold reset.
U-boot divides this counter down to a 1000 Hz counter that will cross
the 32bit barrier after a bit more than 49 days. Assigning the value to
an unsigned int will truncate it on 64bit systems.
Passing this truncated value back to the get_timer function will return
a very large value that is certainly larger than the timeout and so will
go down the error path and besides stopping U-Boot will lead to messages
like

    "SPI: QSPI is still busy after poll for 5000 ms."

Signed-off-by: Ronald Wahl <ronald.wahl@legrand.com>
Cc: Vignesh R <vigneshr@ti.com>
Cc: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Vignesh Raghavendra <vigneshr@ti.com>
4 months agoMAINTAINERS: maintain qcs9100_defconfig
Caleb Connolly [Wed, 22 Jan 2025 16:08:50 +0000 (17:08 +0100)]
MAINTAINERS: maintain qcs9100_defconfig

Add this to ARM SNAPDRAGON maintainers entry.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Link: https://lore.kernel.org/u-boot/20250122160951.1861910-1-caleb.connolly@linaro.org
4 months agoRevert "mem: spi-mem: add declaration for spi_mem_default_supports_op"
Alexander Dahl [Wed, 15 Jan 2025 16:16:21 +0000 (17:16 +0100)]
Revert "mem: spi-mem: add declaration for spi_mem_default_supports_op"

We have a duplicate declaration of spi_mem_default_supports_op() which
was added twice, first with commit af6266c1c27a ("mem: spi-mem: add
declaration for spi_mem_default_supports_op") for v2021.04, and again
with commit 2299076e34f8 ("spi: spi-mem: export
spi_mem_default_supports_op()") for v2021.07.

The first commit is reverted here, because the second better matches the
definition and has a better place in the declaration order.

Note: Linux declares this in a different section of spi-mem.h which is
disabled in U-Boot through `#ifndef __UBOOT__`.

This reverts commit af6266c1c27add8beac7f3365c00b3525a9012c4.

Signed-off-by: Alexander Dahl <ada@thorsis.com>
4 months agospi: atmel: Really drop atmel_spi.h
Alexander Dahl [Wed, 15 Jan 2025 16:16:20 +0000 (17:16 +0100)]
spi: atmel: Really drop atmel_spi.h

First try dropping this was with commit 37434db29be4 ("spi: atmel: Drop
atmel_spi.h") back in 2018 which was reverted not much later with commit
5270df283676 ("Revert "spi: atmel: Drop atmel_spi.h"").

Second try dropping this was in 2020 with commit beeb34ac0cc6 ("spi:
atmel: Drop atmel_spi.h"), but that only moved all the definitions into
the source file and did not remove the header file.

Currently all of the definitions in the header file are (still)
contained in the source file, and the header file is include nowhere.

Fixes: beeb34ac0cc6 ("spi: atmel: Drop atmel_spi.h")
Signed-off-by: Alexander Dahl <ada@thorsis.com>
4 months agoboard: rockpi4-rk3399: update email address for Christopher Obbard
Christopher Obbard [Wed, 15 Jan 2025 10:32:59 +0000 (10:32 +0000)]
board: rockpi4-rk3399: update email address for Christopher Obbard

Update my email address.

Signed-off-by: Christopher Obbard <christopher.obbard@linaro.org>
4 months ago.mailmap: update email address for Christopher Obbard
Christopher Obbard [Wed, 15 Jan 2025 10:32:58 +0000 (10:32 +0000)]
.mailmap: update email address for Christopher Obbard

Update my email address.

Signed-off-by: Christopher Obbard <christopher.obbard@linaro.org>
4 months agovbe: Update simple-fw to support using the SPL loader
Simon Glass [Thu, 16 Jan 2025 01:27:23 +0000 (18:27 -0700)]
vbe: Update simple-fw to support using the SPL loader

For a sandbox implementation, where code size is no object, it makes sense
to use the full bootstd drivers to load images.

For real boards, running from SRAM, this adds quite a bit of overhead.

Add a way to load the next phase using just the underlying storage
driver, to reduce code size. For now, only MMC is supported.

Change the log_debug() to show the load address and size in a more
neutral way, rather than suggesting that the load has already happened.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agovbe: Support loading SPL images
Simon Glass [Thu, 16 Jan 2025 01:27:22 +0000 (18:27 -0700)]
vbe: Support loading SPL images

VBE needs to load different images from a FIT depending on the xPL phase
in use. The IH_PHASE value is used to select the image to load.

Add the required logic to handle this. For compatibility with the
SPL-loader driver, fill out a struct spl_image_info with the details
needed to boot the next phase.

This is good enough for VBE-simple but ABrec will need the full set of
bootstd features. So add a USE_BOOTMETH define to control this.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agovbe: Support loading an FDT with the relocating loader
Simon Glass [Thu, 16 Jan 2025 01:27:21 +0000 (18:27 -0700)]
vbe: Support loading an FDT with the relocating loader

Add FDT support so that this can be copied down in memory after loading
and made available to the new image.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agospl: Plumb in the relocating loader
Simon Glass [Thu, 16 Jan 2025 01:27:20 +0000 (18:27 -0700)]
spl: Plumb in the relocating loader

This is fairly easy to use. The SPL loader sets up some fields in the
spl_image_info struct and calls spl_reloc_prepare(). When SPL is ready
to do the jump it must call spl_reloc_jump() instead of jump_to_image().

Add this logic.

Signed-off-by: Simon Glass <sjg@chromium.org>