public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] common: spl: spl_nand: make CONFIG_SYS_NAND_U_BOOT_OFFS optional in spl_nand_get_uboot_raw_page()
@ 2026-04-10  8:49 Weijie Gao
  2026-04-10 14:44 ` Tom Rini
  0 siblings, 1 reply; 3+ messages in thread
From: Weijie Gao @ 2026-04-10  8:49 UTC (permalink / raw)
  To: u-boot; +Cc: GSS_MTK_Uboot_upstream, Tom Rini, Weijie Gao

As spl_nand_get_uboot_raw_page() is a weak function, when a board wants to
override it, the CONFIG_SYS_NAND_U_BOOT_OFFS becomes meaningless within
this function.

This patch allows spl_nand_get_uboot_raw_page() being compiled without
CONFIG_SYS_NAND_U_BOOT_OFFS being defined.

Note: this is available only when both CONFIG_SPL_NAND_RAW_ONLY and
CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND are not defined.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
---
 common/spl/spl_nand.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c
index f449b31f594..74c114d8e30 100644
--- a/common/spl/spl_nand.c
+++ b/common/spl/spl_nand.c
@@ -18,7 +18,11 @@
 
 uint32_t __weak spl_nand_get_uboot_raw_page(void)
 {
+#ifdef CONFIG_SYS_NAND_U_BOOT_OFFS
 	return CONFIG_SYS_NAND_U_BOOT_OFFS;
+#else
+	return 0;
+#endif
 }
 
 #if defined(CONFIG_SPL_NAND_RAW_ONLY)
-- 
2.17.0


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

* Re: [PATCH] common: spl: spl_nand: make CONFIG_SYS_NAND_U_BOOT_OFFS optional in spl_nand_get_uboot_raw_page()
  2026-04-10  8:49 [PATCH] common: spl: spl_nand: make CONFIG_SYS_NAND_U_BOOT_OFFS optional in spl_nand_get_uboot_raw_page() Weijie Gao
@ 2026-04-10 14:44 ` Tom Rini
  2026-04-13  3:53   ` Weijie Gao
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Rini @ 2026-04-10 14:44 UTC (permalink / raw)
  To: Weijie Gao; +Cc: u-boot, GSS_MTK_Uboot_upstream

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

On Fri, Apr 10, 2026 at 04:49:33PM +0800, Weijie Gao wrote:

> As spl_nand_get_uboot_raw_page() is a weak function, when a board wants to
> override it, the CONFIG_SYS_NAND_U_BOOT_OFFS becomes meaningless within
> this function.
> 
> This patch allows spl_nand_get_uboot_raw_page() being compiled without
> CONFIG_SYS_NAND_U_BOOT_OFFS being defined.
> 
> Note: this is available only when both CONFIG_SPL_NAND_RAW_ONLY and
> CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND are not defined.
> 
> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
> ---
>  common/spl/spl_nand.c | 4 ++++
>  1 file changed, 4 insertions(+)

I think the bug here is that when SYS_NAND_U_BOOT_LOCATIONS isn't
defined, we should still be able to override spl_nand_get_uboot_raw_page
(with an implementation that does not use CONFIG_SYS_NAND_U_BOOT_OFFS).
Can you please re-examine the code with that in mind? Thanks!

-- 
Tom

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

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

* Re: [PATCH] common: spl: spl_nand: make CONFIG_SYS_NAND_U_BOOT_OFFS optional in spl_nand_get_uboot_raw_page()
  2026-04-10 14:44 ` Tom Rini
@ 2026-04-13  3:53   ` Weijie Gao
  0 siblings, 0 replies; 3+ messages in thread
From: Weijie Gao @ 2026-04-13  3:53 UTC (permalink / raw)
  To: Tom Rini; +Cc: u-boot, GSS_MTK_Uboot_upstream

Hi Tom,

On Fri, 2026-04-10 at 08:44 -0600, Tom Rini wrote:
> On Fri, Apr 10, 2026 at 04:49:33PM +0800, Weijie Gao wrote:
> 
> > As spl_nand_get_uboot_raw_page() is a weak function, when a board
> > wants to
> > override it, the CONFIG_SYS_NAND_U_BOOT_OFFS becomes meaningless
> > within
> > this function.
> > 
> > This patch allows spl_nand_get_uboot_raw_page() being compiled
> > without
> > CONFIG_SYS_NAND_U_BOOT_OFFS being defined.
> > 
> > Note: this is available only when both CONFIG_SPL_NAND_RAW_ONLY and
> > CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND are not defined.
> > 
> > Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
> > ---
> >  common/spl/spl_nand.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> 
> I think the bug here is that when SYS_NAND_U_BOOT_LOCATIONS isn't
> defined, we should still be able to override
> spl_nand_get_uboot_raw_page
> (with an implementation that does not use
> CONFIG_SYS_NAND_U_BOOT_OFFS).
> Can you please re-examine the code with that in mind? Thanks!
> 

So I come up with the following idea:
1. With my current path, replace all reference to
   CONFIG_SYS_NAND_U_BOOT_OFFS with spl_nand_get_uboot_raw_page()
2. Add a new weak function, spl_nand_get_uboot_raw_page_redund(), to
   wrap the CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND macro, and do the same
   modification as spl_nand_get_uboot_raw_page() do.

I'll send new patch later

Weijie



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

end of thread, other threads:[~2026-04-13  3:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-10  8:49 [PATCH] common: spl: spl_nand: make CONFIG_SYS_NAND_U_BOOT_OFFS optional in spl_nand_get_uboot_raw_page() Weijie Gao
2026-04-10 14:44 ` Tom Rini
2026-04-13  3:53   ` Weijie Gao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox