mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] debug_ll: pl011: add PBL console helper
@ 2026-01-12  8:56 Ahmad Fatoum
  2026-01-12  8:56 ` [PATCH 2/2] ARM: cpu: setupc: implement 32-bit relocate_to_adr_full Ahmad Fatoum
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2026-01-12  8:56 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

For use with pbl_set_putc, define a helper for PL011, like we already do
for NS16550.

Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
 include/debug_ll/pl011.h | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/include/debug_ll/pl011.h b/include/debug_ll/pl011.h
index 12f9ce1564c5..aeec456f2006 100644
--- a/include/debug_ll/pl011.h
+++ b/include/debug_ll/pl011.h
@@ -3,25 +3,36 @@
 #ifndef __INCLUDE_ARM_ASM_DEBUG_LL_PL011_H__
 #define __INCLUDE_ARM_ASM_DEBUG_LL_PL011_H__
 
+#include <io.h>
+#include <linux/amba/serial.h>
+
+static inline void debug_ll_pl011_putc(void __iomem *base, int c)
+{
+	/* Wait until there is space in the FIFO */
+	while (readl(base + UART01x_FR) & UART01x_FR_TXFF)
+		;
+
+	/* Send the character */
+	writel(c, base + UART01x_DR);
+}
+
+#ifdef CONFIG_DEBUG_LL
+
 #ifndef DEBUG_LL_UART_ADDR
 #error DEBUG_LL_UART_ADDR is undefined!
 #endif
 
-#include <io.h>
-#include <linux/amba/serial.h>
-
 static inline void PUTC_LL(char c)
 {
-	/* Wait until there is space in the FIFO */
-	while (readl(DEBUG_LL_UART_ADDR + UART01x_FR) & UART01x_FR_TXFF)
-		;
+	void __iomem *base = IOMEM(DEBUG_LL_UART_ADDR);
 
-	/* Send the character */
-	writel(c, DEBUG_LL_UART_ADDR + UART01x_DR);
+	debug_ll_pl011_putc(base, c);
 
 	/* Wait to make sure it hits the line, in case we die too soon. */
-	while (readl(DEBUG_LL_UART_ADDR + UART01x_FR) & UART01x_FR_TXFF)
+	while (readl(base + UART01x_FR) & UART01x_FR_TXFF)
 		;
 }
 
+#endif
+
 #endif /* __INCLUDE_ARM_ASM_DEBUG_LL_PL011_H__ */
-- 
2.47.3




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

* [PATCH 2/2] ARM: cpu: setupc: implement 32-bit relocate_to_adr_full
  2026-01-12  8:56 [PATCH 1/2] debug_ll: pl011: add PBL console helper Ahmad Fatoum
@ 2026-01-12  8:56 ` Ahmad Fatoum
  0 siblings, 0 replies; 2+ messages in thread
From: Ahmad Fatoum @ 2026-01-12  8:56 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

To move barebox out of QEMU's NOR flash and into RAM, implement
relocate_to_adr_full(), like we already do for ARM64.

Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
The series adding support for ARM Qemu Virt -bios will make use of this,
but this is already useful for other boards, so sending it out now.
---
 arch/arm/cpu/setupc_32.S | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/arch/arm/cpu/setupc_32.S b/arch/arm/cpu/setupc_32.S
index d3449d9646b9..0134637f6296 100644
--- a/arch/arm/cpu/setupc_32.S
+++ b/arch/arm/cpu/setupc_32.S
@@ -43,12 +43,21 @@ ENDPROC(setup_c)
  * executing at new address.
  */
 .section .text.relocate_to_adr
+#ifdef __PBL__
+ENTRY(relocate_to_adr_full)
+	ldr	r2, =__image_end
+	b	1f
+#endif
+
 ENTRY(relocate_to_adr)
-					/* r0: target address */
+	ldr	r2, =__bss_start
+	b	1f
+
+1:
 	push	{r3, r4, r5, r6, r7, r8}
 	mov	r7, lr
 
-	mov	r6, r0
+	mov	r6, r0			/* r0: target address */
 
 	bl	get_runtime_offset
 
@@ -61,8 +70,6 @@ ENTRY(relocate_to_adr)
 	cmp	r1, r6			/* already at correct address? */
 	beq	1f			/* yes, skip copy to new address */
 
-	ldr	r2, =__bss_start
-
 	sub	r2, r2, r8		/* r2: size */
 	mov	r0, r6			/* r0: target */
 
-- 
2.47.3




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

end of thread, other threads:[~2026-01-12  8:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-12  8:56 [PATCH 1/2] debug_ll: pl011: add PBL console helper Ahmad Fatoum
2026-01-12  8:56 ` [PATCH 2/2] ARM: cpu: setupc: implement 32-bit relocate_to_adr_full Ahmad Fatoum

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