From: Anshul Dalal <anshuld@ti.com>
To: <u-boot@lists.denx.de>
Cc: Anshul Dalal <anshuld@ti.com>, <vigneshr@ti.com>,
<trini@konsulko.com>, <nm@ti.com>, <robertcnelson@gmail.com>,
<w.egorov@phytec.de>, <francesco.dolcini@toradex.com>,
<ggiordano@phytec.com>, <m-chawdhry@ti.com>, <a-nandan@ti.com>,
<afd@ti.com>, <bb@ti.com>, <u-kumar1@ti.com>, <devarsht@ti.com>
Subject: [PATCH v5 3/4] mach-k3: add dynamic mmu fixups for SPL stage
Date: Thu, 3 Jul 2025 19:05:28 +0530 [thread overview]
Message-ID: <20250703133533.104758-4-anshuld@ti.com> (raw)
In-Reply-To: <20250703133533.104758-1-anshuld@ti.com>
On platforms with spl splash support such as 62p and 62x
(CONFIG_VIDEO=y), the top of DDR is reserved for the framebuffer.
The size of the framebuffer is computed at runtime by video_reserve.
During the MMU configuration an entry corresponding to the framebuffer
should be dynamically created to properly allocate the required space
for the framebuffer.
Therefore this patch adds k3_spl_mem_map_init which adds the required
MMU entry by querying the gd after the framebuffer size has been
computed in spl_reserve_video_from_ram_top.
Signed-off-by: Anshul Dalal <anshuld@ti.com>
---
arch/arm/mach-k3/arm64/arm64-mmu.c | 13 ++++++++++++-
arch/arm/mach-k3/common.c | 17 ++++++++++++++---
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-k3/arm64/arm64-mmu.c b/arch/arm/mach-k3/arm64/arm64-mmu.c
index 49dd6fcb23b..b1b287f2114 100644
--- a/arch/arm/mach-k3/arm64/arm64-mmu.c
+++ b/arch/arm/mach-k3/arm64/arm64-mmu.c
@@ -131,6 +131,13 @@ static int k3_setup_extra_mem_banks(unsigned int *map_idx)
return 0;
}
+static void k3_spl_mem_map_init(unsigned int *map_idx)
+{
+ if (CONFIG_IS_ENABLED(VIDEO))
+ k3_mmu_add_cachable_entry(gd_video_bottom(), gd_video_top(),
+ map_idx);
+}
+
static int k3_uboot_mem_map_init(unsigned int *map_idx)
{
int ret;
@@ -159,7 +166,11 @@ int k3_mem_map_init(void)
map_idx++;
- ret = k3_uboot_mem_map_init(&map_idx);
+ if (xpl_phase() == PHASE_SPL)
+ k3_spl_mem_map_init(&map_idx);
+ else
+ ret = k3_uboot_mem_map_init(&map_idx);
+
if (ret)
return ret;
diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
index fc230f180d0..e72413b9803 100644
--- a/arch/arm/mach-k3/common.c
+++ b/arch/arm/mach-k3/common.c
@@ -32,6 +32,7 @@
#include <dm/device-internal.h>
#include <asm/arch/k3-qos.h>
+#include <mach/k3-ddr.h>
struct ti_sci_handle *get_ti_sci_handle(void)
{
@@ -224,16 +225,26 @@ void spl_enable_cache(void)
dram_init();
- /* reserve TLB table */
- gd->arch.tlb_size = PGTABLE_SIZE;
-
gd->ram_top += get_effective_memsize();
+ /* keep ram_top in the 32-bit address space */
+ if (gd->ram_top >= 0x100000000)
+ gd->ram_top = (phys_addr_t)0x100000000;
+
gd->relocaddr = gd->ram_top;
ret = spl_reserve_video_from_ram_top();
if (ret)
panic("Failed to reserve framebuffer memory (%d)\n", ret);
+ if (IS_ENABLED(CONFIG_ARM64)) {
+ ret = k3_mem_map_init();
+ if (ret)
+ panic("Failed to setup MMU table (%d)\n", ret);
+ }
+
+ /* reserve TLB table */
+ gd->arch.tlb_size = PGTABLE_SIZE;
+
gd->arch.tlb_addr = gd->relocaddr - gd->arch.tlb_size;
gd->arch.tlb_addr &= ~(0x10000 - 1);
debug("TLB table from %08lx to %08lx\n", gd->arch.tlb_addr,
--
2.49.0
next prev parent reply other threads:[~2025-07-03 13:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-03 13:35 [PATCH v5 0/4] Add support for dynamic MMU configuration Anshul Dalal
2025-07-03 13:35 ` [PATCH v5 1/4] mach-k3: use minimal MMU table for all k3 Anshul Dalal
2025-07-03 13:35 ` [PATCH v5 2/4] mach-k3: add runtime configuration of MMU table Anshul Dalal
2025-07-07 20:15 ` Ilias Apalodimas
2025-08-14 14:11 ` Anshul Dalal
2025-08-21 6:20 ` Ilias Apalodimas
2025-07-03 13:35 ` Anshul Dalal [this message]
2025-07-07 20:09 ` [PATCH v5 3/4] mach-k3: add dynamic mmu fixups for SPL stage Ilias Apalodimas
2025-08-14 14:51 ` Anshul Dalal
2025-08-21 6:17 ` Ilias Apalodimas
2025-07-03 13:35 ` [PATCH v5 4/4] board: add call to k3_mem_map_init for all k3 boards 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=20250703133533.104758-4-anshuld@ti.com \
--to=anshuld@ti.com \
--cc=a-nandan@ti.com \
--cc=afd@ti.com \
--cc=bb@ti.com \
--cc=devarsht@ti.com \
--cc=francesco.dolcini@toradex.com \
--cc=ggiordano@phytec.com \
--cc=m-chawdhry@ti.com \
--cc=nm@ti.com \
--cc=robertcnelson@gmail.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=u-kumar1@ti.com \
--cc=vigneshr@ti.com \
--cc=w.egorov@phytec.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox