All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH next v2 0/6] rockchip: rk3588: add support for detecting U-Boot proper boot medium
@ 2023-11-08 17:25 Quentin Schulz
  2023-11-08 17:25 ` [PATCH next v2 1/6] rockchip: rk3399: simplify logic for getting SPL boot medium DT node Quentin Schulz
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Quentin Schulz @ 2023-11-08 17:25 UTC (permalink / raw)
  To: Simon Glass, Philipp Tomsich, Kever Yang
  Cc: Quentin Schulz, u-boot, jonas, Quentin Schulz, heiko

It is possible to boot U-Boot proper from a different storage medium
than the one used by the BOOTROM to load the SPL. This information is
stored in the u-boot,spl-boot-device Device Tree property and is
accessible from U-Boot proper so that it has knowledge at runtime where
it was loaded from.

This is already supported on rk3399 and px30 but with duplicated code,
so this patch series also factor out all of this into spl-boot-order of
Rockchip platforms, which makes it drastically easier to add support to
other SoCs, just a simple array needing to be added to the appropriate
SoC file.

Let's add support for this feature for rk3588 the same way it was done
for px30 and rk3399.

While at it, let's do some cleanups for Rockchip platforms.

Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---
Changes in v2:
- add factoring into spl-boot-order
- rework rk3588 support to use the factored out function
- add global data ptr cleanup
- remove rk3128 main SoC file (useless content)
- Link to v1: https://lore.kernel.org/r/20230502-rk3588-spl-boot-dev-v1-1-071722a85d2d@theobroma-systems.com

---
Quentin Schulz (6):
      rockchip: rk3399: simplify logic for getting SPL boot medium DT node
      rockchip: px30: simplify logic for getting SPL boot medium DT node
      rockchip: factor out spl_perform_fixups into common spl-boot-order
      rockchip: rk3588: insert u-boot,spl-boot-device into U-Boot device tree
      rockchip: remove unused global data ptr
      rockchip: rk3128: remove noop file

 arch/arm/mach-rockchip/board.c          |  3 --
 arch/arm/mach-rockchip/px30/px30.c      | 50 +++---------------------------
 arch/arm/mach-rockchip/rk3128/Makefile  |  1 -
 arch/arm/mach-rockchip/rk3128/rk3128.c  | 16 ----------
 arch/arm/mach-rockchip/rk3308/rk3308.c  |  3 --
 arch/arm/mach-rockchip/rk3328/rk3328.c  |  3 --
 arch/arm/mach-rockchip/rk3368/rk3368.c  |  3 --
 arch/arm/mach-rockchip/rk3399/rk3399.c  | 55 +++------------------------------
 arch/arm/mach-rockchip/rk3588/rk3588.c  | 10 ++++--
 arch/arm/mach-rockchip/spl-boot-order.c | 49 +++++++++++++++++++++++++++++
 10 files changed, 66 insertions(+), 127 deletions(-)
---
base-commit: e17d174773e9ba9447596708e702b7382e47a6cf
change-id: 20230502-rk3588-spl-boot-dev-efa2777cc21b

Best regards,
-- 
Quentin Schulz <quentin.schulz@theobroma-systems.com>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH next v2 1/6] rockchip: rk3399: simplify logic for getting SPL boot medium DT node
  2023-11-08 17:25 [PATCH next v2 0/6] rockchip: rk3588: add support for detecting U-Boot proper boot medium Quentin Schulz
@ 2023-11-08 17:25 ` Quentin Schulz
  2023-11-08 17:25 ` [PATCH next v2 2/6] rockchip: px30: " Quentin Schulz
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Quentin Schulz @ 2023-11-08 17:25 UTC (permalink / raw)
  To: Simon Glass, Philipp Tomsich, Kever Yang
  Cc: Quentin Schulz, u-boot, jonas, Quentin Schulz, heiko

From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

In preparation of moving spl_perform_fixups to spl-boot-order.c, let's
simplify the logic around mapping the BOOT_DEVICE_x enum index to a DT
node by using an instantiated array of chars instead of creating a new
data structure on the fly.

This will make it easier to only define the spl_boot_devices array in
the appropriate SoC file in an upcoming commit.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---
 arch/arm/mach-rockchip/rk3399/rk3399.c | 34 +++++++++++++++++++---------------
 1 file changed, 19 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-rockchip/rk3399/rk3399.c b/arch/arm/mach-rockchip/rk3399/rk3399.c
index 14565d2ed9f..60d95c81cd2 100644
--- a/arch/arm/mach-rockchip/rk3399/rk3399.c
+++ b/arch/arm/mach-rockchip/rk3399/rk3399.c
@@ -175,23 +175,27 @@ void board_debug_uart_init(void)
 #endif
 
 #if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD)
+const char * const spl_boot_devices[BOOT_DEVICE_NONE + 1] = {
+	[BOOT_DEVICE_MMC2] = "/mmc@fe320000",
+	[BOOT_DEVICE_MMC1] = "/mmc@fe330000",
+	[BOOT_DEVICE_SPI] = "/spi@ff1d0000/flash@0",
+};
+
 const char *spl_decode_boot_device(u32 boot_device)
 {
-	int i;
-	static const struct {
-		u32 boot_device;
-		const char *ofpath;
-	} spl_boot_devices_tbl[] = {
-		{ BOOT_DEVICE_MMC2, "/mmc@fe320000" },
-		{ BOOT_DEVICE_MMC1, "/mmc@fe330000" },
-		{ BOOT_DEVICE_SPI, "/spi@ff1d0000/flash@0" },
-	};
-
-	for (i = 0; i < ARRAY_SIZE(spl_boot_devices_tbl); ++i)
-		if (spl_boot_devices_tbl[i].boot_device == boot_device)
-			return spl_boot_devices_tbl[i].ofpath;
-
-	return NULL;
+	const char *spl_bootdevice_ofpath = NULL;
+
+	if (boot_device < ARRAY_SIZE(spl_boot_devices))
+		spl_bootdevice_ofpath = spl_boot_devices[boot_device];
+
+	if (spl_bootdevice_ofpath)
+		debug("%s: spl_bootdevice_id %x maps to '%s'\n",
+		      __func__, boot_device, spl_bootdevice_ofpath);
+	else
+		debug("%s: failed to resolve spl_bootdevice_id %x\n",
+		      __func__, boot_device);
+
+	return spl_bootdevice_ofpath;
 }
 
 void spl_perform_fixups(struct spl_image_info *spl_image)

-- 
2.41.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH next v2 2/6] rockchip: px30: simplify logic for getting SPL boot medium DT node
  2023-11-08 17:25 [PATCH next v2 0/6] rockchip: rk3588: add support for detecting U-Boot proper boot medium Quentin Schulz
  2023-11-08 17:25 ` [PATCH next v2 1/6] rockchip: rk3399: simplify logic for getting SPL boot medium DT node Quentin Schulz
@ 2023-11-08 17:25 ` Quentin Schulz
  2023-11-08 17:25 ` [PATCH next v2 3/6] rockchip: factor out spl_perform_fixups into common spl-boot-order Quentin Schulz
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Quentin Schulz @ 2023-11-08 17:25 UTC (permalink / raw)
  To: Simon Glass, Philipp Tomsich, Kever Yang
  Cc: Quentin Schulz, u-boot, jonas, Quentin Schulz, heiko

From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

In preparation of moving spl_perform_fixups to spl-boot-order.c, let's
simplify the logic around mapping the BOOT_DEVICE_x enum index to a DT
node by using an instantiated array of chars instead of creating a new
data structure on the fly.

This will make it easier to only define the spl_boot_devices array in
the appropriate SoC file in an upcoming commit.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---
 arch/arm/mach-rockchip/px30/px30.c | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-rockchip/px30/px30.c b/arch/arm/mach-rockchip/px30/px30.c
index 3bca25c609f..8937677d79e 100644
--- a/arch/arm/mach-rockchip/px30/px30.c
+++ b/arch/arm/mach-rockchip/px30/px30.c
@@ -445,22 +445,26 @@ void board_debug_uart_init(void)
 #endif /* CONFIG_DEBUG_UART_BOARD_INIT */
 
 #if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD)
+const char * const spl_boot_devices[BOOT_DEVICE_NONE + 1] = {
+	[BOOT_DEVICE_MMC2] = "/mmc@ff370000",
+	[BOOT_DEVICE_MMC1] = "/mmc@ff390000",
+};
+
 const char *spl_decode_boot_device(u32 boot_device)
 {
-	int i;
-	static const struct {
-		u32 boot_device;
-		const char *ofpath;
-	} spl_boot_devices_tbl[] = {
-		{ BOOT_DEVICE_MMC2, "/mmc@ff370000" },
-		{ BOOT_DEVICE_MMC1, "/mmc@ff390000" },
-	};
+	const char *spl_bootdevice_ofpath = NULL;
+
+	if (boot_device < ARRAY_SIZE(spl_boot_devices))
+		spl_bootdevice_ofpath = spl_boot_devices[boot_device];
 
-	for (i = 0; i < ARRAY_SIZE(spl_boot_devices_tbl); ++i)
-		if (spl_boot_devices_tbl[i].boot_device == boot_device)
-			return spl_boot_devices_tbl[i].ofpath;
+	if (spl_bootdevice_ofpath)
+		debug("%s: spl_bootdevice_id %x maps to '%s'\n",
+		      __func__, boot_device, spl_bootdevice_ofpath);
+	else
+		debug("%s: failed to resolve spl_bootdevice_id %x\n",
+		      __func__, boot_device);
 
-	return NULL;
+	return spl_bootdevice_ofpath;
 }
 
 void spl_perform_fixups(struct spl_image_info *spl_image)

-- 
2.41.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH next v2 3/6] rockchip: factor out spl_perform_fixups into common spl-boot-order
  2023-11-08 17:25 [PATCH next v2 0/6] rockchip: rk3588: add support for detecting U-Boot proper boot medium Quentin Schulz
  2023-11-08 17:25 ` [PATCH next v2 1/6] rockchip: rk3399: simplify logic for getting SPL boot medium DT node Quentin Schulz
  2023-11-08 17:25 ` [PATCH next v2 2/6] rockchip: px30: " Quentin Schulz
@ 2023-11-08 17:25 ` Quentin Schulz
  2023-11-08 17:25 ` [PATCH next v2 4/6] rockchip: rk3588: insert u-boot, spl-boot-device into U-Boot device tree Quentin Schulz
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Quentin Schulz @ 2023-11-08 17:25 UTC (permalink / raw)
  To: Simon Glass, Philipp Tomsich, Kever Yang
  Cc: Quentin Schulz, u-boot, jonas, Quentin Schulz, heiko

From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

All SoCs are susceptible to wanting to know which storage medium was
used to load U-Boot SPL. So instead of reimplementing the same functions
in SoCs over and over again (here just rk3399 and px30 but rk3588 is
coming), let's just put all this in common into spl-boot-order.c
allowing to support a new SoC just by defining the spl_boot_devices
array in the appropriate SoC file.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---
 arch/arm/mach-rockchip/px30/px30.c      | 46 -------------------------------
 arch/arm/mach-rockchip/rk3399/rk3399.c  | 46 -------------------------------
 arch/arm/mach-rockchip/spl-boot-order.c | 49 +++++++++++++++++++++++++++++++++
 3 files changed, 49 insertions(+), 92 deletions(-)

diff --git a/arch/arm/mach-rockchip/px30/px30.c b/arch/arm/mach-rockchip/px30/px30.c
index 8937677d79e..7676adcb044 100644
--- a/arch/arm/mach-rockchip/px30/px30.c
+++ b/arch/arm/mach-rockchip/px30/px30.c
@@ -449,50 +449,4 @@ const char * const spl_boot_devices[BOOT_DEVICE_NONE + 1] = {
 	[BOOT_DEVICE_MMC2] = "/mmc@ff370000",
 	[BOOT_DEVICE_MMC1] = "/mmc@ff390000",
 };
-
-const char *spl_decode_boot_device(u32 boot_device)
-{
-	const char *spl_bootdevice_ofpath = NULL;
-
-	if (boot_device < ARRAY_SIZE(spl_boot_devices))
-		spl_bootdevice_ofpath = spl_boot_devices[boot_device];
-
-	if (spl_bootdevice_ofpath)
-		debug("%s: spl_bootdevice_id %x maps to '%s'\n",
-		      __func__, boot_device, spl_bootdevice_ofpath);
-	else
-		debug("%s: failed to resolve spl_bootdevice_id %x\n",
-		      __func__, boot_device);
-
-	return spl_bootdevice_ofpath;
-}
-
-void spl_perform_fixups(struct spl_image_info *spl_image)
-{
-	void *blob = spl_image->fdt_addr;
-	const char *boot_ofpath;
-	int chosen;
-
-	/*
-	 * Inject the ofpath of the device the full U-Boot (or Linux in
-	 * Falcon-mode) was booted from into the FDT, if a FDT has been
-	 * loaded at the same time.
-	 */
-	if (!blob)
-		return;
-
-	boot_ofpath = spl_decode_boot_device(spl_image->boot_device);
-	if (!boot_ofpath) {
-		pr_err("%s: could not map boot_device to ofpath\n", __func__);
-		return;
-	}
-
-	chosen = fdt_find_or_add_subnode(blob, 0, "chosen");
-	if (chosen < 0) {
-		pr_err("%s: could not find/create '/chosen'\n", __func__);
-		return;
-	}
-	fdt_setprop_string(blob, chosen,
-			   "u-boot,spl-boot-device", boot_ofpath);
-}
 #endif
diff --git a/arch/arm/mach-rockchip/rk3399/rk3399.c b/arch/arm/mach-rockchip/rk3399/rk3399.c
index 60d95c81cd2..6929de5603c 100644
--- a/arch/arm/mach-rockchip/rk3399/rk3399.c
+++ b/arch/arm/mach-rockchip/rk3399/rk3399.c
@@ -181,52 +181,6 @@ const char * const spl_boot_devices[BOOT_DEVICE_NONE + 1] = {
 	[BOOT_DEVICE_SPI] = "/spi@ff1d0000/flash@0",
 };
 
-const char *spl_decode_boot_device(u32 boot_device)
-{
-	const char *spl_bootdevice_ofpath = NULL;
-
-	if (boot_device < ARRAY_SIZE(spl_boot_devices))
-		spl_bootdevice_ofpath = spl_boot_devices[boot_device];
-
-	if (spl_bootdevice_ofpath)
-		debug("%s: spl_bootdevice_id %x maps to '%s'\n",
-		      __func__, boot_device, spl_bootdevice_ofpath);
-	else
-		debug("%s: failed to resolve spl_bootdevice_id %x\n",
-		      __func__, boot_device);
-
-	return spl_bootdevice_ofpath;
-}
-
-void spl_perform_fixups(struct spl_image_info *spl_image)
-{
-	void *blob = spl_image->fdt_addr;
-	const char *boot_ofpath;
-	int chosen;
-
-	/*
-	 * Inject the ofpath of the device the full U-Boot (or Linux in
-	 * Falcon-mode) was booted from into the FDT, if a FDT has been
-	 * loaded at the same time.
-	 */
-	if (!blob)
-		return;
-
-	boot_ofpath = spl_decode_boot_device(spl_image->boot_device);
-	if (!boot_ofpath) {
-		pr_err("%s: could not map boot_device to ofpath\n", __func__);
-		return;
-	}
-
-	chosen = fdt_find_or_add_subnode(blob, 0, "chosen");
-	if (chosen < 0) {
-		pr_err("%s: could not find/create '/chosen'\n", __func__);
-		return;
-	}
-	fdt_setprop_string(blob, chosen,
-			   "u-boot,spl-boot-device", boot_ofpath);
-}
-
 static void rk3399_force_power_on_reset(void)
 {
 	ofnode node;
diff --git a/arch/arm/mach-rockchip/spl-boot-order.c b/arch/arm/mach-rockchip/spl-boot-order.c
index 93b8e7de4d0..55d0976fb0a 100644
--- a/arch/arm/mach-rockchip/spl-boot-order.c
+++ b/arch/arm/mach-rockchip/spl-boot-order.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <fdt_support.h>
 #include <log.h>
 #include <mmc.h>
 #include <spl.h>
@@ -161,4 +162,52 @@ void board_boot_order(u32 *spl_boot_list)
 	if (idx == 0)
 		spl_boot_list[0] = spl_boot_device();
 }
+
+__weak const char * const spl_boot_devices[BOOT_DEVICE_NONE + 1] = {};
+
+const char *spl_decode_boot_device(u32 boot_device)
+{
+	const char *spl_bootdevice_ofpath = NULL;
+
+	if (boot_device < ARRAY_SIZE(spl_boot_devices))
+		spl_bootdevice_ofpath = spl_boot_devices[boot_device];
+
+	if (spl_bootdevice_ofpath)
+		debug("%s: spl_bootdevice_id %x maps to '%s'\n",
+		      __func__, boot_device, spl_bootdevice_ofpath);
+	else
+		debug("%s: failed to resolve spl_bootdevice_id %x\n",
+		      __func__, boot_device);
+
+	return spl_bootdevice_ofpath;
+}
+
+void spl_perform_fixups(struct spl_image_info *spl_image)
+{
+	void *blob = spl_image->fdt_addr;
+	const char *boot_ofpath;
+	int chosen;
+
+	/*
+	 * Inject the ofpath of the device the full U-Boot (or Linux in
+	 * Falcon-mode) was booted from into the FDT, if a FDT has been
+	 * loaded at the same time.
+	 */
+	if (!blob)
+		return;
+
+	boot_ofpath = spl_decode_boot_device(spl_image->boot_device);
+	if (!boot_ofpath) {
+		pr_err("%s: could not map boot_device to ofpath\n", __func__);
+		return;
+	}
+
+	chosen = fdt_find_or_add_subnode(blob, 0, "chosen");
+	if (chosen < 0) {
+		pr_err("%s: could not find/create '/chosen'\n", __func__);
+		return;
+	}
+	fdt_setprop_string(blob, chosen,
+			   "u-boot,spl-boot-device", boot_ofpath);
+}
 #endif

-- 
2.41.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH next v2 4/6] rockchip: rk3588: insert u-boot, spl-boot-device into U-Boot device tree
  2023-11-08 17:25 [PATCH next v2 0/6] rockchip: rk3588: add support for detecting U-Boot proper boot medium Quentin Schulz
                   ` (2 preceding siblings ...)
  2023-11-08 17:25 ` [PATCH next v2 3/6] rockchip: factor out spl_perform_fixups into common spl-boot-order Quentin Schulz
@ 2023-11-08 17:25 ` Quentin Schulz
  2024-01-17 10:16   ` [PATCH next v2 4/6] rockchip: rk3588: insert u-boot,spl-boot-device " Kever Yang
  2023-11-08 17:25 ` [PATCH next v2 5/6] rockchip: remove unused global data ptr Quentin Schulz
  2023-11-08 17:25 ` [PATCH next v2 6/6] rockchip: rk3128: remove noop file Quentin Schulz
  5 siblings, 1 reply; 10+ messages in thread
From: Quentin Schulz @ 2023-11-08 17:25 UTC (permalink / raw)
  To: Simon Glass, Philipp Tomsich, Kever Yang
  Cc: Quentin Schulz, u-boot, jonas, Quentin Schulz, heiko

From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

It is possible to boot U-Boot proper from a different storage medium
than the one used by the BOOTROM to load the SPL. This information is
stored in the u-boot,spl-boot-device Device Tree property and is
accessible from U-Boot proper so that it has knowledge at runtime where
it was loaded from.

Let's add support for this feature for rk3588 the same way it was done
for px30 and rk3399.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---
 arch/arm/mach-rockchip/rk3588/rk3588.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/mach-rockchip/rk3588/rk3588.c b/arch/arm/mach-rockchip/rk3588/rk3588.c
index b1f535fad50..fde5f281b0a 100644
--- a/arch/arm/mach-rockchip/rk3588/rk3588.c
+++ b/arch/arm/mach-rockchip/rk3588/rk3588.c
@@ -163,3 +163,11 @@ int arch_cpu_init(void)
 	return 0;
 }
 #endif
+
+#if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD)
+const char * const spl_boot_devices[BOOT_DEVICE_NONE + 1] = {
+	[BOOT_DEVICE_MMC2] = "/mmc@fe2e0000",
+	[BOOT_DEVICE_MMC1] = "/mmc@fe2c0000",
+	[BOOT_DEVICE_SPI] = "/spi@fe2b0000/flash@0",
+};
+#endif

-- 
2.41.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH next v2 5/6] rockchip: remove unused global data ptr
  2023-11-08 17:25 [PATCH next v2 0/6] rockchip: rk3588: add support for detecting U-Boot proper boot medium Quentin Schulz
                   ` (3 preceding siblings ...)
  2023-11-08 17:25 ` [PATCH next v2 4/6] rockchip: rk3588: insert u-boot, spl-boot-device into U-Boot device tree Quentin Schulz
@ 2023-11-08 17:25 ` Quentin Schulz
  2024-01-17  9:32   ` Kever Yang
  2023-11-08 17:25 ` [PATCH next v2 6/6] rockchip: rk3128: remove noop file Quentin Schulz
  5 siblings, 1 reply; 10+ messages in thread
From: Quentin Schulz @ 2023-11-08 17:25 UTC (permalink / raw)
  To: Simon Glass, Philipp Tomsich, Kever Yang
  Cc: Quentin Schulz, u-boot, jonas, Quentin Schulz, heiko

From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

Remove leftover import and global data ptr from files since they aren't
used anymore.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---
 arch/arm/mach-rockchip/board.c         | 3 ---
 arch/arm/mach-rockchip/rk3128/rk3128.c | 3 ---
 arch/arm/mach-rockchip/rk3308/rk3308.c | 3 ---
 arch/arm/mach-rockchip/rk3328/rk3328.c | 3 ---
 arch/arm/mach-rockchip/rk3368/rk3368.c | 3 ---
 arch/arm/mach-rockchip/rk3399/rk3399.c | 3 ---
 arch/arm/mach-rockchip/rk3588/rk3588.c | 2 --
 7 files changed, 20 deletions(-)

diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c
index 57f08e0be0e..6a9d297e6ff 100644
--- a/arch/arm/mach-rockchip/board.c
+++ b/arch/arm/mach-rockchip/board.c
@@ -16,7 +16,6 @@
 #include <syscon.h>
 #include <uuid.h>
 #include <asm/cache.h>
-#include <asm/global_data.h>
 #include <asm/io.h>
 #include <asm/arch-rockchip/boot_mode.h>
 #include <asm/arch-rockchip/clock.h>
@@ -24,8 +23,6 @@
 #include <asm/arch-rockchip/misc.h>
 #include <power/regulator.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 #if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && defined(CONFIG_EFI_PARTITION)
 
 #define DFU_ALT_BUF_LEN			SZ_1K
diff --git a/arch/arm/mach-rockchip/rk3128/rk3128.c b/arch/arm/mach-rockchip/rk3128/rk3128.c
index 01dbfa75cb2..8f8f4951bae 100644
--- a/arch/arm/mach-rockchip/rk3128/rk3128.c
+++ b/arch/arm/mach-rockchip/rk3128/rk3128.c
@@ -4,9 +4,6 @@
  */
 #include <common.h>
 #include <init.h>
-#include <asm/global_data.h>
-
-DECLARE_GLOBAL_DATA_PTR;
 
 int arch_cpu_init(void)
 {
diff --git a/arch/arm/mach-rockchip/rk3308/rk3308.c b/arch/arm/mach-rockchip/rk3308/rk3308.c
index 5763604dc3e..6f121bf1304 100644
--- a/arch/arm/mach-rockchip/rk3308/rk3308.c
+++ b/arch/arm/mach-rockchip/rk3308/rk3308.c
@@ -5,7 +5,6 @@
 #include <common.h>
 #include <init.h>
 #include <malloc.h>
-#include <asm/global_data.h>
 #include <asm/io.h>
 #include <asm/arch/grf_rk3308.h>
 #include <asm/arch-rockchip/bootrom.h>
@@ -14,8 +13,6 @@
 #include <debug_uart.h>
 #include <linux/bitops.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 #include <asm/armv8/mmu.h>
 static struct mm_region rk3308_mem_map[] = {
 	{
diff --git a/arch/arm/mach-rockchip/rk3328/rk3328.c b/arch/arm/mach-rockchip/rk3328/rk3328.c
index de17b886827..02821c9e51d 100644
--- a/arch/arm/mach-rockchip/rk3328/rk3328.c
+++ b/arch/arm/mach-rockchip/rk3328/rk3328.c
@@ -10,11 +10,8 @@
 #include <asm/arch-rockchip/grf_rk3328.h>
 #include <asm/arch-rockchip/uart.h>
 #include <asm/armv8/mmu.h>
-#include <asm/global_data.h>
 #include <asm/io.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 #define CRU_BASE		0xFF440000
 #define GRF_BASE		0xFF100000
 #define UART2_BASE		0xFF130000
diff --git a/arch/arm/mach-rockchip/rk3368/rk3368.c b/arch/arm/mach-rockchip/rk3368/rk3368.c
index d0a6107e5e0..d009b8758e5 100644
--- a/arch/arm/mach-rockchip/rk3368/rk3368.c
+++ b/arch/arm/mach-rockchip/rk3368/rk3368.c
@@ -8,7 +8,6 @@
 #include <init.h>
 #include <syscon.h>
 #include <asm/armv8/mmu.h>
-#include <asm/global_data.h>
 #include <asm/io.h>
 #include <asm/arch-rockchip/bootrom.h>
 #include <asm/arch-rockchip/clock.h>
@@ -18,8 +17,6 @@
 #include <linux/bitops.h>
 #include <linux/delay.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 #define IMEM_BASE                  0xFF8C0000
 
 /* Max MCU's SRAM value is 8K, begin at (IMEM_BASE + 4K) */
diff --git a/arch/arm/mach-rockchip/rk3399/rk3399.c b/arch/arm/mach-rockchip/rk3399/rk3399.c
index 6929de5603c..a13855f5ee2 100644
--- a/arch/arm/mach-rockchip/rk3399/rk3399.c
+++ b/arch/arm/mach-rockchip/rk3399/rk3399.c
@@ -11,7 +11,6 @@
 #include <spl_gpio.h>
 #include <syscon.h>
 #include <asm/armv8/mmu.h>
-#include <asm/global_data.h>
 #include <asm/io.h>
 #include <asm/arch-rockchip/bootrom.h>
 #include <asm/arch-rockchip/clock.h>
@@ -23,8 +22,6 @@
 #include <linux/printk.h>
 #include <power/regulator.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 #define GRF_EMMCCORE_CON11 0xff77f02c
 #define GRF_BASE	0xff770000
 
diff --git a/arch/arm/mach-rockchip/rk3588/rk3588.c b/arch/arm/mach-rockchip/rk3588/rk3588.c
index fde5f281b0a..093b2d1ba88 100644
--- a/arch/arm/mach-rockchip/rk3588/rk3588.c
+++ b/arch/arm/mach-rockchip/rk3588/rk3588.c
@@ -12,8 +12,6 @@
 #include <asm/arch-rockchip/hardware.h>
 #include <asm/arch-rockchip/ioc_rk3588.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 #define FIREWALL_DDR_BASE		0xfe030000
 #define FW_DDR_MST5_REG			0x54
 #define FW_DDR_MST13_REG		0x74

-- 
2.41.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH next v2 6/6] rockchip: rk3128: remove noop file
  2023-11-08 17:25 [PATCH next v2 0/6] rockchip: rk3588: add support for detecting U-Boot proper boot medium Quentin Schulz
                   ` (4 preceding siblings ...)
  2023-11-08 17:25 ` [PATCH next v2 5/6] rockchip: remove unused global data ptr Quentin Schulz
@ 2023-11-08 17:25 ` Quentin Schulz
  2024-01-17  9:21   ` Kever Yang
  5 siblings, 1 reply; 10+ messages in thread
From: Quentin Schulz @ 2023-11-08 17:25 UTC (permalink / raw)
  To: Simon Glass, Philipp Tomsich, Kever Yang
  Cc: Quentin Schulz, u-boot, jonas, Quentin Schulz, heiko

From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

arch_cpu_init is already returning 0 in its weak definition in
common/board_f.c so let's just remove the file entirely since nothing
else is done in it.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---
 arch/arm/mach-rockchip/rk3128/Makefile |  1 -
 arch/arm/mach-rockchip/rk3128/rk3128.c | 13 -------------
 2 files changed, 14 deletions(-)

diff --git a/arch/arm/mach-rockchip/rk3128/Makefile b/arch/arm/mach-rockchip/rk3128/Makefile
index 50e11175423..8df1a60a348 100644
--- a/arch/arm/mach-rockchip/rk3128/Makefile
+++ b/arch/arm/mach-rockchip/rk3128/Makefile
@@ -4,6 +4,5 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-obj-y += rk3128.o
 obj-y += syscon_rk3128.o
 obj-y += clk_rk3128.o
diff --git a/arch/arm/mach-rockchip/rk3128/rk3128.c b/arch/arm/mach-rockchip/rk3128/rk3128.c
deleted file mode 100644
index 8f8f4951bae..00000000000
--- a/arch/arm/mach-rockchip/rk3128/rk3128.c
+++ /dev/null
@@ -1,13 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (c) 2017 Rockchip Electronics Co., Ltd
- */
-#include <common.h>
-#include <init.h>
-
-int arch_cpu_init(void)
-{
-	/* We do some SoC one time setting here. */
-
-	return 0;
-}

-- 
2.41.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH next v2 6/6] rockchip: rk3128: remove noop file
  2023-11-08 17:25 ` [PATCH next v2 6/6] rockchip: rk3128: remove noop file Quentin Schulz
@ 2024-01-17  9:21   ` Kever Yang
  0 siblings, 0 replies; 10+ messages in thread
From: Kever Yang @ 2024-01-17  9:21 UTC (permalink / raw)
  To: Quentin Schulz, Simon Glass, Philipp Tomsich
  Cc: u-boot, jonas, Quentin Schulz, heiko


On 2023/11/9 01:25, Quentin Schulz wrote:
> From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
>
> arch_cpu_init is already returning 0 in its weak definition in
> common/board_f.c so let's just remove the file entirely since nothing
> else is done in it.
>
> Cc: Quentin Schulz <foss+uboot@0leil.net>
> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>

Thanks,
- Kever
> ---
>   arch/arm/mach-rockchip/rk3128/Makefile |  1 -
>   arch/arm/mach-rockchip/rk3128/rk3128.c | 13 -------------
>   2 files changed, 14 deletions(-)
>
> diff --git a/arch/arm/mach-rockchip/rk3128/Makefile b/arch/arm/mach-rockchip/rk3128/Makefile
> index 50e11175423..8df1a60a348 100644
> --- a/arch/arm/mach-rockchip/rk3128/Makefile
> +++ b/arch/arm/mach-rockchip/rk3128/Makefile
> @@ -4,6 +4,5 @@
>   # SPDX-License-Identifier:     GPL-2.0+
>   #
>   
> -obj-y += rk3128.o
>   obj-y += syscon_rk3128.o
>   obj-y += clk_rk3128.o
> diff --git a/arch/arm/mach-rockchip/rk3128/rk3128.c b/arch/arm/mach-rockchip/rk3128/rk3128.c
> deleted file mode 100644
> index 8f8f4951bae..00000000000
> --- a/arch/arm/mach-rockchip/rk3128/rk3128.c
> +++ /dev/null
> @@ -1,13 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0+
> -/*
> - * Copyright (c) 2017 Rockchip Electronics Co., Ltd
> - */
> -#include <common.h>
> -#include <init.h>
> -
> -int arch_cpu_init(void)
> -{
> -	/* We do some SoC one time setting here. */
> -
> -	return 0;
> -}
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH next v2 5/6] rockchip: remove unused global data ptr
  2023-11-08 17:25 ` [PATCH next v2 5/6] rockchip: remove unused global data ptr Quentin Schulz
@ 2024-01-17  9:32   ` Kever Yang
  0 siblings, 0 replies; 10+ messages in thread
From: Kever Yang @ 2024-01-17  9:32 UTC (permalink / raw)
  To: Quentin Schulz, Simon Glass, Philipp Tomsich
  Cc: u-boot, jonas, Quentin Schulz, heiko


On 2023/11/9 01:25, Quentin Schulz wrote:
> From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
>
> Remove leftover import and global data ptr from files since they aren't
> used anymore.
>
> Cc: Quentin Schulz <foss+uboot@0leil.net>
> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>

Thanks,
- Kever
> ---
>   arch/arm/mach-rockchip/board.c         | 3 ---
>   arch/arm/mach-rockchip/rk3128/rk3128.c | 3 ---
>   arch/arm/mach-rockchip/rk3308/rk3308.c | 3 ---
>   arch/arm/mach-rockchip/rk3328/rk3328.c | 3 ---
>   arch/arm/mach-rockchip/rk3368/rk3368.c | 3 ---
>   arch/arm/mach-rockchip/rk3399/rk3399.c | 3 ---
>   arch/arm/mach-rockchip/rk3588/rk3588.c | 2 --
>   7 files changed, 20 deletions(-)
>
> diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c
> index 57f08e0be0e..6a9d297e6ff 100644
> --- a/arch/arm/mach-rockchip/board.c
> +++ b/arch/arm/mach-rockchip/board.c
> @@ -16,7 +16,6 @@
>   #include <syscon.h>
>   #include <uuid.h>
>   #include <asm/cache.h>
> -#include <asm/global_data.h>
>   #include <asm/io.h>
>   #include <asm/arch-rockchip/boot_mode.h>
>   #include <asm/arch-rockchip/clock.h>
> @@ -24,8 +23,6 @@
>   #include <asm/arch-rockchip/misc.h>
>   #include <power/regulator.h>
>   
> -DECLARE_GLOBAL_DATA_PTR;
> -
>   #if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && defined(CONFIG_EFI_PARTITION)
>   
>   #define DFU_ALT_BUF_LEN			SZ_1K
> diff --git a/arch/arm/mach-rockchip/rk3128/rk3128.c b/arch/arm/mach-rockchip/rk3128/rk3128.c
> index 01dbfa75cb2..8f8f4951bae 100644
> --- a/arch/arm/mach-rockchip/rk3128/rk3128.c
> +++ b/arch/arm/mach-rockchip/rk3128/rk3128.c
> @@ -4,9 +4,6 @@
>    */
>   #include <common.h>
>   #include <init.h>
> -#include <asm/global_data.h>
> -
> -DECLARE_GLOBAL_DATA_PTR;
>   
>   int arch_cpu_init(void)
>   {
> diff --git a/arch/arm/mach-rockchip/rk3308/rk3308.c b/arch/arm/mach-rockchip/rk3308/rk3308.c
> index 5763604dc3e..6f121bf1304 100644
> --- a/arch/arm/mach-rockchip/rk3308/rk3308.c
> +++ b/arch/arm/mach-rockchip/rk3308/rk3308.c
> @@ -5,7 +5,6 @@
>   #include <common.h>
>   #include <init.h>
>   #include <malloc.h>
> -#include <asm/global_data.h>
>   #include <asm/io.h>
>   #include <asm/arch/grf_rk3308.h>
>   #include <asm/arch-rockchip/bootrom.h>
> @@ -14,8 +13,6 @@
>   #include <debug_uart.h>
>   #include <linux/bitops.h>
>   
> -DECLARE_GLOBAL_DATA_PTR;
> -
>   #include <asm/armv8/mmu.h>
>   static struct mm_region rk3308_mem_map[] = {
>   	{
> diff --git a/arch/arm/mach-rockchip/rk3328/rk3328.c b/arch/arm/mach-rockchip/rk3328/rk3328.c
> index de17b886827..02821c9e51d 100644
> --- a/arch/arm/mach-rockchip/rk3328/rk3328.c
> +++ b/arch/arm/mach-rockchip/rk3328/rk3328.c
> @@ -10,11 +10,8 @@
>   #include <asm/arch-rockchip/grf_rk3328.h>
>   #include <asm/arch-rockchip/uart.h>
>   #include <asm/armv8/mmu.h>
> -#include <asm/global_data.h>
>   #include <asm/io.h>
>   
> -DECLARE_GLOBAL_DATA_PTR;
> -
>   #define CRU_BASE		0xFF440000
>   #define GRF_BASE		0xFF100000
>   #define UART2_BASE		0xFF130000
> diff --git a/arch/arm/mach-rockchip/rk3368/rk3368.c b/arch/arm/mach-rockchip/rk3368/rk3368.c
> index d0a6107e5e0..d009b8758e5 100644
> --- a/arch/arm/mach-rockchip/rk3368/rk3368.c
> +++ b/arch/arm/mach-rockchip/rk3368/rk3368.c
> @@ -8,7 +8,6 @@
>   #include <init.h>
>   #include <syscon.h>
>   #include <asm/armv8/mmu.h>
> -#include <asm/global_data.h>
>   #include <asm/io.h>
>   #include <asm/arch-rockchip/bootrom.h>
>   #include <asm/arch-rockchip/clock.h>
> @@ -18,8 +17,6 @@
>   #include <linux/bitops.h>
>   #include <linux/delay.h>
>   
> -DECLARE_GLOBAL_DATA_PTR;
> -
>   #define IMEM_BASE                  0xFF8C0000
>   
>   /* Max MCU's SRAM value is 8K, begin at (IMEM_BASE + 4K) */
> diff --git a/arch/arm/mach-rockchip/rk3399/rk3399.c b/arch/arm/mach-rockchip/rk3399/rk3399.c
> index 6929de5603c..a13855f5ee2 100644
> --- a/arch/arm/mach-rockchip/rk3399/rk3399.c
> +++ b/arch/arm/mach-rockchip/rk3399/rk3399.c
> @@ -11,7 +11,6 @@
>   #include <spl_gpio.h>
>   #include <syscon.h>
>   #include <asm/armv8/mmu.h>
> -#include <asm/global_data.h>
>   #include <asm/io.h>
>   #include <asm/arch-rockchip/bootrom.h>
>   #include <asm/arch-rockchip/clock.h>
> @@ -23,8 +22,6 @@
>   #include <linux/printk.h>
>   #include <power/regulator.h>
>   
> -DECLARE_GLOBAL_DATA_PTR;
> -
>   #define GRF_EMMCCORE_CON11 0xff77f02c
>   #define GRF_BASE	0xff770000
>   
> diff --git a/arch/arm/mach-rockchip/rk3588/rk3588.c b/arch/arm/mach-rockchip/rk3588/rk3588.c
> index fde5f281b0a..093b2d1ba88 100644
> --- a/arch/arm/mach-rockchip/rk3588/rk3588.c
> +++ b/arch/arm/mach-rockchip/rk3588/rk3588.c
> @@ -12,8 +12,6 @@
>   #include <asm/arch-rockchip/hardware.h>
>   #include <asm/arch-rockchip/ioc_rk3588.h>
>   
> -DECLARE_GLOBAL_DATA_PTR;
> -
>   #define FIREWALL_DDR_BASE		0xfe030000
>   #define FW_DDR_MST5_REG			0x54
>   #define FW_DDR_MST13_REG		0x74
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH next v2 4/6] rockchip: rk3588: insert u-boot,spl-boot-device into U-Boot device tree
  2023-11-08 17:25 ` [PATCH next v2 4/6] rockchip: rk3588: insert u-boot, spl-boot-device into U-Boot device tree Quentin Schulz
@ 2024-01-17 10:16   ` Kever Yang
  0 siblings, 0 replies; 10+ messages in thread
From: Kever Yang @ 2024-01-17 10:16 UTC (permalink / raw)
  To: Quentin Schulz, Simon Glass, Philipp Tomsich
  Cc: u-boot, jonas, Quentin Schulz, heiko

Hi Quentin,

On 2023/11/9 01:25, Quentin Schulz wrote:
> From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
>
> It is possible to boot U-Boot proper from a different storage medium
> than the one used by the BOOTROM to load the SPL. This information is
> stored in the u-boot,spl-boot-device Device Tree property and is
> accessible from U-Boot proper so that it has knowledge at runtime where
> it was loaded from.
>
> Let's add support for this feature for rk3588 the same way it was done
> for px30 and rk3399.
>
> Cc: Quentin Schulz <foss+uboot@0leil.net>
> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> ---
>   arch/arm/mach-rockchip/rk3588/rk3588.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
>
> diff --git a/arch/arm/mach-rockchip/rk3588/rk3588.c b/arch/arm/mach-rockchip/rk3588/rk3588.c
> index b1f535fad50..fde5f281b0a 100644
> --- a/arch/arm/mach-rockchip/rk3588/rk3588.c
> +++ b/arch/arm/mach-rockchip/rk3588/rk3588.c
> @@ -163,3 +163,11 @@ int arch_cpu_init(void)
>   	return 0;
>   }
>   #endif
> +
> +#if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD)
> +const char * const spl_boot_devices[BOOT_DEVICE_NONE + 1] = {
> +	[BOOT_DEVICE_MMC2] = "/mmc@fe2e0000",
> +	[BOOT_DEVICE_MMC1] = "/mmc@fe2c0000",

This may be wrong because I found that the mmc0 alias is not the same 
for all the boards.

Rockchip platform do set SD card alias as mmc0 before no alias used by 
kernel, and after kernel enable

the use of alias, the different board has different mmc0:

arch/arm/dts/rk3588-rock-5b.dts:        mmc0 = &sdhci;
arch/arm/dts/rk3588-edgeble-neu6b.dtsi:        mmc0 = &sdhci;
arch/arm/dts/rk3588s-orangepi-5.dts:        mmc0 = &sdmmc;
arch/arm/dts/rk3588s-rock-5a.dts:        mmc0 = &sdhci;
arch/arm/dts/rk3588-edgeble-neu6b-io-u-boot.dtsi:        mmc0 = &sdmmc;
arch/arm/dts/rk3588-edgeble-neu6a.dtsi:        mmc0 = &sdhci;
arch/arm/dts/rk3588-edgeble-neu6a-io-u-boot.dtsi:        mmc0 = &sdmmc;
arch/arm/dts/rk3588-quartzpro64.dts:        mmc0 = &sdhci;
arch/arm/dts/rk3588-evb1-v10.dts:        mmc0 = &sdhci;
arch/arm/dts/rk3588-orangepi-5-plus.dts:        mmc0 = &sdhci;
arch/arm/dts/rk3588-nanopc-t6.dts:        mmc0 = &sdhci;


Thanks,
- Kever
> +	[BOOT_DEVICE_SPI] = "/spi@fe2b0000/flash@0",
> +};
> +#endif
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-01-17 10:16 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-08 17:25 [PATCH next v2 0/6] rockchip: rk3588: add support for detecting U-Boot proper boot medium Quentin Schulz
2023-11-08 17:25 ` [PATCH next v2 1/6] rockchip: rk3399: simplify logic for getting SPL boot medium DT node Quentin Schulz
2023-11-08 17:25 ` [PATCH next v2 2/6] rockchip: px30: " Quentin Schulz
2023-11-08 17:25 ` [PATCH next v2 3/6] rockchip: factor out spl_perform_fixups into common spl-boot-order Quentin Schulz
2023-11-08 17:25 ` [PATCH next v2 4/6] rockchip: rk3588: insert u-boot, spl-boot-device into U-Boot device tree Quentin Schulz
2024-01-17 10:16   ` [PATCH next v2 4/6] rockchip: rk3588: insert u-boot,spl-boot-device " Kever Yang
2023-11-08 17:25 ` [PATCH next v2 5/6] rockchip: remove unused global data ptr Quentin Schulz
2024-01-17  9:32   ` Kever Yang
2023-11-08 17:25 ` [PATCH next v2 6/6] rockchip: rk3128: remove noop file Quentin Schulz
2024-01-17  9:21   ` Kever Yang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.