From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 5/5] ARM: rpi: Add mini UART debug_ll support
Date: Wed, 6 Mar 2019 10:42:39 +0100 [thread overview]
Message-ID: <20190306094239.29413-6-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20190306094239.29413-1-s.hauer@pengutronix.de>
The raspberry pi 3 comes up with the mini UART as default, so allow to
use it for debug_ll output.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-bcm283x/include/mach/debug_ll.h | 37 +++++++++++++++++++
common/Kconfig | 6 +++
2 files changed, 43 insertions(+)
diff --git a/arch/arm/mach-bcm283x/include/mach/debug_ll.h b/arch/arm/mach-bcm283x/include/mach/debug_ll.h
index 2d2103e338..99c59d011b 100644
--- a/arch/arm/mach-bcm283x/include/mach/debug_ll.h
+++ b/arch/arm/mach-bcm283x/include/mach/debug_ll.h
@@ -22,14 +22,51 @@
#ifdef CONFIG_DEBUG_RPI1_UART
+static inline void debug_ll_init(void)
+{
+ /* Configured by ROM */
+}
+
#define DEBUG_LL_UART_ADDR BCM2835_PL011_BASE
#include <debug_ll/pl011.h>
#elif defined CONFIG_DEBUG_RPI2_3_UART
+static inline void debug_ll_init(void)
+{
+ /* Configured by ROM */
+}
+
#define DEBUG_LL_UART_ADDR BCM2836_PL011_BASE
#include <debug_ll/pl011.h>
+#elif defined CONFIG_DEBUG_RPI3_MINI_UART
+
+static inline uint8_t debug_ll_read_reg(int reg)
+{
+ return readb(BCM2836_MINIUART_BASE + (reg << 2));
+}
+
+static inline void debug_ll_write_reg(int reg, uint8_t val)
+{
+ writeb(val, BCM2836_MINIUART_BASE + (reg << 2));
+}
+
+#define BCM2836_AUX_CLOCK_ENB 0x3f215004 /* BCM2835 AUX Clock enable register */
+#define BCM2836_AUX_CLOCK_EN_UART BIT(0) /* Bit 0 enables the Miniuart */
+
+#include <debug_ll/ns16550.h>
+
+static inline void debug_ll_init(void)
+{
+ uint16_t divisor;
+
+ writeb(BCM2836_AUX_CLOCK_EN_UART, BCM2836_AUX_CLOCK_ENB);
+
+ divisor = debug_ll_ns16550_calc_divisor(250000000 * 2);
+ debug_ll_ns16550_init(divisor);
+}
+
#endif
#endif /* __MACH_BCM2835_DEBUG_LL_H__ */
diff --git a/common/Kconfig b/common/Kconfig
index 563cf15fb1..0c6acfcddb 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1173,6 +1173,12 @@ config DEBUG_RPI2_UART
Say Y here if you want low-level debugging support on
RaspberryPi 2 and 3 boards.
+config DEBUG_RPI3_MINI_UART
+ bool "RaspberryPi 3 mini UART
+ depends on ARCH_BCM283X
+ help
+ Say Y here if you want low-level debugging support on
+ RaspberryPi 3 board mini UART.
endchoice
config DEBUG_IMX_UART_PORT
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2019-03-06 9:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-06 9:42 [PATCH 0/5] ARM: rpi: refactor debug_ll Sascha Hauer
2019-03-06 9:42 ` [PATCH 1/5] ARM: rpi: Move UART base address definitions to header file Sascha Hauer
2019-03-06 9:42 ` [PATCH 2/5] debug_ll: Move pl011 header file to architecture independent place Sascha Hauer
2019-03-06 9:42 ` [PATCH 3/5] debug_ll: Add ns16550 early debugging functions Sascha Hauer
2019-03-06 9:42 ` [PATCH 4/5] ARM: rpi: move debug UART Kconfig settings Sascha Hauer
2019-03-07 9:52 ` Tomaž Šolc
2019-03-06 9:42 ` Sascha Hauer [this message]
2019-03-07 9:52 ` [PATCH 5/5] ARM: rpi: Add mini UART debug_ll support Tomaž Šolc
2019-03-07 13:24 ` Sascha Hauer
2019-03-07 13:32 ` [HELP] Kernel + initrd in FIT Seraphim Dolbilov
2019-03-11 7:25 ` Sascha Hauer
2019-03-07 10:00 ` [PATCH 0/5] ARM: rpi: refactor debug_ll Tomaž Šolc
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=20190306094239.29413-6-s.hauer@pengutronix.de \
--to=s.hauer@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