[PATCH v2 0/3] Enable full UFS boot on Rockchip RK3576

Alexey Charkov alchark at gmail.com
Mon Jan 5 16:05:35 CET 2026


Rockchip RK3576 can load its bootloader from UFS among other options,
so this series adds the necessary bits and pieces to enable an end-to-end
boot from UFS (boot ROM -> SPL -> U-boot proper -> kernel).

To achieve the above, this series goes through the following:
 - Patch 1 introduces arch-independent code to enable SPL images to use
   UFS devices, including build system tweaks and a function to locate
   a U-boot image at a fixed UFS offset and LUN (SCSI device number)
 - Patch 2 adds device-reset functionality to the Rockchip UFS glue code,
   which is required for (at least some) UFS modules to respond to
   controller commands upon initial enumeration
 - Patch 3 ties it all together for Rockchip RK3576

This has been tested on a FriendlyElec NanoPi M5 board with a Biwin
BWU3AKC46C256G UFS module. Note that booting directly from UFS masks the
issue which patch 2 aims to address, because the boot ROM initializes the
UFS module before handing over to U-boot. If, however, one boots SPL from
FSPI1 with the same driver code, the module fails to respond unless patch
2 is applied.

Changes to spl_fit.c which used to be part of v1 submission are no longer
required with the introduction of an optional bounce buffer for UFS block
reads, which is now folded into current Patch 1. This bounce buffer is
currently enabled by default for ARCH_ROCKCHIP, and it is similar to how
Rockchip's downstream SPL operates. It might be possible to allow the
UFSHC to write directly to PMU_SRAM, in which case the bounce buffer can
be disabled going forward, but there is no documented way to do so yet.

Note that in my experience none of the RK3576 boards actually boot current
mainline U-boot versions without a single-word SRAM write before jumping
to DDR initialization, as done in Kwiboo's commit at [1]. Therefore, to
test this series I additionally applied commits ea2ebb491e2c..390668db9d13
from Kwiboo's rk3576 branch [2] (including ea2ebb491e2c), so any testers
might want to:

git cherry-pick a256b4182bd2..390668db9d13

from there before or after applying this series

[1] https://source.denx.de/u-boot/contributors/kwiboo/u-boot/-/commit/390668db9d13b2cd0ac0077c15edb4b575ee28f9
[2] https://source.denx.de/u-boot/contributors/kwiboo/u-boot/-/commits/rk3576?ref_type=heads

Signed-off-by: Alexey Charkov <alchark at gmail.com>
---
Changes in v2:
- Rename the SPL UFS read helper function more self-descriptively (thanks Neil)
- Add an option to configure the UFS LUN used to look for the U-boot image
  in raw offset mode - or rather the SCSI device number, which most of the
  time coincides with the UFS LUN as long as the UFS device is the only
  SCSI block device the SPL sees (thanks Neil)
- Add an option to use a bounce buffer in RAM while loading U-boot from UFS,
  which helps avoid changes to common spl_fit.c code which in v1 achieved a
  similar result at a performance cost to unrelated platforms (thanks Jonas)
- Link to v1: https://lore.kernel.org/r/20251210-rk3576-ufs-v1-0-a3f9e76eb66e@gmail.com

---
Alexey Charkov (3):
      spl: Make UFS available for SPL builds
      ufs: rockchip: Add device reset support
      rockchip: spl: Add support for booting from UFS

 MAINTAINERS                                  |  1 +
 arch/arm/dts/rk3576-u-boot.dtsi              | 13 +++++-
 arch/arm/include/asm/arch-rockchip/bootrom.h |  1 +
 arch/arm/include/asm/spl.h                   |  1 +
 arch/arm/mach-rockchip/Kconfig               |  3 ++
 arch/arm/mach-rockchip/rk3576/rk3576.c       |  1 +
 arch/arm/mach-rockchip/spl-boot-order.c      | 14 ++++++
 common/spl/Kconfig                           | 48 ++++++++++++++++++++
 common/spl/Makefile                          |  1 +
 common/spl/spl_ufs.c                         | 65 ++++++++++++++++++++++++++++
 drivers/Makefile                             |  1 +
 drivers/reset/Kconfig                        |  9 ++++
 drivers/reset/Makefile                       |  2 +-
 drivers/scsi/Makefile                        |  3 ++
 drivers/ufs/Kconfig                          |  1 +
 drivers/ufs/ufs-rockchip.c                   | 25 +++++++++++
 drivers/ufs/ufs-rockchip.h                   |  1 +
 lib/Makefile                                 |  1 +
 18 files changed, 189 insertions(+), 2 deletions(-)
---
base-commit: 5e7624979083e2bc163e18165452d8ead462b58c
change-id: 20251210-rk3576-ufs-ac3bf4e87156

Best regards,
-- 
Alexey Charkov <alchark at gmail.com>



More information about the U-Boot mailing list