mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: ukl@pengutronix.de, "Daniel Brát" <danek.brat@gmail.com>,
	ore@pengutronix.de, "Ahmad Fatoum" <a.fatoum@pengutronix.de>
Subject: [PATCH 12/15] ARM: rpi: add debug_ll support for Raspberry Pi 4
Date: Thu,  5 May 2022 10:01:49 +0200	[thread overview]
Message-ID: <20220505080152.1068424-13-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20220505080152.1068424-1-a.fatoum@pengutronix.de>

The mini uart (Pins 8/10) is the primary UART on the Raspberry Pi 4 and
can be set up in firmware by specifying enable_uart=1 in the config.txt.

Add a DEBUG_LL implementation to use this for early debugging.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/mach-bcm283x/include/mach/debug_ll.h | 21 +++++++++++++++++++
 arch/arm/mach-bcm283x/include/mach/platform.h |  1 +
 common/Kconfig                                |  7 +++++++
 3 files changed, 29 insertions(+)

diff --git a/arch/arm/mach-bcm283x/include/mach/debug_ll.h b/arch/arm/mach-bcm283x/include/mach/debug_ll.h
index 4bfa5abc7c41..e4274e5279a5 100644
--- a/arch/arm/mach-bcm283x/include/mach/debug_ll.h
+++ b/arch/arm/mach-bcm283x/include/mach/debug_ll.h
@@ -18,6 +18,7 @@
 #define __MACH_BCM2835_DEBUG_LL_H__
 
 #include <mach/platform.h>
+#include <io.h>
 
 #ifdef CONFIG_DEBUG_RPI1_UART
 
@@ -66,6 +67,26 @@ static inline void debug_ll_init(void)
 	debug_ll_ns16550_init(divisor);
 }
 
+
+#elif defined CONFIG_DEBUG_RPI4_MINI_UART
+
+static inline uint8_t debug_ll_read_reg(int reg)
+{
+	return readb(BCM2711_MINIUART_BASE + (reg << 2));
+}
+
+static inline void debug_ll_write_reg(int reg, uint8_t val)
+{
+	writeb(val, BCM2711_MINIUART_BASE + (reg << 2));
+}
+
+#include <debug_ll/ns16550.h>
+
+static inline void debug_ll_init(void)
+{
+	/* Configured by ROM */
+}
+
 #endif
 
 #endif /* __MACH_BCM2835_DEBUG_LL_H__ */
diff --git a/arch/arm/mach-bcm283x/include/mach/platform.h b/arch/arm/mach-bcm283x/include/mach/platform.h
index 6917e1f345d7..b957ac8de35e 100644
--- a/arch/arm/mach-bcm283x/include/mach/platform.h
+++ b/arch/arm/mach-bcm283x/include/mach/platform.h
@@ -34,6 +34,7 @@
 #define BCM2836_PL011_BASE 0x3f201000UL
 #define BCM2835_MINIUART_BASE 0x20215040
 #define BCM2836_MINIUART_BASE 0x3f215040UL
+#define BCM2711_MINIUART_BASE 0xfe215040UL
 
 #endif
 
diff --git a/common/Kconfig b/common/Kconfig
index f7a6a96e877c..4054bd838dec 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1413,6 +1413,13 @@ config DEBUG_RPI3_MINI_UART
 	  Say Y here if you want low-level debugging support on
 	  RaspberryPi 3 board mini UART.
 
+config DEBUG_RPI4_MINI_UART
+	bool "RaspberryPi 4 mini UART"
+	depends on ARCH_BCM283X
+	help
+	  Say Y here if you want low-level debugging support on
+	  RaspberryPi 4 board mini UART.
+
 config DEBUG_ERIZO
 	bool "Erizo ns16550 port"
 	depends on SOC_ERIZO
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  parent reply	other threads:[~2022-05-05  8:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-05  8:01 [PATCH 00/15] ARM: rpi: add basic Raspberry Pi 4 support Ahmad Fatoum
2022-05-05  8:01 ` [PATCH 01/15] PBL: fdt: fix /memory parsing when #address-cells != #size-cells Ahmad Fatoum
2022-05-05  8:01 ` [PATCH 02/15] of: address: fix printing of OF node name in error message Ahmad Fatoum
2022-05-05  8:01 ` [PATCH 03/15] serial: ns16550: rpi: remove ungating now done by proper clk driver Ahmad Fatoum
2022-05-05  8:01 ` [PATCH 04/15] ARM: cpu: prevent recursive dependencies via CPU_SUPPORTS_64BIT_KERNEL Ahmad Fatoum
2022-05-05  8:01 ` [PATCH 05/15] ARM: rpi: add Raspberry Pi 3 64-bit build support Ahmad Fatoum
2022-05-05  8:01 ` [PATCH 06/15] ARM: rpi: rpi3: disallow MMU_EARLY && 64BIT Ahmad Fatoum
2022-05-05  8:01 ` [PATCH 07/15] clk: rpi: add Raspberry Pi 4 support Ahmad Fatoum
2022-05-05  8:01 ` [PATCH 08/15] mci: bcm2835: add bcm2711-emmc2 (Rpi4) support Ahmad Fatoum
2022-05-05  8:01 ` [PATCH 09/15] serial: ns16550: rpi: skip baudrate changes for bcm2711 Ahmad Fatoum
2022-05-05  8:01 ` [PATCH 10/15] clocksource: bcm2835: bump below architeced timer for AArch64 Ahmad Fatoum
2022-05-05  8:01 ` [PATCH 11/15] ARM: rpi: add Raspberry Pi 4 support Ahmad Fatoum
2022-05-05  8:01 ` Ahmad Fatoum [this message]
2022-05-05  8:01 ` [PATCH 13/15] ARM: rpi: add heuristic for skipping detection of SDIO card Ahmad Fatoum
2022-05-05  8:01 ` [PATCH 14/15] doc: bcm283x: add initial docs for Raspberry Pi 4 support Ahmad Fatoum
2022-05-05  8:01 ` [PATCH 15/15] doc: bcm283x: reference newer firmware Ahmad Fatoum
2022-05-06 12:47 ` [PATCH 00/15] ARM: rpi: add basic Raspberry Pi 4 support 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=20220505080152.1068424-13-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=danek.brat@gmail.com \
    --cc=ore@pengutronix.de \
    --cc=ukl@pengutronix.de \
    /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