[PATCH v2 3/3] pbl: introduce HAS_PBL_CLOCKSOURCE marker

Stefan Kerkmann <[email protected]>
Newsgroups org.infradead.lists.barebox
Message-ID <20260811-feature-pbl-get-time-ns-v2-3-754ee021b19d@pengutronix.de>
This finally enables the usage of the polled timeout functions in the
barebox pbl with real timeouts for supported architectures. Currently
only ARMv7 and AARCH64 are enabled.

Signed-off-by: Stefan Kerkmann <[email protected]>
---
 arch/arm/cpu/Kconfig    | 2 ++
 arch/arm/lib32/Makefile | 2 +-
 include/linux/iopoll.h  | 2 +-
 pbl/Kconfig             | 3 +++
 4 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm/cpu/Kconfig b/arch/arm/cpu/Kconfig
index 47c116ea98..684c7eade9 100644
--- a/arch/arm/cpu/Kconfig
+++ b/arch/arm/cpu/Kconfig
@@ -82,6 +82,7 @@ config CPU_V7
 	bool "Generic ARMv7 support"
 	depends on 32BIT
 	select CPU_32v7
+	select HAS_PBL_CLOCKSOURCE if !CPU_32v4T && !CPU_32v5 && !CPU_32v6
 
 config CPU_V7VE
 	bool "ARMv7 Virtualization Extensions Support"
@@ -135,6 +136,7 @@ config CPU_32v7
 config CPU_64v8
 	bool
 	select CPU_64
+	select HAS_PBL_CLOCKSOURCE
 
 comment "processor features"
 
diff --git a/arch/arm/lib32/Makefile b/arch/arm/lib32/Makefile
index 67c4f16f76..796ea6c742 100644
--- a/arch/arm/lib32/Makefile
+++ b/arch/arm/lib32/Makefile
@@ -34,7 +34,7 @@ extra-y += barebox.lds
 pbl-y	+= lib1funcs.o
 pbl-y	+= ashldi3.o
 pbl-y	+= div0.o
-pbl-$(CONFIG_CPU_32v7)	+= arm_architected_timer.o
+pbl-$(CONFIG_HAS_PBL_CLOCKSOURCE)	+= arm_architected_timer.o
 CFLAGS_arm_architected_timer.o := -march=armv7-a
 
 obj-pbl-y	+= setjmp.o
diff --git a/include/linux/iopoll.h b/include/linux/iopoll.h
index a6fade2a11..d86069f348 100644
--- a/include/linux/iopoll.h
+++ b/include/linux/iopoll.h
@@ -12,7 +12,7 @@
 #include <clock.h>
 #include <pbl.h>
 
-#if IN_PROPER
+#if IN_PROPER || IS_ENABLED(CONFIG_HAS_PBL_CLOCKSOURCE)
 # define read_poll_get_time_ns()	get_time_ns()
 # define read_poll_is_timeout(s, t)	is_timeout(s, t)
 #else
diff --git a/pbl/Kconfig b/pbl/Kconfig
index 63f29cd613..e5fe5328d2 100644
--- a/pbl/Kconfig
+++ b/pbl/Kconfig
@@ -43,6 +43,9 @@ config PBL_SINGLE_IMAGE
 	depends on !HAVE_PBL_MULTI_IMAGES
 	default y
 
+config HAS_PBL_CLOCKSOURCE
+	bool
+
 if PBL_IMAGE
 
 config USE_COMPRESSED_DTB

-- 
2.47.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.