From: Devarsh Thakkar <devarsht@ti.com>
To: <u-boot@lists.denx.de>, <sjg@chromium.org>, <agust@denx.de>,
<trini@konsulko.com>, <bmeng.cn@gmail.com>, <msuchanek@suse.de>,
<rasmus.villemoes@prevas.dk>, <yangshiji66@outlook.com>
Cc: <praneeth@ti.com>, <nm@ti.com>, <vigneshr@ti.com>,
<a-bhatia1@ti.com>, <j-luthra@ti.com>, <nsekhar@ti.com>,
<n-jain1@ti.com>, <devarsht@ti.com>
Subject: [PATCH v4 2/8] arm: mach-k3: common: Reserve video memory from end of the RAM
Date: Sat, 25 Nov 2023 21:56:59 +0530 [thread overview]
Message-ID: <20231125162705.1383401-3-devarsht@ti.com> (raw)
In-Reply-To: <20231125162705.1383401-1-devarsht@ti.com>
Setup video memory before page table reservation using
"spl_reserve_video_from_ram_top" which ensures framebuffer memory gets
reserved from the end of RAM.
This is done to enable the next stage to directly skip the
pre-reserved area from previous stage right from the end of RAM without
having to make any gaps/holes to accommodate those regions which was the
case before as previous stage reserved region not from the end of RAM.
Use gd->ram_top instead of local ram_top and update gd->reloc_addr after
each reservation to ensure further regions are reserved properly.
Signed-off-by: Devarsh Thakkar <devarsht@ti.com>
---
V2:
- Make a generic function "spl_reserve_video" under
common/spl which can be re-used by other platforms too
for reserving video memory from spl.
V3:
- Change spl_reserve_video to spl_reserve_video_from_ram_top
which enforce framebuffer reservation from end of RAM
- Use gd->ram_top instead of local ram_top and update
gd->reloc_addr after each reservation
- Print error message on framebuffer reservation
V4:
- Split this into a separate patch
---
arch/arm/mach-k3/common.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
index fd400e7e3d..42ceeb5296 100644
--- a/arch/arm/mach-k3/common.c
+++ b/arch/arm/mach-k3/common.c
@@ -524,19 +524,26 @@ void remove_fwl_configs(struct fwl_data *fwl_data, size_t fwl_data_size)
void spl_enable_cache(void)
{
#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
- phys_addr_t ram_top = CFG_SYS_SDRAM_BASE;
+ gd->ram_top = CFG_SYS_SDRAM_BASE;
+ int ret = 0;
dram_init();
/* reserve TLB table */
gd->arch.tlb_size = PGTABLE_SIZE;
- ram_top += get_effective_memsize();
+ gd->ram_top += get_effective_memsize();
/* keep ram_top in the 32-bit address space */
- if (ram_top >= 0x100000000)
- ram_top = (phys_addr_t) 0x100000000;
+ if (gd->ram_top >= 0x100000000)
+ gd->ram_top = (phys_addr_t)0x100000000;
- gd->arch.tlb_addr = ram_top - gd->arch.tlb_size;
+ gd->relocaddr = gd->ram_top;
+
+ ret = spl_reserve_video_from_ram_top();
+ if (ret)
+ panic("Failed to reserve framebuffer memory (%d)\n", ret);
+
+ 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,
gd->arch.tlb_addr + gd->arch.tlb_size);
--
2.34.1
next prev parent reply other threads:[~2023-11-25 16:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-25 16:26 [PATCH v4 0/8] Move framebuffer reservation for SPL to RAM end Devarsh Thakkar
2023-11-25 16:26 ` [PATCH v4 1/8] spl: Enforce framebuffer reservation from end of RAM Devarsh Thakkar
2023-12-02 21:16 ` Simon Glass
2023-11-25 16:26 ` Devarsh Thakkar [this message]
2023-12-05 12:34 ` [PATCH v4 2/8] arm: mach-k3: common: Reserve video memory from end of the RAM Nikhil Jain
2023-11-25 16:27 ` [PATCH v4 3/8] board: ti: am62x: evm: Remove video_setup from spl_board_init Devarsh Thakkar
2023-11-25 16:27 ` [PATCH v4 4/8] common/board_f: Catch bloblist before starting resevations Devarsh Thakkar
2023-11-25 16:27 ` [PATCH v4 5/8] video: Skip framebuffer reservation if already reserved Devarsh Thakkar
2023-12-02 18:26 ` Simon Glass
2023-11-25 16:27 ` [PATCH v4 6/8] video: Fill video handoff in video post probe Devarsh Thakkar
2023-11-25 16:27 ` [PATCH v4 7/8] doc: spl: Add info for missing Kconfigs Devarsh Thakkar
2023-12-02 18:28 ` Simon Glass
2023-11-25 16:27 ` [PATCH v4 8/8] doc: spl: Add info regarding memory reservation Devarsh Thakkar
2023-12-02 18:26 ` Simon Glass
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=20231125162705.1383401-3-devarsht@ti.com \
--to=devarsht@ti.com \
--cc=a-bhatia1@ti.com \
--cc=agust@denx.de \
--cc=bmeng.cn@gmail.com \
--cc=j-luthra@ti.com \
--cc=msuchanek@suse.de \
--cc=n-jain1@ti.com \
--cc=nm@ti.com \
--cc=nsekhar@ti.com \
--cc=praneeth@ti.com \
--cc=rasmus.villemoes@prevas.dk \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=vigneshr@ti.com \
--cc=yangshiji66@outlook.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox