[PATCH] common: spl: nand: improve u-boot offsets overriding
Tom Rini
trini at konsulko.com
Tue Apr 14 17:18:56 CEST 2026
On Tue, Apr 14, 2026 at 04:03:21PM +0800, Weijie Gao wrote:
> This patch introduces spl_nand_get_uboot_raw_page_redund() to wrap the
> CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND macro, similar as what
> spl_nand_get_uboot_raw_page() has already done.
> Also, make it possible to use these functions without defining related
> macros.
>
> This patch also replaces all references to CONFIG_SYS_NAND_U_BOOT_OFFS and
> CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND with the return value of the two
> functions mentioned above.
>
> Signed-off-by: Weijie Gao <weijie.gao at mediatek.com>
> ---
> common/spl/spl_nand.c | 38 ++++++++++++++++++++++++++------------
> 1 file changed, 26 insertions(+), 12 deletions(-)
>
> diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c
> index f449b31f594..cce2e1a6df3 100644
> --- a/common/spl/spl_nand.c
> +++ b/common/spl/spl_nand.c
> @@ -18,21 +18,34 @@
>
> 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
> +}
> +
> +uint32_t __weak spl_nand_get_uboot_raw_page_redund(void)
> +{
> +#ifdef CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND
> + return CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND;
> +#else
> + return 0;
> +#endif
> }
This is closer, but not quite what I was thinking. We should be able to
use IF_ENABLED_INT to get either the real value of
CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND or 0, and then maybe (maybe not)
clean up the rest of these changes a bit more. Thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20260414/3ada717d/attachment.sig>
More information about the U-Boot
mailing list