rockchip: spl: Add support for booting from UFS

Add the required architecture-specific lookups to enable U-boot SPL to
load images from UFS storage devices on Rockchip RK3576, which has a
boot ROM capable of loading the SPL image from UFS.

Reviewed-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Alexey Charkov <alchark@flipper.net>
This commit is contained in:
Alexey Charkov
2026-03-11 17:30:59 +04:00
committed by Kever Yang
parent 1165c206c2
commit 9941ec2c5c
4 changed files with 48 additions and 1 deletions

View File

@@ -12,7 +12,7 @@
};
chosen {
u-boot,spl-boot-order = "same-as-spl", &sdmmc, &sdhci;
u-boot,spl-boot-order = "same-as-spl", &sdmmc, &sdhci, &ufshc;
};
dmc {
@@ -81,6 +81,17 @@
bootph-some-ram;
};
#ifdef CONFIG_SPL_UFS_SUPPORT
&gpio4 {
/* This is specifically for GPIO4_D0, which is the only 1.2V capable
* pin on RK3576 available for use as the UFS device reset, thus
* &gpio4 is required for booting from UFS on RK3576.
*/
bootph-pre-ram;
bootph-some-ram;
};
#endif
&ioc_grf {
bootph-all;
};
@@ -89,6 +100,11 @@
bootph-some-ram;
};
&pcfg_pull_down {
bootph-pre-ram;
bootph-some-ram;
};
&pcfg_pull_none {
bootph-all;
};
@@ -172,6 +188,21 @@
bootph-pre-ram;
};
&ufshc {
bootph-pre-ram;
bootph-some-ram;
};
&ufs_refclk {
bootph-pre-ram;
bootph-some-ram;
};
&ufs_rstgpio {
bootph-pre-ram;
bootph-some-ram;
};
&xin24m {
bootph-all;
};

View File

@@ -51,6 +51,7 @@ enum {
BROM_BOOTSOURCE_SPINOR = 3,
BROM_BOOTSOURCE_SPINAND = 4,
BROM_BOOTSOURCE_SD = 5,
BROM_BOOTSOURCE_UFS = 7,
BROM_BOOTSOURCE_I2C = 8,
BROM_BOOTSOURCE_SPI = 9,
BROM_BOOTSOURCE_USB = 10,

View File

@@ -49,6 +49,7 @@ const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
[BROM_BOOTSOURCE_FSPI0] = "/soc/spi@2a340000/flash@0",
[BROM_BOOTSOURCE_FSPI1_M1] = "/soc/spi@2a300000/flash@0",
[BROM_BOOTSOURCE_SD] = "/soc/mmc@2a310000",
[BROM_BOOTSOURCE_UFS] = "/soc/ufshc@2a2d0000",
};
static struct mm_region rk3576_mem_map[] = {

View File

@@ -76,6 +76,9 @@ static int spl_node_to_boot_device(int node)
if (!uclass_find_device_by_of_offset(UCLASS_SPI_FLASH, node, &parent))
return BOOT_DEVICE_SPI;
if (!uclass_find_device_by_of_offset(UCLASS_UFS, node, &parent))
return BOOT_DEVICE_UFS;
return -1;
}
@@ -231,6 +234,17 @@ int spl_decode_boot_device(u32 boot_device, char *buf, size_t buflen)
return -ENODEV;
}
if (boot_device == BOOT_DEVICE_UFS) {
ret = uclass_find_device(UCLASS_UFS, 0, &dev);
if (ret) {
debug("%s: could not find device for UFS: %d\n",
__func__, ret);
return ret;
}
return ofnode_get_path(dev_ofnode(dev), buf, buflen);
}
#if CONFIG_IS_ENABLED(BLK)
dev_num = (boot_device == BOOT_DEVICE_MMC1) ? 0 : 1;