]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
6 weeks agorockchip: tpl: allow to call board/SoC-specific code before DRAM init
Quentin Schulz [Wed, 6 Nov 2024 11:29:43 +0000 (12:29 +0100)]
rockchip: tpl: allow to call board/SoC-specific code before DRAM init

This defines a weak tpl_board_init function that can be used for running
board/SoC-specific code before the DRAM init happens, similarly to
spl_board_init() for SPL.

Reviewed-by: Paul Kocialkowski <paulk@sys-base.io>
Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
6 weeks agorockchip: rk3399: merge CRU check within rk3399_force_power_on_reset
Quentin Schulz [Wed, 6 Nov 2024 11:29:42 +0000 (12:29 +0100)]
rockchip: rk3399: merge CRU check within rk3399_force_power_on_reset

To prepare to support forcing power on reset from TPL which would have
the exact same logic, just in an earlier stage, let's merge the CRU
check that triggers the power on reset with the rest of the logic.

Reviewed-by: Paul Kocialkowski <paulk@sys-base.io>
Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
6 weeks agopinctrl: rockchip: allow to build for TPL
Quentin Schulz [Wed, 6 Nov 2024 11:29:41 +0000 (12:29 +0100)]
pinctrl: rockchip: allow to build for TPL

A later commit will make use of the pinctrl driver in TPL so let's add
the ability to build the Rockchip pinctrl driver in TPL.

Reviewed-by: Paul Kocialkowski <paulk@sys-base.io>
Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
6 weeks agorockchip: rk35xx-generic: Disable late boardinfo
Jonas Karlman [Sat, 2 Nov 2024 21:30:01 +0000 (21:30 +0000)]
rockchip: rk35xx-generic: Disable late boardinfo

Disable DISPLAY_BOARDINFO_LATE as the early boardinfo print of Model
should be enough.

  U-Boot 2025.01-rc1 (Nov 02 2024 - 16:04:16 +0000)

  Model: Generic RK3566/RK3568
  DRAM:  8 GiB (effective 7.7 GiB)
  Core:  250 devices, 24 uclasses, devicetree: separate
  MMC:   mmc@fe2b0000: 1, mmc@fe310000: 0
  Loading Environment from nowhere... OK
  In:    serial@fe660000
  Out:   serial@fe660000
  Err:   serial@fe660000
  Model: Generic RK3566/RK3568
  Hit any key to stop autoboot:  0
  =>

Enable CMD_MISC to make it easier to inspect data in OTP.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
6 weeks agoboard: rockchip: Add FriendlyElec NanoPi R2S Plus
Jonas Karlman [Fri, 1 Nov 2024 22:21:30 +0000 (22:21 +0000)]
board: rockchip: Add FriendlyElec NanoPi R2S Plus

The FriendlyElec NanoPi R2S Plus is a single-board computer based on
Rockchip RK3328 SoC. It features e.g. 1 GB DDR4 RAM, 32 GB eMMC,
SD-card, 2x GbE LAN, optional M.2 SDIO Wi-Fi and 2x USB 2.0 host.

Features tested on a NanoPi R2S Plus 2309:
- SD-card boot
- eMMC boot
- Ethernet
- USB gadget
- USB host

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
6 weeks agoarm64: dts: rockchip: Add DTS for FriendlyARM NanoPi R2S Plus
Sergey Bostandzhyan [Fri, 1 Nov 2024 22:21:29 +0000 (22:21 +0000)]
arm64: dts: rockchip: Add DTS for FriendlyARM NanoPi R2S Plus

The R2S Plus is basically an R2S with additional eMMC.

The eMMC configuration for the DTS has been extracted and copied from
rk3328-nanopi-r2.dts, v2017.09 branch from the friendlyarm/uboot-rockchip
repository.

Signed-off-by: Sergey Bostandzhyan <jin@mediatomb.cc>
Link: https://lore.kernel.org/r/20240814170048.23816-2-jin@mediatomb.cc
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
[ upstream commit: b8c02878292200ebb5b4a8cfc9dbf227327908bd ]

(cherry picked from commit c9bf98827964441f4dd16faa45bd4046f472e693)
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
6 weeks agoboard: rockchip: Add support for rk3588 GenBook
Andy Yan [Mon, 4 Nov 2024 12:23:00 +0000 (20:23 +0800)]
board: rockchip: Add support for rk3588 GenBook

Add support for Cool Pi GenBook, it works as a carrier board
connect with CM5 SOM.

Specification:
- Rockchip RK3588
- LPDDR5X 8/32 GB
- eMMC 64 GB
- HDMI Type A out x 1
- USB 3.0 Host x 1
- USB-C 3.0 with DisplayPort AltMode
- PCIE M.2 E Key for RTL8852BE Wireless connection
- PCIE M.2 M Key for NVME connection
- eDP panel with 1920x1080

Tested by Armbian boot on USB disk.

Change-Id: I4d9b8572dc7c400077dde666633f3fea1b47dd03
Signed-off-by: Andy Yan <andyshrk@163.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
6 weeks agorockchip: Make it possible to define per board boot_targets
Andy Yan [Mon, 4 Nov 2024 12:22:59 +0000 (20:22 +0800)]
rockchip: Make it possible to define per board boot_targets

Some board may want to have a different boot priority(a laptop
may want to usb has the highest boot priority for third-part
os installation). So let the board can define it's own
boot_targets.

Signed-off-by: Andy Yan <andyshrk@163.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
6 weeks agoarm64: dts: rockchip: Add support for rk3588 based Cool Pi CM5 GenBook
Andy Yan [Mon, 4 Nov 2024 12:22:58 +0000 (20:22 +0800)]
arm64: dts: rockchip: Add support for rk3588 based Cool Pi CM5 GenBook

Cool Pi CM5 GenBook works as a carrier board connect with CM5 [0].

Specification:
- Rockchip RK3588
- LPDDR5X 8/32 GB
- eMMC 64 GB
- HDMI Type A out x 1
- USB 3.0 Host x 1
- USB-C 3.0 with DisplayPort AltMode
- PCIE M.2 E Key for RTL8852BE Wireless connection
- PCIE M.2 M Key for NVME connection
- eDP panel with 1920x1080

This patch add basic support to bringup eMMC/USB HOST/WiFi/TouchPad/
Battery/PCIE NVME, and can also drive a HDMI output with out of tree
hdmi patches.

[0] https://www.crowdsupply.com/shenzhen-tianmao-technology-co-ltd/genbook-rk3588

Signed-off-by: Andy Yan <andyshrk@163.com>
Link: https://lore.kernel.org/r/20240730102433.540260-3-andyshrk@163.com
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
[ upstream commit: 4a8c1161b843c366776fc872a6fe45b743b2983e ]

(cherry picked from commit dc6316da23734d9321e09f8c8a7669f4b4cb9f75)
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
6 weeks agoboard: rockchip: add support for Qnap TS433 devices
Heiko Stuebner [Mon, 28 Oct 2024 19:00:34 +0000 (20:00 +0100)]
board: rockchip: add support for Qnap TS433 devices

The Qnap TS433 is a 4-bay NAS based around the RK3568.

Two SATA bays are connected to the RK3568's own SATA controllers while
the other two are connected to a JMicron SATA controller living on the
PCIe bus.

It provides one 2.5Gb and one 1Gb ethernet port as well as 3 usb ports.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
6 weeks agoarm64: dts: rockchip: add product-data eeproms to QNAP TS433
Heiko Stuebner [Mon, 28 Oct 2024 19:00:33 +0000 (20:00 +0100)]
arm64: dts: rockchip: add product-data eeproms to QNAP TS433

The device contains two i2c-connected eeproms holding some product-
specific values. One sitting on the mainboard and one on the statically
connected backplane.

While the eeprom chips themself have a size of 512 byte, the eeprom data
only uses 256 byte each, probably to stay compatible with other models.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20240810211438.286441-3-heiko@sntech.de
[ upstream commit: da6f4130234448122fe3e66c8116f7d9eea8a5c7 ]

(cherry picked from commit 0b3109708caf5002ba188ae28eae9ce46b2c39b4)
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
6 weeks agoarm64: dts: rockchip: actually enable pmu-io-domains on qnap-ts433
Heiko Stuebner [Mon, 28 Oct 2024 19:00:32 +0000 (20:00 +0100)]
arm64: dts: rockchip: actually enable pmu-io-domains on qnap-ts433

Contrary to the vendor-kernel the pmu-io-domains are not enabled by
default. This resulted in the value not being set according to the
regulator, which in turn made the gmac0 interface that is connected
to the vccio4 supply inoperable.

Fixes: 64b7f16fb394 ("arm64: dts: rockchip: add 2 pmu_io_domain supplies for Qnap-TS433")
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20240805162052.3345768-1-heiko@sntech.de
[ upstream commit: 40cc4257169712f0ae3835820a4c5afbdd1a16ff ]

(cherry picked from commit f509fcb1fb82117e551b489592ac5714a6c5cd8d)
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
6 weeks agoarm64: dts: rockchip: Simplify network PHY connection on qnap-ts433
Uwe Kleine-König [Mon, 28 Oct 2024 19:00:31 +0000 (20:00 +0100)]
arm64: dts: rockchip: Simplify network PHY connection on qnap-ts433

While it requires to have the right phy driver loaded (i.e. motorcomm)
to make the phy asserting the right delays, this is generally the
preferred way to define the MAC <-> PHY connection.

Signed-off-by: Uwe Kleine-König <ukleinek@debian.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20240304084612.711678-2-ukleinek@debian.org
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
[ upstream commit: e8d45544f806f3b55c30345de84262cbb9504902 ]

(cherry picked from commit e0bbe061fd537bd7b113c53eb046bbcbf0e6597d)
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
6 weeks agoarm64: dts: rockchip: add 2 pmu_io_domain supplies for Qnap-TS433
Heiko Stuebner [Mon, 28 Oct 2024 19:00:30 +0000 (20:00 +0100)]
arm64: dts: rockchip: add 2 pmu_io_domain supplies for Qnap-TS433

Add the two supplies for the pmu-io-domains that are defined in the
vendor devicetree for the TS433.

Tested-by: Uwe Kleine-König <ukleinek@debian.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20240723195538.1133436-15-heiko@sntech.de
[ upstream commit: 64b7f16fb3947e5d08d9e9b860ce966250e45d52 ]

(cherry picked from commit 9b4d4c02b5762196063ab03c5439f96cbbaf2485)
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
6 weeks agoarm64: dts: rockchip: enable gpu on Qnap-TS433
Heiko Stuebner [Mon, 28 Oct 2024 19:00:29 +0000 (20:00 +0100)]
arm64: dts: rockchip: enable gpu on Qnap-TS433

The TS433 doesn't provide display output, but the gpu nevertheless can be
used for compute tasks for example.

So there is no reason not to enable it.

Tested-by: Uwe Kleine-König <ukleinek@debian.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20240723195538.1133436-14-heiko@sntech.de
[ upstream commit: 9130eb62586f4cef0557d0378fb7e78d7397ab2d ]

(cherry picked from commit e324a9e8ea083ebdca207b5ca2ed86d2b5f862a0)
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
6 weeks agoarm64: dts: rockchip: add missing pmic information on Qnap-TS433
Heiko Stuebner [Mon, 28 Oct 2024 19:00:28 +0000 (20:00 +0100)]
arm64: dts: rockchip: add missing pmic information on Qnap-TS433

Fill in the missing pieces for RK809 pmic used on the TS433.

The regulator setup comes from the vendor-devicetree, so without proper
schematics its accuracy is somewhat unclear, but it looks really similar
to all the other rk3568 boards, so follows the reference design it seems.

The one caveat is related to vcc3v3_sd. This regulator needs to stay on.
When turned off because of no users, access to both PCIe controllers
will stall. Maybe this rail does supply the 100MHz refclk generation
or so.

Tested-by: Uwe Kleine-König <ukleinek@debian.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20240723195538.1133436-13-heiko@sntech.de
[ upstream commit: ee078c7daa98353496410b715a5acbb41d7d3a90 ]

(cherry picked from commit 48951cb085998a5c8e3650351a794b136dac648f)
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
6 weeks agoarm64: dts: rockchip: define cpu-supply on the Qnap-TS433
Heiko Stuebner [Mon, 28 Oct 2024 19:00:27 +0000 (20:00 +0100)]
arm64: dts: rockchip: define cpu-supply on the Qnap-TS433

The TS433 seems to use a silergy,syr827 regulator for the cpu supply.
At least that is the compatible used in the vendor devicetree, though
it could very well also be another fan53555 clone.

Define the needed regulator node and hook up the cpu-supply to the
cpu cores.

Tested-by: Uwe Kleine-König <ukleinek@debian.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20240723195538.1133436-12-heiko@sntech.de
[ upstream commit: 99b36ba910d896bddbb9a190ca686c6d9cd0325f ]

(cherry picked from commit 2f0afd1a3cbf6f3192dc7a5c496affab718671b3)
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
6 weeks agoarm64: dts: rockchip: add gpio-keys to Qnap-TS433
Heiko Stuebner [Mon, 28 Oct 2024 19:00:26 +0000 (20:00 +0100)]
arm64: dts: rockchip: add gpio-keys to Qnap-TS433

The TS433 has 3 buttons, power and copy in the front as well as a reset
pinhole button on the back. The power-button is connected to the embedded
controller while the other two buttons are just gpio connected.

Add the gpio-keys definition for the two buttons we can handle right now.

Tested-by: Uwe Kleine-König <ukleinek@debian.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20240723195538.1133436-11-heiko@sntech.de
[ upstream commit: 9b682d31b24f1f70b5b4d0618095d46e0722b9d8 ]

(cherry picked from commit f0b858c751382ee9faf18f9b19b0817c6b50ac1c)
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
6 weeks agoarm64: dts: rockchip: enable the tsadc on the Qnap-TS433
Heiko Stuebner [Mon, 28 Oct 2024 19:00:25 +0000 (20:00 +0100)]
arm64: dts: rockchip: enable the tsadc on the Qnap-TS433

Enable the tsadc node to allow for temperature measurements of the soc.

Tested-by: Uwe Kleine-König <ukleinek@debian.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20240723195538.1133436-10-heiko@sntech.de
[ upstream commit: 2dfdddd9d20306fd0d04b88fcbbf36d76fb67f11 ]

(cherry picked from commit d33949501abd1145ea572b605844f0ef4247478d)
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
6 weeks agoarm64: dts: rockchip: add hdd leds to Qnap-TS433
Heiko Stuebner [Mon, 28 Oct 2024 19:00:24 +0000 (20:00 +0100)]
arm64: dts: rockchip: add hdd leds to Qnap-TS433

Add the 4 gpio-controlled LEDs to the Qnap-TS433.

They are meant for individual disk activitivy, but I haven't found a
way for how to connect them to their individual sata slot yet.

Tested-by: Uwe Kleine-König <ukleinek@debian.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20240723195538.1133436-9-heiko@sntech.de
[ upstream commit: ea91aabf18bcad6f5eceae6848ea6570ea61f126 ]

(cherry picked from commit 5a11b1bb40ac7b39e04077c045c3e3409fa352e2)
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
6 weeks agoarm64: dts: rockchip: add board-aliases for Qnap-TS433
Heiko Stuebner [Mon, 28 Oct 2024 19:00:23 +0000 (20:00 +0100)]
arm64: dts: rockchip: add board-aliases for Qnap-TS433

Add the aliases for the internal network interface as well as the emmc
on the board and make sure the dedicated RTC is always the first one.

The TS433 actually has two rtc devices. One coming from the rk809 pmic
without added functionality and also a dedicated RTC from Mycrocrystal
that is battery backed to keep the time.

Tested-by: Uwe Kleine-König <ukleinek@debian.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20240723195538.1133436-8-heiko@sntech.de
[ upstream commit: dadd4256e12360d3ff1f6481b2e4697f9d890caf ]

(cherry picked from commit cb53815764403f7f17967a32eec2aeb6625b396f)
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
6 weeks agoarm64: dts: rockchip: enable sata1+2 on Qnap-TS433
Heiko Stuebner [Mon, 28 Oct 2024 19:00:22 +0000 (20:00 +0100)]
arm64: dts: rockchip: enable sata1+2 on Qnap-TS433

The TS433 has 4 bays. The last two are accessed via a pci-connected
sata controller, while the first two are accessed via the rk3568's
sata controllers. Enable these two now.

Tested-by: Uwe Kleine-König <ukleinek@debian.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20240723195538.1133436-7-heiko@sntech.de
[ upstream commit: 673c1353b3d476b9c5df6b84a777ed171e5594f5 ]

(cherry picked from commit dfa45bbda057851d0c2167b4c311c0301637cc19)
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
6 weeks agoarm64: dts: rockchip: add stdout path on Qnap-TS433
Heiko Stuebner [Mon, 28 Oct 2024 19:00:21 +0000 (20:00 +0100)]
arm64: dts: rockchip: add stdout path on Qnap-TS433

As most Rockchip boards do, the TS433 also uses uart2 for its serial
output. Set the correct chosen entry for it.

Tested-by: Uwe Kleine-König <ukleinek@debian.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20240723195538.1133436-6-heiko@sntech.de
[ upstream commit: e1cb5d8a92e41171bf4d5ddc459bd96372500901 ]

(cherry picked from commit 1e1af2af2192490a3d174624ac1bb976aa6afffa)
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
6 weeks agoarm64: dts: rockchip: enable usb ports on Qnap-TS433
Heiko Stuebner [Mon, 28 Oct 2024 19:00:20 +0000 (20:00 +0100)]
arm64: dts: rockchip: enable usb ports on Qnap-TS433

Enable usb controllers and phys and add regulator infrastructure for the
usb ports on the TS433.

Of course there are no schematics available for the device, so the
regulator information comes from the vendor-devicetree with unknown
accuracy.

Tested-by: Uwe Kleine-König <ukleinek@debian.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20240723195538.1133436-5-heiko@sntech.de
[ upstream commit: d992203f57c5caad0dbd4a9c669d79b315873c81 ]

(cherry picked from commit bb745ef13efb9f6589f9eda8f66664bf263a13f3)
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
6 weeks agoarm64: dts: rockchip: enable uart0 on Qnap-TS433
Heiko Stuebner [Mon, 28 Oct 2024 19:00:19 +0000 (20:00 +0100)]
arm64: dts: rockchip: enable uart0 on Qnap-TS433

Uart0 is connected to an MCU on the board that handles system control
like the fan-speed. So far no driver for it is available though.

Tested-by: Uwe Kleine-König <ukleinek@debian.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20240723195538.1133436-4-heiko@sntech.de
[ upstream commit: 07ef8be476bebd77cba3ca4804be03cc0dba414f ]

(cherry picked from commit aaa5b1c4bd8f0e4327078d513f0eef05cb829bcf)
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
6 weeks agoarm64: dts: rockchip: enable second PCIe controller on the Qnap-TS433
Heiko Stuebner [Mon, 28 Oct 2024 19:00:18 +0000 (20:00 +0100)]
arm64: dts: rockchip: enable second PCIe controller on the Qnap-TS433

The TS433 uses both pcie controllers for sata and the 2nd network
interface. Set the needed data-lanes in the pcie3 phy and enable
the second pcie controller, as well as remove the bifurcation comment.

Tested-by: Uwe Kleine-König <ukleinek@debian.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20240723195538.1133436-3-heiko@sntech.de
[ upstream commit: 0f5f87a1d602a33028522784eb005647fa1b5c11 ]

(cherry picked from commit 7d8f260e65cc84076ec9456954de0f136948a2c8)

6 weeks agoarm64: dts: rockchip: add PCIe supply regulator to Qnap-TS433
Heiko Stuebner [Mon, 28 Oct 2024 19:00:17 +0000 (20:00 +0100)]
arm64: dts: rockchip: add PCIe supply regulator to Qnap-TS433

Add the vcc3v3-supply regulator and its link to the pcie controllers.

Tested-by: Uwe Kleine-König <ukleinek@debian.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20240723195538.1133436-2-heiko@sntech.de
[ upstream commit: e0ec6d48226fb3d4df18895b56f0b7a94c0fe474 ]

(cherry picked from commit 59939b4343db08fa08098238160007e6ded72be9)
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
7 weeks agobios_emulator: fix first argument of pci_{read,write}_config_* function calls
Yuri Zaporozhets [Wed, 30 Oct 2024 19:38:20 +0000 (20:38 +0100)]
bios_emulator: fix first argument of pci_{read,write}_config_* function calls

When compiling for riscv64, a bunch of warning is produced for the file
drivers/bios_emulator/besys.c. This patch fixes a portion of those warnings,
caused by incorrect first argument to pci_{read,write}_config_* functions.

Signed-off-by: Yuri Zaporozhets <yuriz@qrv-systems.net>
7 weeks agodrivers/video/vesa: use MTRRs only on x86
Yuri Zaporozhets [Wed, 30 Oct 2024 13:17:33 +0000 (14:17 +0100)]
drivers/video/vesa: use MTRRs only on x86

MTRR functionality is available only on x86, so this driver cannot be compiled
on other architectures. Fix this with preprocessor directives.

Signed-off-by: Yuri Zaporozhets <yuriz@qrv-systems.net>
7 weeks agobios_emulator: define the comment symbol for RISC-V assembler too
Yuri Zaporozhets [Wed, 30 Oct 2024 13:00:51 +0000 (14:00 +0100)]
bios_emulator: define the comment symbol for RISC-V assembler too

The bios_emulator driver cannot be compiled for RISC-V because the x86emu.h
header file doesn't define the comment symbol ("#") for the assembler.
With this patch, use the same symbol as for e.g. x86.

Signed-off-by: Yuri Zaporozhets <yuriz@qrv-systems.net>
7 weeks agobootmenu: add reprint check
Weijie Gao [Tue, 29 Oct 2024 09:47:22 +0000 (17:47 +0800)]
bootmenu: add reprint check

Record the last active menu item and check if it equals to the
current selected item before reprint.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Reviewed-by: Daniel Golle <daniel@makrotopia.org>
Tested-by: Daniel Golle <daniel@makrotopia.org>
7 weeks agomenu: add support to check if menu needs to be reprinted
Weijie Gao [Tue, 29 Oct 2024 09:47:16 +0000 (17:47 +0800)]
menu: add support to check if menu needs to be reprinted

This patch adds a new callback named need_reprint for menu.
The need_reprint will be called before printing the menu. If the
callback exists and returns FALSE, menu printing will be canceled.

This is very useful if the menu was not changed. It can save time
for serial-based menu to handle more input data.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Reviewed-by: Daniel Golle <daniel@makrotopia.org>
Tested-by: Daniel Golle <daniel@makrotopia.org>
7 weeks agomenu: fix the logic checking whether ESC key is pressed
Weijie Gao [Tue, 29 Oct 2024 09:47:10 +0000 (17:47 +0800)]
menu: fix the logic checking whether ESC key is pressed

It's observed that the bootmenu on a serial console sometimes
incorrectly quitted with superfluous characters filled to command
line input:

>  *** U-Boot Boot Menu ***
>
>      1. Startup system (Default)
>      2. Upgrade firmware
>      3. Upgrade ATF BL2
>      4. Upgrade ATF FIP
>      5. Load image
>      0. U-Boot console
>
>
>  Press UP/DOWN to move, ENTER to select, ESC to quit
>MT7988> [B

Analysis shows it was caused by the wrong logic of bootmenu_loop:

At first the bootmenu_loop received the first ESC char correctly.

However, during the second call to bootmenu_loop, there's no data
in the UART Rx FIFO. Due to the low baudrate, the second char of
the down array key sequence hasn't be fully received.

But bootmenu_loop just did a mdelay(10), and then treated it as a
single ESC key press event. It didn't even try tstc() again after
the 10ms timeout.

This patch fixes this issue by letting bootmenu_loop check tstc()
twice.

Tested-By: E Shattow <lucent@gmail.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Reviewed-by: Daniel Golle <daniel@makrotopia.org>
Tested-by: Daniel Golle <daniel@makrotopia.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 weeks agoMerge patch series "U-boot: arm: Refine the booting on Total Compute"
Tom Rini [Mon, 4 Nov 2024 21:40:54 +0000 (15:40 -0600)]
Merge patch series "U-boot: arm: Refine the booting on Total Compute"

Leo Yan <leo.yan@arm.com> says:

This patch series is to refine the booting on Arm Total Compuate
platform.

It changes to use the info passed in DTB for initialization DRAM info,
and dynamically initializes the booting envoironment variables.

Another big change is to use an envoironment file for boot commands,
based on it, the series extends to support multiple block devices
(MMC and virtio). And the env file is extended for booting Debian.

The last commit is to update memory mapping info based on the DRAM info
passed via DT binding.

Link: https://lore.kernel.org/r/20241025171821.624702-1-leo.yan@arm.com
7 weeks agoarm: total_compute: Update memory mapping info
Leo Yan [Fri, 25 Oct 2024 17:18:21 +0000 (18:18 +0100)]
arm: total_compute: Update memory mapping info

This commit introduces build_mem_map() function for updating the mem_map
structure with copying info from gd->bd->bi_dram, so that it can keep
the consistence for DRAM info passed via DT.

The page table size is calculated prior to mem_map is ready, introduce
the get_page_table_size() function for a predefined table size.

Signed-off-by: Leo Yan <leo.yan@arm.com>
7 weeks agoarm: total_compute: Support Debian boot
Leo Yan [Fri, 25 Oct 2024 17:18:20 +0000 (18:18 +0100)]
arm: total_compute: Support Debian boot

Add booting option for Debian system.

Signed-off-by: Leo Yan <leo.yan@arm.com>
7 weeks agoarm: total_compute: Dynamically detect block device
Leo Yan [Fri, 25 Oct 2024 17:18:19 +0000 (18:18 +0100)]
arm: total_compute: Dynamically detect block device

Dynamically detect block device in the boot command, this allows to
support both MMC and virtio block devices.

Signed-off-by: Leo Yan <leo.yan@arm.com>
7 weeks agoarm: total_compute: Minor improvement for boot arguments
Boyan Karatotev [Fri, 25 Oct 2024 17:18:18 +0000 (18:18 +0100)]
arm: total_compute: Minor improvement for boot arguments

Tell the AVB command that is loading from MMC.

Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
Signed-off-by: Leo Yan <leo.yan@arm.com>
7 weeks agoarm: total_compute: move the boot command to an env file
Boyan Karatotev [Fri, 25 Oct 2024 17:18:17 +0000 (18:18 +0100)]
arm: total_compute: move the boot command to an env file

The boot command for Total Compute has many aspects and changes from time
to time. So move it to an .env file where it can be a proper script.

Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
Signed-off-by: Leo Yan <leo.yan@arm.com>
7 weeks agoarm: total_compute: Remove unused bootm_size
Boyan Karatotev [Fri, 25 Oct 2024 17:18:16 +0000 (18:18 +0100)]
arm: total_compute: Remove unused bootm_size

The whole DRAM bank is used for loading and U-boot can detect the
overlap between the kernel and initramfs. So it is safe to drop
bootm_size.

Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
Signed-off-by: Leo Yan <leo.yan@arm.com>
7 weeks agoarm: total_compute: Initialize environment variables
Boyan Karatotev [Fri, 25 Oct 2024 17:18:15 +0000 (18:18 +0100)]
arm: total_compute: Initialize environment variables

Initialize the environment variables 'fdt_addr_r' and 'kernel_addr_r'
during the misc init phase. The static configurations are not needed,
remove them.

Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
Signed-off-by: Leo Yan <leo.yan@arm.com>
7 weeks agoarm: total_compute: depend on TF-A for hardware description
Boyan Karatotev [Fri, 25 Oct 2024 17:18:14 +0000 (18:18 +0100)]
arm: total_compute: depend on TF-A for hardware description

On Total Compute, TF-A passes the info via DT binding for the hardware
description - includes the serial, memory, and arm_ffa nodes.

This commit initializes the fdt base address based on the passed the
register x1.

The similar implementation has already been done for the raspberry pi,
so borrow a lot of it.

Co-developed-by: Jackson Cooper-Driver <jackson.cooper-driver@arm.com>
Signed-off-by: Jackson Cooper-Driver <jackson.cooper-driver@arm.com>
Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
Signed-off-by: Leo Yan <leo.yan@arm.com>
7 weeks agoMerge patch series "Fixes to allow 'ut bootm' to pass when run interactively"
Tom Rini [Mon, 4 Nov 2024 20:49:10 +0000 (14:49 -0600)]
Merge patch series "Fixes to allow 'ut bootm' to pass when run interactively"

Andrew Goodbody <andrew.goodbody@linaro.org> says:

Starting a sandbox session and running 'ut bootm' on the command
line instead of using pytest with --verbose will result in some
test failures. This series makes the tests more deterministic so
that they will better control their environment and hence will
work as expected whether or not they are invoked with '--verbose'.
The series starts with a small fix to the parameters of
bootm_process_cmdline that one commit incorrectly added using a bool
when it had been updated to take flags by the preceeding commit.

Link: https://lore.kernel.org/r/20241101130254.473017-1-andrew.goodbody@linaro.org
7 weeks agotest: bootm: Ensure GD_FLG_SILENT is reset
Andrew Goodbody [Fri, 1 Nov 2024 13:02:54 +0000 (13:02 +0000)]
test: bootm: Ensure GD_FLG_SILENT is reset

Some bootm tests expect that GD_FLG_SILENT is reset in order
to work as expected. This is the state if the test is run with
'pytest --verbose' but not if run from, say, the sandbox command
line.
So reset the flag for those tests that rely on it being reset. This
has to be done in each test as the test infrastructure will set it
again before every test when not invoked with 'pytest --verbose'.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
7 weeks agotest: bootm: bootm_process_cmdline_env takes flags
Andrew Goodbody [Fri, 1 Nov 2024 13:02:53 +0000 (13:02 +0000)]
test: bootm: bootm_process_cmdline_env takes flags

The function bootm_process_cmdline_env takes flags as its third
parameter, not a bool. Correct the usage by replacing 'true'
with BOOTM_CL_ALL so that the intent is clear.
A similar change was made throughtout this file in the previous
commit to the one mentioned below as being fixed.

Fixes: 4448fe8e4e7c ("bootm: Allow updating the bootargs in a buffer")
Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
7 weeks agousb: Fix test dependency on ext4write command
Andrew Goodbody [Tue, 15 Oct 2024 14:17:37 +0000 (15:17 +0100)]
usb: Fix test dependency on ext4write command

The tests test_usb_ext4load_ext4write, test_usb_ext2load and
test_usb_load depend on the command ext4write being present not just
the feature of being able to write to an ext4 file system. So update
their dependencies to include the ext4write command itself. This will
prevent spurious test failures when running the USB tests against USB
storage with an ext2/ext4 partition but no ext4write command available.

Fixes: 1c5b6edad381 ("test/py: usb: Add tests for USB device")
Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Reviewed-by: Love Kumar <love.kumar@amd.com>
7 weeks agousb: Fix test failure with multiple partitions
Andrew Goodbody [Tue, 15 Oct 2024 12:19:16 +0000 (13:19 +0100)]
usb: Fix test failure with multiple partitions

When test_usb_load finds multiple partitions of the same type then
it will cause a test failure. The call to write the test file will
write a different test file to each partition but only return the
name and size of the last one written. So the test then fails to
load the test file from the first partition as it uses the name of
a file on a different partition.

Refactor the code so that only one test file is written at a time
and is written to only the partition being tested at that time. This
allows the correct file name to always be available to the code that
runs the load command. This reduces the number of files written and
also the number of calls to crc32 needed.

Fixes: 1c5b6edad381 ("test/py: usb: Add tests for USB device")
Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Reviewed-by: Love Kumar <love.kumar@amd.com>
7 weeks agoMerge tag 'dm-pull-2nov24' of https://source.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Sun, 3 Nov 2024 23:23:29 +0000 (17:23 -0600)]
Merge tag 'dm-pull-2nov24' of https://source.denx.de/u-boot/custodians/u-boot-dm

CI: https://source.denx.de/u-boot/custodians/u-boot-dm/-/pipelines/23152
CI: https://dev.azure.com/simon0972/u-boot/_build/results?buildId=71&view=results

- alist enhancements and fixes
- minor test and sandbox fixes
- some more x86/coreboot patches

7 weeks agosandbox: Fix comment for nomap_sysmem() function
Simon Glass [Mon, 28 Oct 2024 12:47:58 +0000 (13:47 +0100)]
sandbox: Fix comment for nomap_sysmem() function

This should say 'cast' rather than 'case', so fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 weeks agosandbox: Add a way to show the sandbox memory-mapping
Simon Glass [Mon, 28 Oct 2024 12:47:57 +0000 (13:47 +0100)]
sandbox: Add a way to show the sandbox memory-mapping

This is mostly hidden in the background, but it is sometimes useful to
look at it. Add a function to allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 weeks agodoc: sandbox: Add docs for the sb command
Simon Glass [Mon, 28 Oct 2024 12:47:56 +0000 (13:47 +0100)]
doc: sandbox: Add docs for the sb command

This command has a few small features, so document it.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 weeks agosandbox: Convert sb command to use new macro
Simon Glass [Mon, 28 Oct 2024 12:47:55 +0000 (13:47 +0100)]
sandbox: Convert sb command to use new macro

Ise the new U_BOOT_CMD_WITH_SUBCMDS() macro instead of writing the code
out manually.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 weeks agobloblist: test: Mark tests with UTF_BLOBLIST
Simon Glass [Mon, 28 Oct 2024 12:47:54 +0000 (13:47 +0100)]
bloblist: test: Mark tests with UTF_BLOBLIST

Mark bloblist tests with this flag so that other tests which use
bloblist remain unaffected.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 weeks agotest: Allow saving and restoring the bloblist
Simon Glass [Mon, 28 Oct 2024 12:47:53 +0000 (13:47 +0100)]
test: Allow saving and restoring the bloblist

Tests which create a new bloblist overwrite the existing one in sandbox.
Provide a flag for tests to declare this behaviour. Save and restore the
bloblist pointer so that other tests remain unaffected.

Note that when sandbox is running normally, the bloblist has been
relocated to high in memory. The existing bloblist tests create a new
bloblist low in memory, so they do not conflict.

Correct a build error on coreboot by using accessors for gd->bloblist:
Signed-off-by: Simon Glass <sjg@chromium.org>
7 weeks agolog: Add a new category for tests
Simon Glass [Mon, 28 Oct 2024 12:47:52 +0000 (13:47 +0100)]
log: Add a new category for tests

In some core test code, no existing categories make sense. Add a new one
for testing.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 weeks agox86: coreboot: Allow building an expo for editing CMOS config
Simon Glass [Mon, 14 Oct 2024 22:32:11 +0000 (16:32 -0600)]
x86: coreboot: Allow building an expo for editing CMOS config

Coreboot provides the CMOS layout in the tables it passes to U-Boot.
Use that to build an editor for the CMOS settings.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 weeks agox86: coreboot: Add a command to check and update CMOS RAM
Simon Glass [Mon, 14 Oct 2024 22:32:10 +0000 (16:32 -0600)]
x86: coreboot: Add a command to check and update CMOS RAM

Coreboot tables provide information about the CMOS-RAM checksum. Add a
command which can check and update this.

With this it is possible to adjust CMOS-RAM settings and tidy up the
checksum afterwards.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 weeks agox86: coreboot: Enable support for the configuration editor
Simon Glass [Mon, 14 Oct 2024 22:32:09 +0000 (16:32 -0600)]
x86: coreboot: Enable support for the configuration editor

Enable cedit support along with required options and a simple style.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 weeks agox86: coreboot: Show the option table
Simon Glass [Mon, 14 Oct 2024 22:32:08 +0000 (16:32 -0600)]
x86: coreboot: Show the option table

Update the cbsysinfo command to show the contents of the CMOS option
table.

While we are here, add some example output for this command, along with
mention of what the unimplemented tags are.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 weeks agox86: coreboot: Add a test for cbsysinfo command
Simon Glass [Mon, 14 Oct 2024 22:32:07 +0000 (16:32 -0600)]
x86: coreboot: Add a test for cbsysinfo command

Add a simple test for this command, checking that coreboot has the
required features.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 weeks agobootstage: Do not sort records
Jonas Karlman [Sat, 3 Aug 2024 12:41:45 +0000 (12:41 +0000)]
bootstage: Do not sort records

The timer counter on Rockchip SoCs may be reset in TF-A, this may cause
the bootstage records to be printed out of order and with an incorrect
elapsed time.

Fix this by not sorting the bootstage records.

Before on a Radxa ZERO 3W (RK3566) board:

  => bootstage report
  Timer summary in microseconds (12 records):
         Mark    Elapsed  Stage
            0          0  reset
        7,436      7,436  board_init_f
      164,826    157,390  SPL
      375,392    210,566  end phase
      423,909     48,517  board_init_r
      472,973     49,064  eth_common_init
      476,848      3,875  main_loop
      477,003        155  cli_loop

  Accumulated time:
                   7,181  of_live
                  14,739  dm_spl
                  15,029  dm_r
                 315,150  dm_f

With this the records can be printed in chronological order when the
counter is reset and SPL and board_init_r records show correct elapsed
time.

  => bootstage report
  Timer summary in microseconds (12 records):
         Mark    Elapsed  Stage
            0          0  reset
      164,437    164,437  SPL
      375,023    210,586  end phase
        7,437      7,437  board_init_f
      424,390    416,953  board_init_r
      473,515     49,125  eth_common_init
      477,402      3,887  main_loop
      477,571        169  cli_loop

  Accumulated time:
                  14,734  dm_spl
                 315,646  dm_f
                   7,339  of_live
                  14,977  dm_r

For the tested board external TPL and BROM take ~164 ms to initialize
DRAM and load SPL, SPL take ~210ms to load images from FIT and U-Boot
proper take ~477ms to reach cli prompt.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
7 weeks agobootstd: Avoid showing an invalid buffer address
Simon Glass [Sat, 19 Oct 2024 15:22:09 +0000 (09:22 -0600)]
bootstd: Avoid showing an invalid buffer address

When the buffer address is not set, say so, rather than showing an
address which looks very strange, on sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 weeks agobootstd: cros: Correct the x86-setup address
Simon Glass [Sat, 19 Oct 2024 15:21:59 +0000 (09:21 -0600)]
bootstd: cros: Correct the x86-setup address

This should really use an address rather than the buffer. Update it in
the command.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 weeks agotest: boot: Update bootflow_iter() for console checking
Simon Glass [Sat, 19 Oct 2024 15:21:58 +0000 (09:21 -0600)]
test: boot: Update bootflow_iter() for console checking

This test checks console output so should have the UTF_CONSOLE flag. Add
it.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 weeks agotest: Drop the duplicate line in setup_bootmenu_image()
Simon Glass [Sat, 19 Oct 2024 15:21:57 +0000 (09:21 -0600)]
test: Drop the duplicate line in setup_bootmenu_image()

The mkimage call is done twice. Remove the duplicate.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 weeks agotest: Expand implementation of ut_list_has_dm_tests()
Simon Glass [Sat, 19 Oct 2024 15:21:56 +0000 (09:21 -0600)]
test: Expand implementation of ut_list_has_dm_tests()

This function assumes that all tests in a suite are being run. This
means that it can sometimes call dm_test_restore() when it should not.

The impact of this is that it is not possible, for example, to run
'ut bootstd bootflow_cros' and then check the state of bootstd
afterwards, since all devices are removed and recreated.

Update the function to take account of any selected test, to avoid this
problem.

Add a comment for test_insert while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 weeks agotest: boot: Use a consistent name for the script bootmeth
Simon Glass [Sat, 19 Oct 2024 15:21:50 +0000 (09:21 -0600)]
test: boot: Use a consistent name for the script bootmeth

In the bootflow tests the script bootmeth is bound with the name
bootmeth_script whereas the others have a name without the bootmeth_
prefix. Adjust it to be the same.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
7 weeks agodm: core: Add a function to see if a device exists
Simon Glass [Sat, 19 Oct 2024 15:21:49 +0000 (09:21 -0600)]
dm: core: Add a function to see if a device exists

All the uclass functions for finding a device end up creating a uclass
if it doesn't exist. Add a function which instead returns NULL in this
case.

This is useful when in the 'unbind' path, since we don't want to undo
any unbinding which has already happened.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 weeks agoalist: Add maintainer
Simon Glass [Sat, 19 Oct 2024 15:21:48 +0000 (09:21 -0600)]
alist: Add maintainer

Add myself as maintainer of alist

Signed-off-by: Simon Glass <sjg@chromium.org>
7 weeks agoalist: Add a way to efficiently filter an alist
Simon Glass [Sat, 19 Oct 2024 15:21:47 +0000 (09:21 -0600)]
alist: Add a way to efficiently filter an alist

Unlike linked lists, it is inefficient to remove items from an alist,
particularly if it is large. If most items need to be removed, then the
time-complexity approaches O(n2).

Provide a way to do this efficiently, by working through the alist once
and copying elements down.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 weeks agoalist: Add a function to empty the list
Simon Glass [Sat, 19 Oct 2024 15:21:46 +0000 (09:21 -0600)]
alist: Add a function to empty the list

Sometimes it is useful to empty the list without de-allocating any of
the memory used, e.g. when the list will be re-populated immediately
afterwards.

Add a new function for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 weeks agoalist: Add for-loop helpers
Simon Glass [Sat, 19 Oct 2024 15:21:45 +0000 (09:21 -0600)]
alist: Add for-loop helpers

Add some macros which permit easy iteration through an alist, similar to
those provided by the 'list' implementation.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 weeks agoalist: Add a way to get the next element
Simon Glass [Sat, 19 Oct 2024 15:21:44 +0000 (09:21 -0600)]
alist: Add a way to get the next element

Add a new function which returns the next element after the one
provided, if it exists in the list.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 weeks agoalist: Expand the comment for alist_get()
Simon Glass [Sat, 19 Oct 2024 15:21:43 +0000 (09:21 -0600)]
alist: Expand the comment for alist_get()

Add a better description for this macro.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 weeks agoalist: Add a comment for alist_init_struct()
Simon Glass [Sat, 19 Oct 2024 15:21:42 +0000 (09:21 -0600)]
alist: Add a comment for alist_init_struct()

Comment this macro so that it is clear how to use it.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 weeks agoalist: Mention the error condition in alist_add_placeholder()
Simon Glass [Sat, 19 Oct 2024 15:21:41 +0000 (09:21 -0600)]
alist: Mention the error condition in alist_add_placeholder()

Update the function comment to note that this function can return NULL
if it runs out of memory.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 weeks ago.readthedocs.yml: update Python version and Ubuntu release
Heinrich Schuchardt [Sun, 3 Nov 2024 10:56:35 +0000 (11:56 +0100)]
.readthedocs.yml: update Python version and Ubuntu release

The current documentation build dependencies are not compatible with
Python 3.9. Update to Python 3.12.

Use the current Ubuntu LTS release, i.e. 24.04 Noble Numbat.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 weeks agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sh
Tom Rini [Sun, 3 Nov 2024 17:05:20 +0000 (11:05 -0600)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sh

7 weeks agoARM: renesas: Deduplicate common Renesas defconfig
Marek Vasut [Sun, 27 Oct 2024 02:20:07 +0000 (03:20 +0100)]
ARM: renesas: Deduplicate common Renesas defconfig

Deduplicate common Renesas defconfig by factoring out the common
parts into generic renesas_rcar_defconfig and including those using
the #include <configs/...> preprocessor macro in the current set of
board specific defconfigs. The preprocessor macro is applicable
to defconfigs as well.

This introduces no functional change, the resulting .config are
identical for all Renesas systems.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
7 weeks agoARM: renesas: Deduplicate Renesas R-Car 64bit defconfigs
Marek Vasut [Sun, 27 Oct 2024 02:20:06 +0000 (03:20 +0100)]
ARM: renesas: Deduplicate Renesas R-Car 64bit defconfigs

Deduplicate defconfigs for all Renesas R-Car 64bit systems by factoring
out the common parts into generic renesas_rcar64.config and including
those using the #include <configs/...> preprocessor macro in the current
set of board specific defconfigs. The preprocessor macro is applicable
to defconfigs as well.

This introduces no functional change, the resulting .config is identical
for all Renesas R-Car 64bit systems.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
7 weeks agoARM: renesas: Deduplicate Renesas R-Car Gen4 defconfigs
Marek Vasut [Sun, 27 Oct 2024 02:20:05 +0000 (03:20 +0100)]
ARM: renesas: Deduplicate Renesas R-Car Gen4 defconfigs

Deduplicate defconfigs for all Renesas R-Car Gen4 systems by factoring
out the common parts into generic renesas_rcar4.config and including
those using the #include <configs/...> preprocessor macro in the current
set of board specific defconfigs. The preprocessor macro is applicable
to defconfigs as well.

This introduces no functional change, the resulting .config is identical
for all Renesas R-Car Gen4 systems.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
7 weeks agoARM: renesas: Deduplicate Renesas R-Car Gen3 defconfigs
Marek Vasut [Sun, 27 Oct 2024 02:20:04 +0000 (03:20 +0100)]
ARM: renesas: Deduplicate Renesas R-Car Gen3 defconfigs

Deduplicate defconfigs for all Renesas R-Car Gen3 systems by factoring
out the common parts into generic renesas_rcar3.config and including
those using the #include <configs/...> preprocessor macro in the current
set of board specific defconfigs. The preprocessor macro is applicable
to defconfigs as well.

This introduces no functional change, the resulting .config is identical
for all Renesas R-Car Gen3 systems.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
7 weeks agoARM: renesas: Deduplicate Renesas R-Car Gen2 defconfigs
Marek Vasut [Sun, 27 Oct 2024 02:20:03 +0000 (03:20 +0100)]
ARM: renesas: Deduplicate Renesas R-Car Gen2 defconfigs

Deduplicate defconfigs for all Renesas R-Car Gen2 systems by factoring
out the common parts into generic renesas_rcar2.config and including
those using the #include <configs/...> preprocessor macro in the current
set of board specific defconfigs. The preprocessor macro is applicable
to defconfigs as well.

This introduces no functional change, the resulting .config is identical
for all Renesas R-Car Gen2 systems.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
7 weeks agoclk: renesas: Fix missing unbind on driver look up failure
Marek Vasut [Wed, 4 Sep 2024 22:34:20 +0000 (00:34 +0200)]
clk: renesas: Fix missing unbind on driver look up failure

In case lists_driver_lookup_name("rst_gen3") fails, the clk_gen3 driver
has to be unbound before erroring out. Reorder the function such that
both clk_gen3 and rst_gen3 drivers are looked up first, if either look
up fails then the function errors out right away. Second, the clk_gen3
is bound, if binding fails, the function still errors out right away
because there is nothing to undo after either lists_driver_lookup_name()
call. Finally, rst_gen3 is bound and if this binding fails, then that
is the only place where clk_gen3 has to be unbound before erroring out.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
7 weeks agoMerge patch series "fs: ext4: implement opendir, readdir, closedir"
Tom Rini [Fri, 1 Nov 2024 19:38:05 +0000 (13:38 -0600)]
Merge patch series "fs: ext4: implement opendir, readdir, closedir"

Heinrich Schuchardt <heinrich.schuchardt@canonical.com> says:

With this series opendir, readdir, closedir are implemented for ext4.
These functions are needed for the UEFI sub-system to interact with
the ext4 file system.

To reduce code growth the functions are reused to implement the ls
command for ext4.

A memory leak in ext4fs_exists is resolved.

ext4fs_iterate_dir is simplified by removing a redundant pointer copy.

Link: https://lore.kernel.org/r/20241026064048.370062-1-heinrich.schuchardt@canonical.com
7 weeks agofs: ext4: use fs_ls_generic
Heinrich Schuchardt [Sat, 26 Oct 2024 06:40:48 +0000 (08:40 +0200)]
fs: ext4: use fs_ls_generic

Now that opendir, readir, closedir are implemented for ext4 we can use
fs_ls_generic() for implementing the ls command.

Adjust the unit tests:

* fs_ls_generic() produces more spaces between file size and name.
* The ext4 specific message "** Can not find directory. **\n" is not
  written anymore.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 weeks agoefi_loader: fix GetInfo and SetInfo
Heinrich Schuchardt [Sat, 26 Oct 2024 06:40:47 +0000 (08:40 +0200)]
efi_loader: fix GetInfo and SetInfo

* Some of our file system drivers cannot report a file size for
  directories. Use a dummy value in this case.
* For SetInfo the UEFI spec requires to ignore the file size field.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 weeks agofs: ext4: implement opendir, readdir, closedir
Heinrich Schuchardt [Sat, 26 Oct 2024 06:40:46 +0000 (08:40 +0200)]
fs: ext4: implement opendir, readdir, closedir

For accessing directories from the EFI sub-system a file system must
implement opendir, readdir, closedir. Provide the missing implementation.

With this patch the eficonfig command can be used to define load options
for the ext4 file system.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 weeks agofs: ext4: free directory node in ext4fs_exists()
Heinrich Schuchardt [Sat, 26 Oct 2024 06:40:45 +0000 (08:40 +0200)]
fs: ext4: free directory node in ext4fs_exists()

The directory retrieved in ext4fs_exists() should be freed to avoid a
memory leak.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
7 weeks agofs: ext4: simplify ext4fs_iterate_dir()
Heinrich Schuchardt [Sat, 26 Oct 2024 06:40:44 +0000 (08:40 +0200)]
fs: ext4: simplify ext4fs_iterate_dir()

Remove copying a pointer with a cast to the very same type.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 weeks agotest/cmd/mem_copy.c: Use CONFIG_SYS_LOAD_ADDR for base
Tom Rini [Wed, 30 Oct 2024 00:36:49 +0000 (18:36 -0600)]
test/cmd/mem_copy.c: Use CONFIG_SYS_LOAD_ADDR for base

When reading/writing to memory we cannot assume that a base address of
0x0 is correct and functional. So use CONFIG_SYS_LOAD_ADDR as the base
from which we add a bit more padding and being our tests.

Signed-off-by: Tom Rini <trini@konsulko.com>
7 weeks agotest/py: spi: prevent overwriting relocation memory
Padmarao Begari [Tue, 29 Oct 2024 11:47:09 +0000 (17:17 +0530)]
test/py: spi: prevent overwriting relocation memory

Update spi negative test case to prevent SF command
from overwriting relocation memory area.

Signed-off-by: Padmarao Begari <padmarao.begari@amd.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Love Kumar <love.kumar@amd.com>
7 weeks agolmb: remove __maybe_unused from lmb_map_update_notify
Heinrich Schuchardt [Mon, 28 Oct 2024 06:21:36 +0000 (07:21 +0100)]
lmb: remove __maybe_unused from lmb_map_update_notify

Function lmb_map_update_notify() is always referenced.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
7 weeks agoscsi: fix disk capacity too small by one sector
Julius Lehmann [Sat, 26 Oct 2024 18:06:44 +0000 (20:06 +0200)]
scsi: fix disk capacity too small by one sector

SCSI READ CAPACITY reports the address of the last block and the block
size. The total number of blocks is thus last block address plus one.

This also fixes the corresponding test case.

7 weeks agoacpi_table: Fix coverity defect in acpi_write_spcr
Patrick Rudolph [Wed, 30 Oct 2024 13:11:46 +0000 (14:11 +0100)]
acpi_table: Fix coverity defect in acpi_write_spcr

Fix "Integer handling issues  (SIGN_EXTENSION)" in newly added code:
Cast serial_info.reg_offset to u64 to prevent an integer overflow when
shifted too many bits to the left. Currently this never happens as the
shift is supposed to be less than 4.

Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
8 weeks agomtd: spi-nor: Guard SPI_STACKED_PARALLEL with DM_SPI check
Tom Rini [Thu, 31 Oct 2024 17:47:25 +0000 (11:47 -0600)]
mtd: spi-nor: Guard SPI_STACKED_PARALLEL with DM_SPI check

While we want to compile the SPI_STACKED_PARALLEL code everywhere we
can, it must first be guarded with an #if for DM_SPI as not all cases
where we have this code built, such as in SPL, will have the relevant
DM_SPI option enabled.

Fixes: 43423cdc5dc1 ("mtd: spi-nor: Always build SPI_STACKED_PARALLEL code")
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
8 weeks agoMerge patch series "mtd: spi-nor: Remove recently added nor->addr_width == 3 test"
Tom Rini [Thu, 31 Oct 2024 16:50:25 +0000 (10:50 -0600)]
Merge patch series "mtd: spi-nor: Remove recently added nor->addr_width == 3 test"

Tom Rini <trini@konsulko.com> says:

In the patch series "spi-nor: Add parallel and stacked memories support"
a number of issues have since been raised about problems that now exist
on a large number of previously working platforms. Marek Vasut has gone
and identified a number of issues and this series is the starting point
of attempting to address them and fix the problems with previously
existing platforms.

Link: https://patchwork.ozlabs.org/project/uboot/list/?series=429932&state=*
Link: https://lore.kernel.org/r/20241026201741.171073-1-marek.vasut+renesas@mailbox.org
8 weeks agomtd: spi-nor: Always build SPI_STACKED_PARALLEL code
Marek Vasut [Sat, 26 Oct 2024 20:16:26 +0000 (22:16 +0200)]
mtd: spi-nor: Always build SPI_STACKED_PARALLEL code

Prevent the code gated by SPI_STACKED_PARALLEL from bitrot
by using if (CONFIG_IS_ENABLED(SPI_STACKED_PARALLEL)) around
it. That way, it is always at least compiled.

Fixes: 5d40b3d384dc ("mtd: spi-nor: Add parallel and stacked memories support")
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
8 weeks agomtd: spi-nor: Rename SPI_ADVANCE to SPI_STACKED_PARALLEL
Marek Vasut [Sat, 26 Oct 2024 20:16:25 +0000 (22:16 +0200)]
mtd: spi-nor: Rename SPI_ADVANCE to SPI_STACKED_PARALLEL

The SPI_ADVANCE description does not explain what the switch does.
It does not have anything to do with any advanced functionality, it
only gates off support for stacked and parallel SPI NORs. Rename the
Kconfig symbol, update description, and move it right next to Xilinx
hardware as it seems to be specific to this hardware. Make sure the
symbol is also protected by if DM_SPI in Kconfig.

Fixes: 5d40b3d384dc ("mtd: spi-nor: Add parallel and stacked memories support")
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
8 weeks agomtd: spi-nor: Rewrite rem_bank_len calculation
Marek Vasut [Sat, 26 Oct 2024 20:16:24 +0000 (22:16 +0200)]
mtd: spi-nor: Rewrite rem_bank_len calculation

Rewrite the code to make it clear exactly where the
SNOR_F_HAS_PARALLEL flag leads to *2 and /2 operation
compared to regular code path. No functional change.

Fixes: 5d40b3d384dc ("mtd: spi-nor: Add parallel and stacked memories support")
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>