From: Sascha Hauer <s.hauer@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/4] openrisc: drop <config.h> usage
Date: Mon, 1 Dec 2025 11:11:25 +0100 [thread overview]
Message-ID: <aS1pzbrBB5Vto0f9@pengutronix.de> (raw)
In-Reply-To: <20251128110005.3336591-2-a.fatoum@pengutronix.de>
On Fri, Nov 28, 2025 at 11:58:41AM +0100, Ahmad Fatoum wrote:
> From: Ahmad Fatoum <a.fatoum@barebox.org>
>
> Generation per-board config.h headers is a left-over from times long
> past. For most boards it's no longer possible anyway due to multi-image
> suppot, but for legacy boards that still use it, let's switch away from
> this magic in preparation for removal.
>
> Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
> ---
> arch/openrisc/Kconfig | 2 +-
> arch/openrisc/Makefile | 4 ++++
> arch/openrisc/boards/generic/config.h | 25 -------------------------
> arch/openrisc/cpu/barebox.lds.S | 2 +-
> arch/openrisc/cpu/start.S | 2 +-
> arch/openrisc/include/asm/config.h | 15 +++++++++++++++
> arch/openrisc/lib/board.c | 5 +++--
> arch/openrisc/lib/clock.c | 1 +
> arch/openrisc/lib/cpuinfo.c | 3 ++-
> 9 files changed, 28 insertions(+), 31 deletions(-)
> delete mode 100644 arch/openrisc/boards/generic/config.h
> create mode 100644 arch/openrisc/include/asm/config.h
>
> diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
> index d79743962a42..41a4efc691c7 100644
> --- a/arch/openrisc/Kconfig
> +++ b/arch/openrisc/Kconfig
> @@ -16,7 +16,7 @@ config ARCH_MKIMAGE_NAME
> # not used
This is no longer true. Removed while applying.
Sascha
> config ARCH_TEXT_BASE
> hex
> - default 0x00000000
> + default 0x1f80000
>
> config BUILTIN_DTB
> bool "link a DTB into the barebox image"
> diff --git a/arch/openrisc/Makefile b/arch/openrisc/Makefile
> index 609b998de98e..b7b84f78392b 100644
> --- a/arch/openrisc/Makefile
> +++ b/arch/openrisc/Makefile
> @@ -31,4 +31,8 @@ dts := arch/openrisc/dts
> %.dtb: scripts
> $(Q)$(MAKE) $(build)=$(dts) $(dts)/$@
>
> +TEXT_BASE = $(CONFIG_ARCH_TEXT_BASE)
> +
> +KBUILD_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE)
> +
> KBUILD_IMAGE := barebox
> diff --git a/arch/openrisc/boards/generic/config.h b/arch/openrisc/boards/generic/config.h
> deleted file mode 100644
> index 2d836d0063ed..000000000000
> --- a/arch/openrisc/boards/generic/config.h
> +++ /dev/null
> @@ -1,25 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0-only */
> -#ifndef _GENERIC_NAMES_H_
> -#define _GENERIC_NAMES_H_
> -
> -#define CONFIG_SYS_CLK_FREQ 50000000
> -
> -#define OPENRISC_TIMER_FREQ CONFIG_SYS_CLK_FREQ
> -
> -#define OPENRISC_SOPC_MEMORY_BASE 0x00000000
> -#define OPENRISC_SOPC_MEMORY_SIZE 0x02000000
> -
> -/* We reserve 512K for barebox */
> -#define BAREBOX_RESERVED_SIZE 0x80000
> -
> -/* Barebox will be at top of main memory */
> -#define OPENRISC_SOPC_TEXT_BASE (OPENRISC_SOPC_MEMORY_BASE + OPENRISC_SOPC_MEMORY_SIZE - BAREBOX_RESERVED_SIZE)
> -
> -/*
> -* TEXT_BASE is defined here because STACK_BASE definition
> -* in include/asm-generic/memory_layout.h uses this name
> -*/
> -
> -#define TEXT_BASE OPENRISC_SOPC_TEXT_BASE
> -
> -#endif
> diff --git a/arch/openrisc/cpu/barebox.lds.S b/arch/openrisc/cpu/barebox.lds.S
> index 26bb622edc27..3473181b0231 100644
> --- a/arch/openrisc/cpu/barebox.lds.S
> +++ b/arch/openrisc/cpu/barebox.lds.S
> @@ -13,7 +13,7 @@
> *
> */
>
> -#include <config.h>
> +#include <asm/config.h>
> #include <asm/barebox.lds.h>
>
> OUTPUT_FORMAT(BAREBOX_OUTPUT_FORMAT)
> diff --git a/arch/openrisc/cpu/start.S b/arch/openrisc/cpu/start.S
> index c448d3775f37..974eda212139 100644
> --- a/arch/openrisc/cpu/start.S
> +++ b/arch/openrisc/cpu/start.S
> @@ -14,7 +14,7 @@
> *
> */
>
> -#include <config.h>
> +#include <asm/config.h>
> #include <asm-generic/memory_layout.h>
> #include <asm/spr-defs.h>
>
> diff --git a/arch/openrisc/include/asm/config.h b/arch/openrisc/include/asm/config.h
> new file mode 100644
> index 000000000000..85d777db8f63
> --- /dev/null
> +++ b/arch/openrisc/include/asm/config.h
> @@ -0,0 +1,15 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +#ifndef _OPENRISC_ASM_CONFIG_H_
> +#define _OPENRISC_ASM_CONFIG_H_
> +
> +#define CFG_SYS_CLK_FREQ 50000000
> +
> +#define OPENRISC_TIMER_FREQ CFG_SYS_CLK_FREQ
> +
> +#define OPENRISC_SOPC_MEMORY_BASE 0x00000000
> +#define OPENRISC_SOPC_MEMORY_SIZE 0x02000000
> +
> +/* We reserve 512K for barebox */
> +#define BAREBOX_RESERVED_SIZE 0x80000
> +
> +#endif
> diff --git a/arch/openrisc/lib/board.c b/arch/openrisc/lib/board.c
> index c6f34ed412d7..3556f3ecee31 100644
> --- a/arch/openrisc/lib/board.c
> +++ b/arch/openrisc/lib/board.c
> @@ -19,14 +19,15 @@
> #include <memory.h>
> #include <asm-generic/memory_layout.h>
> #include <debug_ll.h>
> +#include <asm/config.h>
>
> /* Called from assembly */
> void openrisc_start_barebox(void);
>
> void __noreturn openrisc_start_barebox(void)
> {
> - mem_malloc_init((void *)(OPENRISC_SOPC_TEXT_BASE - MALLOC_SIZE),
> - (void *)(OPENRISC_SOPC_TEXT_BASE - 1));
> + mem_malloc_init((void *)(TEXT_BASE - MALLOC_SIZE),
> + (void *)(TEXT_BASE - 1));
>
> putc_ll('>');
>
> diff --git a/arch/openrisc/lib/clock.c b/arch/openrisc/lib/clock.c
> index 651b163f13cb..a45de30f9426 100644
> --- a/arch/openrisc/lib/clock.c
> +++ b/arch/openrisc/lib/clock.c
> @@ -16,6 +16,7 @@
> #include <common.h>
> #include <clock.h>
> #include <init.h>
> +#include <asm/config.h>
> #include <asm/system.h>
> #include <asm/openrisc_exc.h>
>
> diff --git a/arch/openrisc/lib/cpuinfo.c b/arch/openrisc/lib/cpuinfo.c
> index d94178ea59de..4aa4d35bf91d 100644
> --- a/arch/openrisc/lib/cpuinfo.c
> +++ b/arch/openrisc/lib/cpuinfo.c
> @@ -16,6 +16,7 @@
>
> #include <common.h>
> #include <command.h>
> +#include <asm/config.h>
> #include <asm/system.h>
> #include <asm/cache.h>
> #include <asm/openrisc_exc.h>
> @@ -114,7 +115,7 @@ static int checkcpu(void)
> char impl_str[50];
>
> printf("CPU: OpenRISC-%x00 (rev %d) @ %d MHz\n",
> - ver, rev, (CONFIG_SYS_CLK_FREQ / 1000000));
> + ver, rev, (CFG_SYS_CLK_FREQ / 1000000));
>
> if (vr2) {
> cpu_implementation(vr2, impl_str);
> --
> 2.47.3
>
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2025-12-01 10:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-28 10:58 [PATCH 0/4] Kbuild: replace legacy <config.h> mechanism Ahmad Fatoum
2025-11-28 10:58 ` [PATCH 1/4] openrisc: drop <config.h> usage Ahmad Fatoum
2025-12-01 10:11 ` Sascha Hauer [this message]
2025-11-28 10:58 ` [PATCH 2/4] ARM: " Ahmad Fatoum
2025-11-28 10:58 ` [PATCH 3/4] ppc: " Ahmad Fatoum
2025-11-28 10:58 ` [PATCH 4/4] treewide: drop last remnants of <config.h> Ahmad Fatoum
2025-12-01 10:11 ` [PATCH 0/4] Kbuild: replace legacy <config.h> mechanism Sascha Hauer
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=aS1pzbrBB5Vto0f9@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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