From: Anshul Dalal <anshuld@ti.com>
Cc: Anshul Dalal <anshuld@ti.com>, <afd@ti.com>, <b-liu@ti.com>,
<bb@ti.com>, <m-chawdhry@ti.com>, <n-francis@ti.com>,
<nm@ti.com>, <trini@konsulko.com>, <u-boot@lists.denx.de>,
<vigneshr@ti.com>
Subject: [PATCH v8 6/8] mach-k3: r5: common: add bootargs to kernel's dtb
Date: Mon, 27 Oct 2025 18:30:01 +0530 [thread overview]
Message-ID: <20251027130004.2156121-7-anshuld@ti.com> (raw)
In-Reply-To: <20251027130004.2156121-1-anshuld@ti.com>
The bootargs are passed to the kernel in the chosen node, this patch
adds support for populating bootargs in the dtb if missing.
The values for kernel boot params is taken from the env with, 'boot' and
'bootpart' specifying the rootfs for the kernel.
Signed-off-by: Anshul Dalal <anshuld@ti.com>
---
arch/arm/mach-k3/r5/common.c | 47 ++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/arch/arm/mach-k3/r5/common.c b/arch/arm/mach-k3/r5/common.c
index 4788aaff3ea..9e20b7ae93d 100644
--- a/arch/arm/mach-k3/r5/common.c
+++ b/arch/arm/mach-k3/r5/common.c
@@ -406,6 +406,46 @@ 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("Set bootargs to: %s\n", str);
+ return 0;
+}
+
static int k3_falcon_fdt_fixup(void *fdt)
{
int ret;
@@ -415,6 +455,13 @@ static int k3_falcon_fdt_fixup(void *fdt)
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) {
--
2.51.0
next prev parent reply other threads:[~2025-10-27 13:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-27 12:59 [PATCH v8 0/8] Allow falcon boot from R5 SPL on TI's AM62 devices Anshul Dalal
2025-10-27 12:59 ` [PATCH v8 1/8] arch: arm: k3-binman: add fit for falcon boot Anshul Dalal
2025-10-27 12:59 ` [PATCH v8 2/8] configs: add falcon mode fragment for k3 devices Anshul Dalal
2025-10-27 12:59 ` [PATCH v8 3/8] mach-k3: common: enable falcon mode from R5 SPL Anshul Dalal
2025-10-27 12:59 ` [PATCH v8 4/8] mach-k3: common: support only MMC in R5 falcon mode Anshul Dalal
2025-10-27 13:00 ` [PATCH v8 5/8] mach-k3: r5: common: add fdt fixups for " Anshul Dalal
2025-10-27 13:00 ` Anshul Dalal [this message]
2025-10-27 13:00 ` [PATCH v8 7/8] Makefile: add tifalcon.bin to CLEAN_FILES Anshul Dalal
2025-10-27 13:00 ` [PATCH v8 8/8] doc: ti: document R5 falcon mode for AM62 platforms Anshul Dalal
2025-10-29 18:16 ` Andrew Davis
2025-10-30 5:08 ` Anshul Dalal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251027130004.2156121-7-anshuld@ti.com \
--to=anshuld@ti.com \
--cc=afd@ti.com \
--cc=b-liu@ti.com \
--cc=bb@ti.com \
--cc=m-chawdhry@ti.com \
--cc=n-francis@ti.com \
--cc=nm@ti.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.