mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] RISC-V: virt: add DEBUG_LL support
@ 2021-11-25 16:06 Ahmad Fatoum
  2021-12-07  9:11 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2021-11-25 16:06 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

While we have PBL console support, console isn't available during early
barebox startup. Implement DEBUG_LL for Qemu RISC-V Virt to make such
early debugging easier.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/riscv/Kconfig.socs           |  1 +
 arch/riscv/include/asm/debug_ll.h | 10 ++++++++--
 common/Kconfig                    |  5 +++++
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/arch/riscv/Kconfig.socs b/arch/riscv/Kconfig.socs
index bd4a44a575ef..b12c795041b0 100644
--- a/arch/riscv/Kconfig.socs
+++ b/arch/riscv/Kconfig.socs
@@ -18,6 +18,7 @@ config SOC_VIRT
 	select RISCV_S_MODE
 	select BOARD_RISCV_GENERIC_DT
 	select HAS_CACHE
+	select HAS_ASM_DEBUG_LL
 	help
 	  Generates an image tht can be be booted by QEMU. The image is called
 	  barebox-dt-2nd.img
diff --git a/arch/riscv/include/asm/debug_ll.h b/arch/riscv/include/asm/debug_ll.h
index a3b9c1c4bcfb..d01b4f09b8e1 100644
--- a/arch/riscv/include/asm/debug_ll.h
+++ b/arch/riscv/include/asm/debug_ll.h
@@ -17,13 +17,19 @@
 #if defined CONFIG_DEBUG_ERIZO
 #define DEBUG_LL_UART_ADDR	0x90000000
 #define DEBUG_LL_UART_CLK       (24000000 / 16)
+#define DEBUG_LL_UART_SHIFT	2
+#define DEBUG_LL_UART_IOSIZE32
 #elif defined CONFIG_DEBUG_STARFIVE
 #define DEBUG_LL_UART_ADDR	0x12440000
 #define DEBUG_LL_UART_CLK       (100000000 / 16)
-#endif
-
 #define DEBUG_LL_UART_SHIFT	2
 #define DEBUG_LL_UART_IOSIZE32
+#elif defined CONFIG_DEBUG_RISCV_VIRT
+#define DEBUG_LL_UART_ADDR	0x10000000
+#define DEBUG_LL_UART_CLK       (58982400  / 16)
+#define DEBUG_LL_UART_SHIFT	0
+#define DEBUG_LL_UART_IOSIZE8
+#endif
 
 #define DEBUG_LL_UART_BPS       CONFIG_BAUDRATE
 #define DEBUG_LL_UART_DIVISOR   (DEBUG_LL_UART_CLK / DEBUG_LL_UART_BPS)
diff --git a/common/Kconfig b/common/Kconfig
index f4120b2083ee..ab6258d90f40 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1402,6 +1402,11 @@ config DEBUG_STARFIVE
 	depends on SOC_STARFIVE
 	select DEBUG_LL_NS16550
 
+config DEBUG_RISCV_VIRT
+	bool "RISC-V Virt ns16550 port"
+	depends on SOC_VIRT
+	select DEBUG_LL_NS16550
+
 config DEBUG_SIFIVE
 	bool "SiFive serial0 port"
 	depends on SOC_SIFIVE
-- 
2.30.2


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


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

* Re: [PATCH] RISC-V: virt: add DEBUG_LL support
  2021-11-25 16:06 [PATCH] RISC-V: virt: add DEBUG_LL support Ahmad Fatoum
@ 2021-12-07  9:11 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2021-12-07  9:11 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Thu, Nov 25, 2021 at 05:06:57PM +0100, Ahmad Fatoum wrote:
> While we have PBL console support, console isn't available during early
> barebox startup. Implement DEBUG_LL for Qemu RISC-V Virt to make such
> early debugging easier.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  arch/riscv/Kconfig.socs           |  1 +
>  arch/riscv/include/asm/debug_ll.h | 10 ++++++++--
>  common/Kconfig                    |  5 +++++
>  3 files changed, 14 insertions(+), 2 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/arch/riscv/Kconfig.socs b/arch/riscv/Kconfig.socs
> index bd4a44a575ef..b12c795041b0 100644
> --- a/arch/riscv/Kconfig.socs
> +++ b/arch/riscv/Kconfig.socs
> @@ -18,6 +18,7 @@ config SOC_VIRT
>  	select RISCV_S_MODE
>  	select BOARD_RISCV_GENERIC_DT
>  	select HAS_CACHE
> +	select HAS_ASM_DEBUG_LL
>  	help
>  	  Generates an image tht can be be booted by QEMU. The image is called
>  	  barebox-dt-2nd.img
> diff --git a/arch/riscv/include/asm/debug_ll.h b/arch/riscv/include/asm/debug_ll.h
> index a3b9c1c4bcfb..d01b4f09b8e1 100644
> --- a/arch/riscv/include/asm/debug_ll.h
> +++ b/arch/riscv/include/asm/debug_ll.h
> @@ -17,13 +17,19 @@
>  #if defined CONFIG_DEBUG_ERIZO
>  #define DEBUG_LL_UART_ADDR	0x90000000
>  #define DEBUG_LL_UART_CLK       (24000000 / 16)
> +#define DEBUG_LL_UART_SHIFT	2
> +#define DEBUG_LL_UART_IOSIZE32
>  #elif defined CONFIG_DEBUG_STARFIVE
>  #define DEBUG_LL_UART_ADDR	0x12440000
>  #define DEBUG_LL_UART_CLK       (100000000 / 16)
> -#endif
> -
>  #define DEBUG_LL_UART_SHIFT	2
>  #define DEBUG_LL_UART_IOSIZE32
> +#elif defined CONFIG_DEBUG_RISCV_VIRT
> +#define DEBUG_LL_UART_ADDR	0x10000000
> +#define DEBUG_LL_UART_CLK       (58982400  / 16)
> +#define DEBUG_LL_UART_SHIFT	0
> +#define DEBUG_LL_UART_IOSIZE8
> +#endif
>  
>  #define DEBUG_LL_UART_BPS       CONFIG_BAUDRATE
>  #define DEBUG_LL_UART_DIVISOR   (DEBUG_LL_UART_CLK / DEBUG_LL_UART_BPS)
> diff --git a/common/Kconfig b/common/Kconfig
> index f4120b2083ee..ab6258d90f40 100644
> --- a/common/Kconfig
> +++ b/common/Kconfig
> @@ -1402,6 +1402,11 @@ config DEBUG_STARFIVE
>  	depends on SOC_STARFIVE
>  	select DEBUG_LL_NS16550
>  
> +config DEBUG_RISCV_VIRT
> +	bool "RISC-V Virt ns16550 port"
> +	depends on SOC_VIRT
> +	select DEBUG_LL_NS16550
> +
>  config DEBUG_SIFIVE
>  	bool "SiFive serial0 port"
>  	depends on SOC_SIFIVE
> -- 
> 2.30.2
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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


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

end of thread, other threads:[~2021-12-07  9:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-25 16:06 [PATCH] RISC-V: virt: add DEBUG_LL support Ahmad Fatoum
2021-12-07  9:11 ` Sascha Hauer

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