All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] Set /chosen/bootsource for the next boot stage and the OS
@ 2026-11-17 13:51 Wadim Egorov
  2026-11-17 13:51 ` [PATCH v3 1/3] fdt_support: Add /chosen/bootsource fixup Wadim Egorov
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Wadim Egorov @ 2026-11-17 13:51 UTC (permalink / raw)
  To: trini, ilias.apalodimas, sjg, u-boot, quentin.schulz
  Cc: kever.yang, anshuld, aristo.chen, alchark, u-boot, upstream

Changes in v3:
- Drop the check that the device tree has a node at the bootsource path.
- Use log_warning() instead of printf()
- Update doc strings  to match the dropped check
- Collect tags from Quentin

v2: https://lore.kernel.org/u-boot/20261014143328.3135006-1-w.egorov@phytec.de/

Wadim Egorov (3):
  fdt_support: Add /chosen/bootsource fixup
  arm: mach-k3: Set /chosen/bootsource for the next boot stage
  rockchip: Use the generic /chosen/bootsource fixup

 arch/arm/mach-k3/am62x/boot.c           | 26 ++++++++++++++++++
 arch/arm/mach-k3/common.c               |  1 +
 arch/arm/mach-rockchip/spl-boot-order.c | 11 ++++----
 boot/fdt_support.c                      | 35 +++++++++++++++++++++++++
 include/fdt_support.h                   | 25 ++++++++++++++++++
 5 files changed, 93 insertions(+), 5 deletions(-)

-- 
2.48.1


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

* [PATCH v3 1/3] fdt_support: Add /chosen/bootsource fixup
  2026-11-17 13:51 [PATCH v3 0/3] Set /chosen/bootsource for the next boot stage and the OS Wadim Egorov
@ 2026-11-17 13:51 ` Wadim Egorov
  2026-11-26 18:41   ` Quentin Schulz
  2026-11-17 13:51 ` [PATCH v3 2/3] arm: mach-k3: Set /chosen/bootsource for the next boot stage Wadim Egorov
  2026-11-17 13:51 ` [PATCH v3 3/3] rockchip: Use the generic /chosen/bootsource fixup Wadim Egorov
  2 siblings, 1 reply; 8+ messages in thread
From: Wadim Egorov @ 2026-11-17 13:51 UTC (permalink / raw)
  To: trini, ilias.apalodimas, sjg, u-boot, quentin.schulz
  Cc: kever.yang, anshuld, aristo.chen, alchark, u-boot, upstream

Set /chosen/bootsource to the node of the device the BootROM booted
from. Platforms provide the path via bootsource_get_ofpath(). By
default we pass on what a previous boot stage has set in the control
device tree.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
---
 boot/fdt_support.c    | 35 +++++++++++++++++++++++++++++++++++
 include/fdt_support.h | 25 +++++++++++++++++++++++++
 2 files changed, 60 insertions(+)

diff --git a/boot/fdt_support.c b/boot/fdt_support.c
index 2941df55996..0557b4d8506 100644
--- a/boot/fdt_support.c
+++ b/boot/fdt_support.c
@@ -334,6 +334,39 @@ __weak const char *board_fdt_chosen_bootargs(const struct fdt_property *fdt_ba)
 	return env_get("bootargs");
 }
 
+/*
+ * By default pass on what a previous boot stage recorded in the control
+ * device tree of this stage.
+ */
+__weak const char *bootsource_get_ofpath(void)
+{
+	if (CONFIG_IS_ENABLED(OF_REAL))
+		return ofnode_read_chosen_string("bootsource");
+
+	return NULL;
+}
+
+int fdt_fixup_bootsource(void *fdt)
+{
+	const char *path;
+	int chosen, err;
+
+	path = bootsource_get_ofpath();
+	if (!path)
+		return 0;
+
+	chosen = fdt_find_or_add_subnode(fdt, 0, "chosen");
+	if (chosen < 0)
+		return chosen;
+
+	err = fdt_setprop_string(fdt, chosen, "bootsource", path);
+	if (err < 0)
+		log_warning("could not set bootsource %s.\n",
+			    fdt_strerror(err));
+
+	return err;
+}
+
 int fdt_chosen(void *fdt)
 {
 	struct abuf buf = {};
@@ -353,6 +386,8 @@ int fdt_chosen(void *fdt)
 	if (nodeoffset < 0)
 		return nodeoffset;
 
+	fdt_fixup_bootsource(fdt);
+
 	/* if DM_RNG enabled automatically inject kaslr-seed node unless:
 	 * CONFIG_MEASURED_BOOT enabled: as dt modifications break measured boot
 	 * CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT enabled: as that implementation does not use dm yet
diff --git a/include/fdt_support.h b/include/fdt_support.h
index 47b8b63d13d..f287c81e755 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -55,6 +55,31 @@ int fdt_root(void *fdt);
  */
 int fdt_chosen(void *fdt);
 
+/**
+ * bootsource_get_ofpath() - get the path of the node of the boot medium the
+ *                           BootROM loaded the first boot stage from
+ *
+ * Platforms implement this so that /chosen/bootsource can be recorded in the
+ * device tree handed to the next boot stage and to the OS. The default
+ * implementation passes on what a previous stage recorded in the control
+ * device tree of the current stage.
+ *
+ * Return: full node path of the boot medium, or NULL if unknown
+ */
+const char *bootsource_get_ofpath(void);
+
+/**
+ * fdt_fixup_bootsource() - record the BootROM boot medium in /chosen
+ *
+ * @fdt: FDT address in memory
+ *
+ * Sets /chosen/bootsource to the path returned by bootsource_get_ofpath(),
+ * if that path is known. The /chosen node is created if necessary.
+ *
+ * Return: 0 if ok or nothing to do, or -FDT_ERR_... on error
+ */
+int fdt_fixup_bootsource(void *fdt);
+
 /**
  * fdt_initrd() - add initrd information to the FDT before booting the OS
  *
-- 
2.48.1


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

* [PATCH v3 2/3] arm: mach-k3: Set /chosen/bootsource for the next boot stage
  2026-11-17 13:51 [PATCH v3 0/3] Set /chosen/bootsource for the next boot stage and the OS Wadim Egorov
  2026-11-17 13:51 ` [PATCH v3 1/3] fdt_support: Add /chosen/bootsource fixup Wadim Egorov
@ 2026-11-17 13:51 ` Wadim Egorov
  2026-11-26 18:43   ` Quentin Schulz
  2026-11-17 13:51 ` [PATCH v3 3/3] rockchip: Use the generic /chosen/bootsource fixup Wadim Egorov
  2 siblings, 1 reply; 8+ messages in thread
From: Wadim Egorov @ 2026-11-17 13:51 UTC (permalink / raw)
  To: trini, ilias.apalodimas, sjg, u-boot, quentin.schulz
  Cc: kever.yang, anshuld, aristo.chen, alchark, u-boot, upstream

Call fdt_fixup_bootsource() from spl_perform_arch_fixups() so the next
boot stage knows the device the ROM booted from.

Implement bootsource_get_ofpath() for AM62x by mapping the boot device
from get_boot_device() to its device tree node. For OSPI boot the path
points to the flash chip and not the controller, since the flash node
is what the OS maps to an MTD device. All AM62 boards name it flash@0.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
---
 arch/arm/mach-k3/am62x/boot.c | 26 ++++++++++++++++++++++++++
 arch/arm/mach-k3/common.c     |  1 +
 2 files changed, 27 insertions(+)

diff --git a/arch/arm/mach-k3/am62x/boot.c b/arch/arm/mach-k3/am62x/boot.c
index a3a6cda6bdb..db07a550caf 100644
--- a/arch/arm/mach-k3/am62x/boot.c
+++ b/arch/arm/mach-k3/am62x/boot.c
@@ -2,6 +2,7 @@
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/am62_spl.h>
+#include <fdt_support.h>
 
 static u32 __get_backup_bootmedia(u32 devstat)
 {
@@ -102,6 +103,31 @@ u32 get_boot_device(void)
 	return bootmedia;
 }
 
+const char *bootsource_get_ofpath(void)
+{
+	switch (get_boot_device()) {
+	case BOOT_DEVICE_MMC1:
+		return "/bus@f0000/mmc@fa10000";
+	case BOOT_DEVICE_MMC2:
+		return "/bus@f0000/mmc@fa00000";
+	case BOOT_DEVICE_SPI:
+		/*
+		 * The flash chip is described by the board device tree. All
+		 * AM62 boards name it flash@0.
+		 */
+		return "/bus@f0000/bus@fc00000/spi@fc40000/flash@0";
+	case BOOT_DEVICE_ETHERNET:
+		return "/bus@f0000/ethernet@8000000/ethernet-ports/port@1";
+	case BOOT_DEVICE_UART:
+		return "/bus@f0000/serial@2800000";
+	case BOOT_DEVICE_USB:
+	case BOOT_DEVICE_DFU:
+		return "/bus@f0000/dwc3-usb@f900000/usb@31000000";
+	}
+
+	return NULL;
+}
+
 const char *get_reset_reason(void)
 {
 	u32 reset_reason = readl(CTRLMMR_MCU_RST_SRC);
diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
index 6e382efdb3b..c7fd7b4f44c 100644
--- a/arch/arm/mach-k3/common.c
+++ b/arch/arm/mach-k3/common.c
@@ -570,6 +570,7 @@ void spl_perform_arch_fixups(struct spl_image_info *spl_image)
 		return;
 
 	fdt_fixup_reserved(fdt);
+	fdt_fixup_bootsource(fdt);
 
 	if (IS_ENABLED(CONFIG_SPL_OS_BOOT))
 		k3_falcon_fdt_fixup(fdt);
-- 
2.48.1


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

* [PATCH v3 3/3] rockchip: Use the generic /chosen/bootsource fixup
  2026-11-17 13:51 [PATCH v3 0/3] Set /chosen/bootsource for the next boot stage and the OS Wadim Egorov
  2026-11-17 13:51 ` [PATCH v3 1/3] fdt_support: Add /chosen/bootsource fixup Wadim Egorov
  2026-11-17 13:51 ` [PATCH v3 2/3] arm: mach-k3: Set /chosen/bootsource for the next boot stage Wadim Egorov
@ 2026-11-17 13:51 ` Wadim Egorov
  2 siblings, 0 replies; 8+ messages in thread
From: Wadim Egorov @ 2026-11-17 13:51 UTC (permalink / raw)
  To: trini, ilias.apalodimas, sjg, u-boot, quentin.schulz
  Cc: kever.yang, anshuld, aristo.chen, alchark, u-boot, upstream

Implement bootsource_get_ofpath() on top of board_spl_was_booted_from()
and use fdt_fixup_bootsource() in spl_perform_arch_fixups(). With this
U-Boot proper also passes the path on to the OS.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Tested-by: Quentin Schulz <quentin.schulz@cherry.de>
---
 arch/arm/mach-rockchip/spl-boot-order.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-rockchip/spl-boot-order.c b/arch/arm/mach-rockchip/spl-boot-order.c
index d2dd5e10935..1a2fdc420d9 100644
--- a/arch/arm/mach-rockchip/spl-boot-order.c
+++ b/arch/arm/mach-rockchip/spl-boot-order.c
@@ -262,9 +262,13 @@ int spl_decode_boot_device(u32 boot_device, char *buf, size_t buflen)
 #endif
 }
 
+const char *bootsource_get_ofpath(void)
+{
+	return board_spl_was_booted_from();
+}
+
 void spl_perform_arch_fixups(struct spl_image_info *spl_image)
 {
-	const char *bootrom_ofpath = board_spl_was_booted_from();
 	void *blob = spl_image_fdt_addr(spl_image);
 	char boot_ofpath[512];
 	int chosen, ret;
@@ -293,9 +297,6 @@ void spl_perform_arch_fixups(struct spl_image_info *spl_image)
 	 * Inject the ofpath of the device the BootROM loaded the very first
 	 * stage from into the FDT.
 	 */
-	if (!bootrom_ofpath)
-		pr_err("%s: could not map BootROM boot device to ofpath\n", __func__);
-	else
-		fdt_setprop_string(blob, chosen, "bootsource", bootrom_ofpath);
+	fdt_fixup_bootsource(blob);
 }
 #endif
-- 
2.48.1


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

* Re: [PATCH v3 1/3] fdt_support: Add /chosen/bootsource fixup
  2026-11-17 13:51 ` [PATCH v3 1/3] fdt_support: Add /chosen/bootsource fixup Wadim Egorov
@ 2026-11-26 18:41   ` Quentin Schulz
  0 siblings, 0 replies; 8+ messages in thread
From: Quentin Schulz @ 2026-11-26 18:41 UTC (permalink / raw)
  To: Wadim Egorov, trini, ilias.apalodimas, quentin.schulz
  Cc: kever.yang, anshuld, aristo.chen, alchark, u-boot, upstream

Hi Wadim,

On 11/17/26 2:51 PM, Wadim Egorov wrote:
> Set /chosen/bootsource to the node of the device the BootROM booted
> from. Platforms provide the path via bootsource_get_ofpath(). By
> default we pass on what a previous boot stage has set in the control
> device tree.
> 
> Signed-off-by: Wadim Egorov <w.egorov@phytec.de>

Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>

Thanks!
Quentin

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

* Re: [PATCH v3 2/3] arm: mach-k3: Set /chosen/bootsource for the next boot stage
  2026-11-17 13:51 ` [PATCH v3 2/3] arm: mach-k3: Set /chosen/bootsource for the next boot stage Wadim Egorov
@ 2026-11-26 18:43   ` Quentin Schulz
  2026-11-30 23:14     ` Tom Rini
  0 siblings, 1 reply; 8+ messages in thread
From: Quentin Schulz @ 2026-11-26 18:43 UTC (permalink / raw)
  To: Wadim Egorov, trini, ilias.apalodimas, sjg, quentin.schulz
  Cc: kever.yang, anshuld, aristo.chen, alchark, u-boot, upstream

Hi Tom,

You seem to be the custodian for the two files changed here, can you 
please give this a review?

I'm fine picking up patches 1 and 3 independently, and patch 2 lives its 
own life (possibly with more versions) or wait for your review for patch 
2 and take everything at once, up to you.

Thanks!
Quentin

On 11/17/26 2:51 PM, Wadim Egorov wrote:
> Call fdt_fixup_bootsource() from spl_perform_arch_fixups() so the next
> boot stage knows the device the ROM booted from.
> 
> Implement bootsource_get_ofpath() for AM62x by mapping the boot device
> from get_boot_device() to its device tree node. For OSPI boot the path
> points to the flash chip and not the controller, since the flash node
> is what the OS maps to an MTD device. All AM62 boards name it flash@0.
> 
> Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
> ---
>   arch/arm/mach-k3/am62x/boot.c | 26 ++++++++++++++++++++++++++
>   arch/arm/mach-k3/common.c     |  1 +
>   2 files changed, 27 insertions(+)
> 
> diff --git a/arch/arm/mach-k3/am62x/boot.c b/arch/arm/mach-k3/am62x/boot.c
> index a3a6cda6bdb..db07a550caf 100644
> --- a/arch/arm/mach-k3/am62x/boot.c
> +++ b/arch/arm/mach-k3/am62x/boot.c
> @@ -2,6 +2,7 @@
>   #include <asm/io.h>
>   #include <asm/arch/hardware.h>
>   #include <asm/arch/am62_spl.h>
> +#include <fdt_support.h>
>   
>   static u32 __get_backup_bootmedia(u32 devstat)
>   {
> @@ -102,6 +103,31 @@ u32 get_boot_device(void)
>   	return bootmedia;
>   }
>   
> +const char *bootsource_get_ofpath(void)
> +{
> +	switch (get_boot_device()) {
> +	case BOOT_DEVICE_MMC1:
> +		return "/bus@f0000/mmc@fa10000";
> +	case BOOT_DEVICE_MMC2:
> +		return "/bus@f0000/mmc@fa00000";
> +	case BOOT_DEVICE_SPI:
> +		/*
> +		 * The flash chip is described by the board device tree. All
> +		 * AM62 boards name it flash@0.
> +		 */
> +		return "/bus@f0000/bus@fc00000/spi@fc40000/flash@0";
> +	case BOOT_DEVICE_ETHERNET:
> +		return "/bus@f0000/ethernet@8000000/ethernet-ports/port@1";
> +	case BOOT_DEVICE_UART:
> +		return "/bus@f0000/serial@2800000";
> +	case BOOT_DEVICE_USB:
> +	case BOOT_DEVICE_DFU:
> +		return "/bus@f0000/dwc3-usb@f900000/usb@31000000";
> +	}
> +
> +	return NULL;
> +}
> +
>   const char *get_reset_reason(void)
>   {
>   	u32 reset_reason = readl(CTRLMMR_MCU_RST_SRC);
> diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
> index 6e382efdb3b..c7fd7b4f44c 100644
> --- a/arch/arm/mach-k3/common.c
> +++ b/arch/arm/mach-k3/common.c
> @@ -570,6 +570,7 @@ void spl_perform_arch_fixups(struct spl_image_info *spl_image)
>   		return;
>   
>   	fdt_fixup_reserved(fdt);
> +	fdt_fixup_bootsource(fdt);
>   
>   	if (IS_ENABLED(CONFIG_SPL_OS_BOOT))
>   		k3_falcon_fdt_fixup(fdt);


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

* Re: [PATCH v3 2/3] arm: mach-k3: Set /chosen/bootsource for the next boot stage
  2026-11-26 18:43   ` Quentin Schulz
@ 2026-11-30 23:14     ` Tom Rini
  2026-12-03  6:16       ` Anshul Dalal
  0 siblings, 1 reply; 8+ messages in thread
From: Tom Rini @ 2026-11-30 23:14 UTC (permalink / raw)
  To: Quentin Schulz, anshuld
  Cc: Wadim Egorov, ilias.apalodimas, quentin.schulz, kever.yang,
	aristo.chen, alchark, u-boot, upstream

[-- Attachment #1: Type: text/plain, Size: 3145 bytes --]

On Thu, Nov 26, 2026 at 07:43:48PM +0100, Quentin Schulz wrote:

> Hi Tom,
> 
> You seem to be the custodian for the two files changed here, can you please
> give this a review?
> 
> I'm fine picking up patches 1 and 3 independently, and patch 2 lives its own
> life (possibly with more versions) or wait for your review for patch 2 and
> take everything at once, up to you.
> 
> Thanks!
> Quentin
> 
> On 11/17/26 2:51 PM, Wadim Egorov wrote:
> > Call fdt_fixup_bootsource() from spl_perform_arch_fixups() so the next
> > boot stage knows the device the ROM booted from.
> > 
> > Implement bootsource_get_ofpath() for AM62x by mapping the boot device
> > from get_boot_device() to its device tree node. For OSPI boot the path
> > points to the flash chip and not the controller, since the flash node
> > is what the OS maps to an MTD device. All AM62 boards name it flash@0.
> > 
> > Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
> > ---
> >   arch/arm/mach-k3/am62x/boot.c | 26 ++++++++++++++++++++++++++
> >   arch/arm/mach-k3/common.c     |  1 +
> >   2 files changed, 27 insertions(+)
> > 
> > diff --git a/arch/arm/mach-k3/am62x/boot.c b/arch/arm/mach-k3/am62x/boot.c
> > index a3a6cda6bdb..db07a550caf 100644
> > --- a/arch/arm/mach-k3/am62x/boot.c
> > +++ b/arch/arm/mach-k3/am62x/boot.c
> > @@ -2,6 +2,7 @@
> >   #include <asm/io.h>
> >   #include <asm/arch/hardware.h>
> >   #include <asm/arch/am62_spl.h>
> > +#include <fdt_support.h>
> >   static u32 __get_backup_bootmedia(u32 devstat)
> >   {
> > @@ -102,6 +103,31 @@ u32 get_boot_device(void)
> >   	return bootmedia;
> >   }
> > +const char *bootsource_get_ofpath(void)
> > +{
> > +	switch (get_boot_device()) {
> > +	case BOOT_DEVICE_MMC1:
> > +		return "/bus@f0000/mmc@fa10000";
> > +	case BOOT_DEVICE_MMC2:
> > +		return "/bus@f0000/mmc@fa00000";
> > +	case BOOT_DEVICE_SPI:
> > +		/*
> > +		 * The flash chip is described by the board device tree. All
> > +		 * AM62 boards name it flash@0.
> > +		 */
> > +		return "/bus@f0000/bus@fc00000/spi@fc40000/flash@0";
> > +	case BOOT_DEVICE_ETHERNET:
> > +		return "/bus@f0000/ethernet@8000000/ethernet-ports/port@1";
> > +	case BOOT_DEVICE_UART:
> > +		return "/bus@f0000/serial@2800000";
> > +	case BOOT_DEVICE_USB:
> > +	case BOOT_DEVICE_DFU:
> > +		return "/bus@f0000/dwc3-usb@f900000/usb@31000000";
> > +	}
> > +
> > +	return NULL;
> > +}
> > +
> >   const char *get_reset_reason(void)
> >   {
> >   	u32 reset_reason = readl(CTRLMMR_MCU_RST_SRC);
> > diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
> > index 6e382efdb3b..c7fd7b4f44c 100644
> > --- a/arch/arm/mach-k3/common.c
> > +++ b/arch/arm/mach-k3/common.c
> > @@ -570,6 +570,7 @@ void spl_perform_arch_fixups(struct spl_image_info *spl_image)
> >   		return;
> >   	fdt_fixup_reserved(fdt);
> > +	fdt_fixup_bootsource(fdt);
> >   	if (IS_ENABLED(CONFIG_SPL_OS_BOOT))
> >   		k3_falcon_fdt_fixup(fdt);

Seems reasonable to me, Anshul? And them I'll pick this up Quentin, I
just wanted to be sure you were happy with it, given your previous
feedback.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH v3 2/3] arm: mach-k3: Set /chosen/bootsource for the next boot stage
  2026-11-30 23:14     ` Tom Rini
@ 2026-12-03  6:16       ` Anshul Dalal
  0 siblings, 0 replies; 8+ messages in thread
From: Anshul Dalal @ 2026-12-03  6:16 UTC (permalink / raw)
  To: Tom Rini, Quentin Schulz, anshuld
  Cc: Wadim Egorov, ilias.apalodimas, quentin.schulz, kever.yang,
	aristo.chen, alchark, u-boot, upstream

On Tue Dec 1, 2026 at 4:44 AM IST, Tom Rini wrote:
> On Thu, Nov 26, 2026 at 07:43:48PM +0100, Quentin Schulz wrote:
>
>> Hi Tom,
>> 
>> You seem to be the custodian for the two files changed here, can you please
>> give this a review?
>> 
>> I'm fine picking up patches 1 and 3 independently, and patch 2 lives its own
>> life (possibly with more versions) or wait for your review for patch 2 and
>> take everything at once, up to you.
>> 
>> Thanks!
>> Quentin
>> 
>> On 11/17/26 2:51 PM, Wadim Egorov wrote:
>> > Call fdt_fixup_bootsource() from spl_perform_arch_fixups() so the next
>> > boot stage knows the device the ROM booted from.
>> > 
>> > Implement bootsource_get_ofpath() for AM62x by mapping the boot device
>> > from get_boot_device() to its device tree node. For OSPI boot the path
>> > points to the flash chip and not the controller, since the flash node
>> > is what the OS maps to an MTD device. All AM62 boards name it flash@0.
>> > 
>> > Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
>> > ---
>> >   arch/arm/mach-k3/am62x/boot.c | 26 ++++++++++++++++++++++++++
>> >   arch/arm/mach-k3/common.c     |  1 +
>> >   2 files changed, 27 insertions(+)
>> > 
>> > diff --git a/arch/arm/mach-k3/am62x/boot.c b/arch/arm/mach-k3/am62x/boot.c
>> > index a3a6cda6bdb..db07a550caf 100644
>> > --- a/arch/arm/mach-k3/am62x/boot.c
>> > +++ b/arch/arm/mach-k3/am62x/boot.c
>> > @@ -2,6 +2,7 @@
>> >   #include <asm/io.h>
>> >   #include <asm/arch/hardware.h>
>> >   #include <asm/arch/am62_spl.h>
>> > +#include <fdt_support.h>
>> >   static u32 __get_backup_bootmedia(u32 devstat)
>> >   {
>> > @@ -102,6 +103,31 @@ u32 get_boot_device(void)
>> >   	return bootmedia;
>> >   }
>> > +const char *bootsource_get_ofpath(void)
>> > +{
>> > +	switch (get_boot_device()) {
>> > +	case BOOT_DEVICE_MMC1:
>> > +		return "/bus@f0000/mmc@fa10000";
>> > +	case BOOT_DEVICE_MMC2:
>> > +		return "/bus@f0000/mmc@fa00000";
>> > +	case BOOT_DEVICE_SPI:
>> > +		/*
>> > +		 * The flash chip is described by the board device tree. All
>> > +		 * AM62 boards name it flash@0.
>> > +		 */
>> > +		return "/bus@f0000/bus@fc00000/spi@fc40000/flash@0";
>> > +	case BOOT_DEVICE_ETHERNET:
>> > +		return "/bus@f0000/ethernet@8000000/ethernet-ports/port@1";
>> > +	case BOOT_DEVICE_UART:
>> > +		return "/bus@f0000/serial@2800000";
>> > +	case BOOT_DEVICE_USB:
>> > +	case BOOT_DEVICE_DFU:
>> > +		return "/bus@f0000/dwc3-usb@f900000/usb@31000000";
>> > +	}
>> > +
>> > +	return NULL;
>> > +}
>> > +
>> >   const char *get_reset_reason(void)
>> >   {
>> >   	u32 reset_reason = readl(CTRLMMR_MCU_RST_SRC);
>> > diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
>> > index 6e382efdb3b..c7fd7b4f44c 100644
>> > --- a/arch/arm/mach-k3/common.c
>> > +++ b/arch/arm/mach-k3/common.c
>> > @@ -570,6 +570,7 @@ void spl_perform_arch_fixups(struct spl_image_info *spl_image)
>> >   		return;
>> >   	fdt_fixup_reserved(fdt);
>> > +	fdt_fixup_bootsource(fdt);
>> >   	if (IS_ENABLED(CONFIG_SPL_OS_BOOT))
>> >   		k3_falcon_fdt_fixup(fdt);
>
> Seems reasonable to me, Anshul? And them I'll pick this up Quentin, I
> just wanted to be sure you were happy with it, given your previous
> feedback.

Hi Tom, the patch looks good to me.

Reviewed-by: Anshul Dalal <anshuld@ti.com>

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

end of thread, other threads:[~2026-12-03  6:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-17 13:51 [PATCH v3 0/3] Set /chosen/bootsource for the next boot stage and the OS Wadim Egorov
2026-11-17 13:51 ` [PATCH v3 1/3] fdt_support: Add /chosen/bootsource fixup Wadim Egorov
2026-11-26 18:41   ` Quentin Schulz
2026-11-17 13:51 ` [PATCH v3 2/3] arm: mach-k3: Set /chosen/bootsource for the next boot stage Wadim Egorov
2026-11-26 18:43   ` Quentin Schulz
2026-11-30 23:14     ` Tom Rini
2026-12-03  6:16       ` Anshul Dalal
2026-11-17 13:51 ` [PATCH v3 3/3] rockchip: Use the generic /chosen/bootsource fixup Wadim Egorov

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.