* [PATCH] mach-k3: move k3_falcon_fdt_fixup out of r5/common.c
@ 2026-03-12 12:04 Anshul Dalal
2026-03-20 12:15 ` Anshul Dalal
2026-03-25 23:05 ` Tom Rini
0 siblings, 2 replies; 3+ messages in thread
From: Anshul Dalal @ 2026-03-12 12:04 UTC (permalink / raw)
To: u-boot
Cc: Tom Rini, Dhruva Gole, Aniket Limaye, Bryan Brattlof, Vignesh R,
Beleswar Padhi, Chintan Vankar, Wadim Egorov, Moteen Shah,
Neha Malcom Francis, Andrew Davis, Mattijs Korpershoek,
Simon Glass, Nishanth Menon, Anshul Dalal
k3_falcon_fdt_fixup is used to perform fdt fixups at runtime in falcon
mode such as adding bootargs. Currently the function is only accessible
to the R5 SPL but could be useful for A53 SPL based falcon mode setups
as well.
Therefore this patch moves the function from r5/common.c to common.c.
Signed-off-by: Anshul Dalal <anshuld@ti.com>
---
arch/arm/mach-k3/common.c | 80 ++++++++++++++++++++++++++++++++++++++++++++
arch/arm/mach-k3/common.h | 5 ++-
arch/arm/mach-k3/r5/common.c | 77 ------------------------------------------
3 files changed, 84 insertions(+), 78 deletions(-)
diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
index 2f3df5519c5..b0a75988714 100644
--- a/arch/arm/mach-k3/common.c
+++ b/arch/arm/mach-k3/common.c
@@ -457,6 +457,83 @@ static __maybe_unused void k3_dma_remove(void)
pr_warn("DMA Device not found (err=%d)\n", rc);
}
+static int k3_falcon_fdt_add_bootargs(void *fdt)
+{
+ struct disk_partition info;
+ struct blk_desc *dev_desc;
+ char bootmedia[32];
+ char bootpart[32];
+ char str[256];
+ int ret;
+
+ strlcpy(bootmedia, env_get("boot"), sizeof(bootmedia));
+ strlcpy(bootpart, env_get("bootpart"), sizeof(bootpart));
+ ret = blk_get_device_part_str(bootmedia, bootpart, &dev_desc, &info, 0);
+ if (ret < 0) {
+ printf("%s: Failed to get part details for %s %s [%d]\n",
+ __func__, bootmedia, bootpart, ret);
+ return ret;
+ }
+
+ if (!CONFIG_IS_ENABLED(PARTITION_UUIDS)) {
+ printf("ERROR: Failed to find rootfs PARTUUID\n");
+ printf("%s: CONFIG_SPL_PARTITION_UUIDS not enabled\n",
+ __func__);
+ return -EOPNOTSUPP;
+ }
+
+ snprintf(str, sizeof(str), "console=%s root=PARTUUID=%s rootwait",
+ env_get("console"), disk_partition_uuid(&info));
+
+ ret = fdt_find_and_setprop(fdt, "/chosen", "bootargs", str,
+ strlen(str) + 1, 1);
+ if (ret) {
+ printf("%s: Could not set bootargs: %s\n", __func__,
+ fdt_strerror(ret));
+ return ret;
+ }
+
+ debug("%s: Set bootargs to: %s\n", __func__, str);
+ return 0;
+}
+
+int k3_falcon_fdt_fixup(void *fdt)
+{
+ int ret;
+
+ if (!fdt)
+ return -EINVAL;
+
+ fdt_set_totalsize(fdt, fdt_totalsize(fdt) + CONFIG_SYS_FDT_PAD);
+
+ if (fdt_path_offset(fdt, "/chosen/bootargs") < 0) {
+ ret = k3_falcon_fdt_add_bootargs(fdt);
+
+ if (ret)
+ return ret;
+ }
+
+ if (IS_ENABLED(CONFIG_OF_BOARD_SETUP)) {
+ ret = ft_board_setup(fdt, gd->bd);
+ if (ret) {
+ printf("%s: Failed in board setup: %s\n", __func__,
+ fdt_strerror(ret));
+ return ret;
+ }
+ }
+
+ if (IS_ENABLED(CONFIG_OF_SYSTEM_SETUP)) {
+ ret = ft_system_setup(fdt, gd->bd);
+ if (ret) {
+ printf("%s: Failed in system setup: %s\n", __func__,
+ fdt_strerror(ret));
+ return ret;
+ }
+ }
+
+ return 0;
+}
+
void spl_perform_arch_fixups(struct spl_image_info *spl_image)
{
void *fdt = spl_image_fdt_addr(spl_image);
@@ -465,6 +542,9 @@ void spl_perform_arch_fixups(struct spl_image_info *spl_image)
return;
fdt_fixup_reserved(fdt);
+
+ if (IS_ENABLED(CONFIG_SPL_OS_BOOT))
+ k3_falcon_fdt_fixup(fdt);
}
void spl_board_prepare_for_boot(void)
diff --git a/arch/arm/mach-k3/common.h b/arch/arm/mach-k3/common.h
index e970076d08e..466ad22f895 100644
--- a/arch/arm/mach-k3/common.h
+++ b/arch/arm/mach-k3/common.h
@@ -61,10 +61,13 @@ void do_board_detect(void);
void ti_secure_image_check_binary(void **p_image, size_t *p_size);
int shutdown_mcu_r5_core1(void);
-#if IS_ENABLED(CONFIG_SPL_OS_BOOT_SECURE) && !IS_ENABLED(CONFIG_ARM64)
+#if IS_ENABLED(CONFIG_SPL_OS_BOOT_SECURE)
+int k3_falcon_fdt_fixup(void *fdt);
+#if !IS_ENABLED(CONFIG_ARM64)
int k3_r5_falcon_bootmode(void);
int k3_r5_falcon_prep(void);
#endif
+#endif
#if (IS_ENABLED(CONFIG_K3_QOS))
void setup_qos(void);
diff --git a/arch/arm/mach-k3/r5/common.c b/arch/arm/mach-k3/r5/common.c
index 03638366046..484d96f9536 100644
--- a/arch/arm/mach-k3/r5/common.c
+++ b/arch/arm/mach-k3/r5/common.c
@@ -406,83 +406,6 @@ int k3_r5_falcon_bootmode(void)
return BOOT_DEVICE_NOBOOT;
}
-static int k3_falcon_fdt_add_bootargs(void *fdt)
-{
- struct disk_partition info;
- struct blk_desc *dev_desc;
- char bootmedia[32];
- char bootpart[32];
- char str[256];
- int ret;
-
- strlcpy(bootmedia, env_get("boot"), sizeof(bootmedia));
- strlcpy(bootpart, env_get("bootpart"), sizeof(bootpart));
- ret = blk_get_device_part_str(bootmedia, bootpart, &dev_desc, &info, 0);
- if (ret < 0) {
- printf("%s: Failed to get part details for %s %s [%d]\n",
- __func__, bootmedia, bootpart, ret);
- return ret;
- }
-
- if (!CONFIG_IS_ENABLED(PARTITION_UUIDS)) {
- printf("ERROR: Failed to find rootfs PARTUUID\n");
- printf("%s: CONFIG_SPL_PARTITION_UUIDS not enabled\n",
- __func__);
- return -EOPNOTSUPP;
- }
-
- snprintf(str, sizeof(str), "console=%s root=PARTUUID=%s rootwait",
- env_get("console"), disk_partition_uuid(&info));
-
- ret = fdt_find_and_setprop(fdt, "/chosen", "bootargs", str,
- strlen(str) + 1, 1);
- if (ret) {
- printf("%s: Could not set bootargs: %s\n", __func__,
- fdt_strerror(ret));
- return ret;
- }
-
- debug("%s: Set bootargs to: %s\n", __func__, str);
- return 0;
-}
-
-static int k3_falcon_fdt_fixup(void *fdt)
-{
- int ret;
-
- if (!fdt)
- return -EINVAL;
-
- fdt_set_totalsize(fdt, fdt_totalsize(fdt) + CONFIG_SYS_FDT_PAD);
-
- if (fdt_path_offset(fdt, "/chosen/bootargs") < 0) {
- ret = k3_falcon_fdt_add_bootargs(fdt);
-
- if (ret)
- return ret;
- }
-
- if (IS_ENABLED(CONFIG_OF_BOARD_SETUP)) {
- ret = ft_board_setup(fdt, gd->bd);
- if (ret) {
- printf("%s: Failed in board setup: %s\n", __func__,
- fdt_strerror(ret));
- return ret;
- }
- }
-
- if (IS_ENABLED(CONFIG_OF_SYSTEM_SETUP)) {
- ret = ft_system_setup(fdt, gd->bd);
- if (ret) {
- printf("%s: Failed in system setup: %s\n", __func__,
- fdt_strerror(ret));
- return ret;
- }
- }
-
- return 0;
-}
-
int k3_r5_falcon_prep(void)
{
struct spl_image_loader *loader, *drv;
---
base-commit: 8bc2a5196c1c0bb5dbdaca073323da0015a0de37
change-id: 20260312-move_falcon_fixups_to_common-34b602114608
Best regards,
--
Anshul Dalal <anshuld@ti.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mach-k3: move k3_falcon_fdt_fixup out of r5/common.c
2026-03-12 12:04 [PATCH] mach-k3: move k3_falcon_fdt_fixup out of r5/common.c Anshul Dalal
@ 2026-03-20 12:15 ` Anshul Dalal
2026-03-25 23:05 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Anshul Dalal @ 2026-03-20 12:15 UTC (permalink / raw)
To: Anshul Dalal, u-boot
Cc: Tom Rini, Dhruva Gole, Aniket Limaye, Bryan Brattlof, Vignesh R,
Beleswar Padhi, Chintan Vankar, Wadim Egorov, Moteen Shah,
Neha Malcom Francis, Andrew Davis, Mattijs Korpershoek,
Simon Glass, Nishanth Menon
On Thu Mar 12, 2026 at 5:34 PM IST, Anshul Dalal wrote:
> k3_falcon_fdt_fixup is used to perform fdt fixups at runtime in falcon
> mode such as adding bootargs. Currently the function is only accessible
> to the R5 SPL but could be useful for A53 SPL based falcon mode setups
> as well.
>
> Therefore this patch moves the function from r5/common.c to common.c.
>
Btw for testing purposes, I had used the following config fragment with
rootfs from the default tisdk image on am62x[1]:
# Enable falcon mode
CONFIG_SPL_OS_BOOT=y
CONFIG_SPL_OS_BOOT_SECURE=y
# We use envs for setting bootargs
CONFIG_SPL_ENV_SUPPORT=y
# Allows for the SPL to detect UUID for kernel's rootfs
CONFIG_SPL_PARTITION_UUIDS=y
# Perform FDT fixups from SPL
CONFIG_OF_SYSTEM_SETUP=y
# We use the rootfs (i.e partition 2) for booting which is ext4 not FAT
CONFIG_SYS_MMCSD_FS_BOOT=y
CONFIG_SYS_MMCSD_FS_BOOT_PARTITION=2
CONFIG_SPL_FS_EXT4=y
CONFIG_SPL_FS_LOAD_KERNEL_NAME="boot/fitImage"
CONFIG_SPL_LOAD_FIT=y
# Used as the 2MiB aligned load address for kernel
CONFIG_SPL_HAS_LOAD_FIT_ADDRESS=y
CONFIG_SYS_LOAD_ADDR=0x82000000
CONFIG_SPL_STACK_R_ADDR=0x88000000
CONFIG_SPL_LOAD_FIT_ADDRESS=0x82000000
CONFIG_SPL_PAYLOAD_ARGS_ADDR=0x88000000
CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2700000
CONFIG_SPL_GZIP=y
# Disable all unsupported boot media to save space
# CONFIG_SPL_SYS_MMCSD_RAW_MODE is not set
# CONFIG_SPL_SPI_FLASH_SUPPORT is not set
# CONFIG_SPL_YMODEM_SUPPORT is not set
# CONFIG_SUPPORT_EMMC_BOOT is not set
# CONFIG_SPL_NAND_SUPPORT is not set
# CONFIG_SPL_NOR_SUPPORT is not set
# CONFIG_SPL_RAM_DEVICE is not set
# CONFIG_SPL_FS_FAT is not set
I was wondering if it makes sense to add this config fragment to the
tree along with documentation for falcon mode from A53 SPL for K3
platforms?
[1]: https://www.ti.com/tool/PROCESSOR-SDK-AM62X
> Signed-off-by: Anshul Dalal <anshuld@ti.com>
> ---
> arch/arm/mach-k3/common.c | 80 ++++++++++++++++++++++++++++++++++++++++++++
> arch/arm/mach-k3/common.h | 5 ++-
> arch/arm/mach-k3/r5/common.c | 77 ------------------------------------------
> 3 files changed, 84 insertions(+), 78 deletions(-)
>
> diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
> index 2f3df5519c5..b0a75988714 100644
> --- a/arch/arm/mach-k3/common.c
> +++ b/arch/arm/mach-k3/common.c
> @@ -457,6 +457,83 @@ static __maybe_unused void k3_dma_remove(void)
> pr_warn("DMA Device not found (err=%d)\n", rc);
> }
>
> +static int k3_falcon_fdt_add_bootargs(void *fdt)
> +{
> + struct disk_partition info;
> + struct blk_desc *dev_desc;
> + char bootmedia[32];
> + char bootpart[32];
> + char str[256];
> + int ret;
> +
> + strlcpy(bootmedia, env_get("boot"), sizeof(bootmedia));
> + strlcpy(bootpart, env_get("bootpart"), sizeof(bootpart));
> + ret = blk_get_device_part_str(bootmedia, bootpart, &dev_desc, &info, 0);
> + if (ret < 0) {
> + printf("%s: Failed to get part details for %s %s [%d]\n",
> + __func__, bootmedia, bootpart, ret);
> + return ret;
> + }
> +
> + if (!CONFIG_IS_ENABLED(PARTITION_UUIDS)) {
> + printf("ERROR: Failed to find rootfs PARTUUID\n");
> + printf("%s: CONFIG_SPL_PARTITION_UUIDS not enabled\n",
> + __func__);
> + return -EOPNOTSUPP;
> + }
> +
> + snprintf(str, sizeof(str), "console=%s root=PARTUUID=%s rootwait",
> + env_get("console"), disk_partition_uuid(&info));
> +
> + ret = fdt_find_and_setprop(fdt, "/chosen", "bootargs", str,
> + strlen(str) + 1, 1);
> + if (ret) {
> + printf("%s: Could not set bootargs: %s\n", __func__,
> + fdt_strerror(ret));
> + return ret;
> + }
> +
> + debug("%s: Set bootargs to: %s\n", __func__, str);
> + return 0;
> +}
> +
> +int k3_falcon_fdt_fixup(void *fdt)
> +{
> + int ret;
> +
> + if (!fdt)
> + return -EINVAL;
> +
> + fdt_set_totalsize(fdt, fdt_totalsize(fdt) + CONFIG_SYS_FDT_PAD);
> +
> + if (fdt_path_offset(fdt, "/chosen/bootargs") < 0) {
> + ret = k3_falcon_fdt_add_bootargs(fdt);
> +
> + if (ret)
> + return ret;
> + }
> +
> + if (IS_ENABLED(CONFIG_OF_BOARD_SETUP)) {
> + ret = ft_board_setup(fdt, gd->bd);
> + if (ret) {
> + printf("%s: Failed in board setup: %s\n", __func__,
> + fdt_strerror(ret));
> + return ret;
> + }
> + }
> +
> + if (IS_ENABLED(CONFIG_OF_SYSTEM_SETUP)) {
> + ret = ft_system_setup(fdt, gd->bd);
> + if (ret) {
> + printf("%s: Failed in system setup: %s\n", __func__,
> + fdt_strerror(ret));
> + return ret;
> + }
> + }
> +
> + return 0;
> +}
> +
> void spl_perform_arch_fixups(struct spl_image_info *spl_image)
> {
> void *fdt = spl_image_fdt_addr(spl_image);
> @@ -465,6 +542,9 @@ void spl_perform_arch_fixups(struct spl_image_info *spl_image)
> return;
>
> fdt_fixup_reserved(fdt);
> +
> + if (IS_ENABLED(CONFIG_SPL_OS_BOOT))
> + k3_falcon_fdt_fixup(fdt);
> }
>
> void spl_board_prepare_for_boot(void)
> diff --git a/arch/arm/mach-k3/common.h b/arch/arm/mach-k3/common.h
> index e970076d08e..466ad22f895 100644
> --- a/arch/arm/mach-k3/common.h
> +++ b/arch/arm/mach-k3/common.h
> @@ -61,10 +61,13 @@ void do_board_detect(void);
> void ti_secure_image_check_binary(void **p_image, size_t *p_size);
> int shutdown_mcu_r5_core1(void);
>
> -#if IS_ENABLED(CONFIG_SPL_OS_BOOT_SECURE) && !IS_ENABLED(CONFIG_ARM64)
> +#if IS_ENABLED(CONFIG_SPL_OS_BOOT_SECURE)
> +int k3_falcon_fdt_fixup(void *fdt);
> +#if !IS_ENABLED(CONFIG_ARM64)
> int k3_r5_falcon_bootmode(void);
> int k3_r5_falcon_prep(void);
> #endif
> +#endif
>
> #if (IS_ENABLED(CONFIG_K3_QOS))
> void setup_qos(void);
> diff --git a/arch/arm/mach-k3/r5/common.c b/arch/arm/mach-k3/r5/common.c
> index 03638366046..484d96f9536 100644
> --- a/arch/arm/mach-k3/r5/common.c
> +++ b/arch/arm/mach-k3/r5/common.c
> @@ -406,83 +406,6 @@ int k3_r5_falcon_bootmode(void)
> return BOOT_DEVICE_NOBOOT;
> }
>
> -static int k3_falcon_fdt_add_bootargs(void *fdt)
> -{
> - struct disk_partition info;
> - struct blk_desc *dev_desc;
> - char bootmedia[32];
> - char bootpart[32];
> - char str[256];
> - int ret;
> -
> - strlcpy(bootmedia, env_get("boot"), sizeof(bootmedia));
> - strlcpy(bootpart, env_get("bootpart"), sizeof(bootpart));
> - ret = blk_get_device_part_str(bootmedia, bootpart, &dev_desc, &info, 0);
> - if (ret < 0) {
> - printf("%s: Failed to get part details for %s %s [%d]\n",
> - __func__, bootmedia, bootpart, ret);
> - return ret;
> - }
> -
> - if (!CONFIG_IS_ENABLED(PARTITION_UUIDS)) {
> - printf("ERROR: Failed to find rootfs PARTUUID\n");
> - printf("%s: CONFIG_SPL_PARTITION_UUIDS not enabled\n",
> - __func__);
> - return -EOPNOTSUPP;
> - }
> -
> - snprintf(str, sizeof(str), "console=%s root=PARTUUID=%s rootwait",
> - env_get("console"), disk_partition_uuid(&info));
> -
> - ret = fdt_find_and_setprop(fdt, "/chosen", "bootargs", str,
> - strlen(str) + 1, 1);
> - if (ret) {
> - printf("%s: Could not set bootargs: %s\n", __func__,
> - fdt_strerror(ret));
> - return ret;
> - }
> -
> - debug("%s: Set bootargs to: %s\n", __func__, str);
> - return 0;
> -}
> -
> -static int k3_falcon_fdt_fixup(void *fdt)
> -{
> - int ret;
> -
> - if (!fdt)
> - return -EINVAL;
> -
> - fdt_set_totalsize(fdt, fdt_totalsize(fdt) + CONFIG_SYS_FDT_PAD);
> -
> - if (fdt_path_offset(fdt, "/chosen/bootargs") < 0) {
> - ret = k3_falcon_fdt_add_bootargs(fdt);
> -
> - if (ret)
> - return ret;
> - }
> -
> - if (IS_ENABLED(CONFIG_OF_BOARD_SETUP)) {
> - ret = ft_board_setup(fdt, gd->bd);
> - if (ret) {
> - printf("%s: Failed in board setup: %s\n", __func__,
> - fdt_strerror(ret));
> - return ret;
> - }
> - }
> -
> - if (IS_ENABLED(CONFIG_OF_SYSTEM_SETUP)) {
> - ret = ft_system_setup(fdt, gd->bd);
> - if (ret) {
> - printf("%s: Failed in system setup: %s\n", __func__,
> - fdt_strerror(ret));
> - return ret;
> - }
> - }
> -
> - return 0;
> -}
> -
> int k3_r5_falcon_prep(void)
> {
> struct spl_image_loader *loader, *drv;
>
> ---
> base-commit: 8bc2a5196c1c0bb5dbdaca073323da0015a0de37
> change-id: 20260312-move_falcon_fixups_to_common-34b602114608
>
> Best regards,
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mach-k3: move k3_falcon_fdt_fixup out of r5/common.c
2026-03-12 12:04 [PATCH] mach-k3: move k3_falcon_fdt_fixup out of r5/common.c Anshul Dalal
2026-03-20 12:15 ` Anshul Dalal
@ 2026-03-25 23:05 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2026-03-25 23:05 UTC (permalink / raw)
To: u-boot, Anshul Dalal
Cc: Dhruva Gole, Aniket Limaye, Bryan Brattlof, Vignesh R,
Beleswar Padhi, Chintan Vankar, Wadim Egorov, Moteen Shah,
Neha Malcom Francis, Andrew Davis, Mattijs Korpershoek,
Simon Glass, Nishanth Menon
On Thu, 12 Mar 2026 17:34:17 +0530, Anshul Dalal wrote:
> k3_falcon_fdt_fixup is used to perform fdt fixups at runtime in falcon
> mode such as adding bootargs. Currently the function is only accessible
> to the R5 SPL but could be useful for A53 SPL based falcon mode setups
> as well.
>
> Therefore this patch moves the function from r5/common.c to common.c.
>
> [...]
Applied to u-boot/next, thanks!
[1/1] mach-k3: move k3_falcon_fdt_fixup out of r5/common.c
commit: 1e2052f76e98ae70ab29113d271bb376ed23e8bb
--
Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-25 23:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-12 12:04 [PATCH] mach-k3: move k3_falcon_fdt_fixup out of r5/common.c Anshul Dalal
2026-03-20 12:15 ` Anshul Dalal
2026-03-25 23:05 ` Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox