forked from armbian/build
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathv5-4-4-rockchip-spl-Add-support-for-booting-from-UFS.patch
More file actions
124 lines (112 loc) · 4.2 KB
/
Copy pathv5-4-4-rockchip-spl-Add-support-for-booting-from-UFS.patch
File metadata and controls
124 lines (112 loc) · 4.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mecid <mecid@mecomediagroup.de>
Date: Fri, 20 Feb 2026 21:55:32 +0100
Subject: [ARCHEOLOGY] Rock-4D: Add Edge + RK3576 Mainline U-Boot (with UFS
support) (#9421)
> X-Git-Archeology: > recovered message: > * Rock-4D: Edge (u-boot and kernel)
> X-Git-Archeology: > recovered message: > * RK3576: Mainline u-boot ufs boot enablement patches
> X-Git-Archeology: > recovered message: > * Rock-4D: Use Mainline u-boot 2026.04-rc2
> X-Git-Archeology: > recovered message: > * Rock-4D: Update KERNEL_TEST_TARGET to edge
> X-Git-Archeology: > recovered message: > * Rock-4D: Use Mainline u-boot on vendor and edge
> X-Git-Archeology: > recovered message: > * Remove vendor branch check for mainline uboot
> X-Git-Archeology: - Revision 77f919f6cd5db012127fdbdd9dd506c5e4346a8f: https://github.com/armbian/build/commit/77f919f6cd5db012127fdbdd9dd506c5e4346a8f
> X-Git-Archeology: Date: Fri, 20 Feb 2026 21:55:32 +0100
> X-Git-Archeology: From: Mecid <mecid@mecomediagroup.de>
> X-Git-Archeology: Subject: Rock-4D: Add Edge + RK3576 Mainline U-Boot (with UFS support) (#9421)
> X-Git-Archeology:
---
arch/arm/dts/rk3576-u-boot.dtsi | 16 +++++++++-
arch/arm/include/asm/arch-rockchip/bootrom.h | 1 +
arch/arm/mach-rockchip/rk3576/rk3576.c | 1 +
arch/arm/mach-rockchip/spl-boot-order.c | 14 ++++++++
4 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/arch/arm/dts/rk3576-u-boot.dtsi b/arch/arm/dts/rk3576-u-boot.dtsi
index 111111111111..222222222222 100644
--- a/arch/arm/dts/rk3576-u-boot.dtsi
+++ b/arch/arm/dts/rk3576-u-boot.dtsi
@@ -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,15 @@
bootph-some-ram;
};
+&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;
+};
+
&ioc_grf {
bootph-all;
};
@@ -176,6 +185,11 @@
bootph-pre-ram;
};
+&ufshc {
+ bootph-pre-ram;
+ bootph-some-ram;
+};
+
&xin24m {
bootph-all;
};
diff --git a/arch/arm/include/asm/arch-rockchip/bootrom.h b/arch/arm/include/asm/arch-rockchip/bootrom.h
index 111111111111..222222222222 100644
--- a/arch/arm/include/asm/arch-rockchip/bootrom.h
+++ b/arch/arm/include/asm/arch-rockchip/bootrom.h
@@ -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,
diff --git a/arch/arm/mach-rockchip/rk3576/rk3576.c b/arch/arm/mach-rockchip/rk3576/rk3576.c
index 111111111111..222222222222 100644
--- a/arch/arm/mach-rockchip/rk3576/rk3576.c
+++ b/arch/arm/mach-rockchip/rk3576/rk3576.c
@@ -46,6 +46,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[] = {
diff --git a/arch/arm/mach-rockchip/spl-boot-order.c b/arch/arm/mach-rockchip/spl-boot-order.c
index 111111111111..222222222222 100644
--- a/arch/arm/mach-rockchip/spl-boot-order.c
+++ b/arch/arm/mach-rockchip/spl-boot-order.c
@@ -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;
--
Armbian