mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH 1/2] debug_ll: pl011: add PBL console helper
Date: Mon, 12 Jan 2026 09:56:39 +0100	[thread overview]
Message-ID: <20260112085709.2953004-1-a.fatoum@barebox.org> (raw)

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




             reply	other threads:[~2026-01-12  8:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-12  8:56 Ahmad Fatoum [this message]
2026-01-12  8:56 ` [PATCH 2/2] ARM: cpu: setupc: implement 32-bit relocate_to_adr_full Ahmad Fatoum

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=20260112085709.2953004-1-a.fatoum@barebox.org \
    --to=a.fatoum@barebox.org \
    --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