mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM: stm32mp: define stm32_serial_putc for use with pbl_set_putc
@ 2023-11-01 12:07 Ahmad Fatoum
  2023-11-03  7:37 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2023-11-01 12:07 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Unlike other debug_ll headers, such as i.MX's or AT91, the STM32MP1 header
only defined PUTC_LL, but no function suitable for use with
pbl_set_putc.

Remedy that, so PBL entry points can benefit from CONFIG_PBL_CONSOLE and
while at it, add the missing header that defines BIT().

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 include/mach/stm32mp/debug_ll.h | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/mach/stm32mp/debug_ll.h b/include/mach/stm32mp/debug_ll.h
index 03bb60a239c1..0d88910c1375 100644
--- a/include/mach/stm32mp/debug_ll.h
+++ b/include/mach/stm32mp/debug_ll.h
@@ -5,6 +5,7 @@
 
 #include <io.h>
 #include <mach/stm32mp/stm32.h>
+#include <linux/bitops.h>
 
 #define DEBUG_LL_UART_ADDR	STM32_UART4_BASE
 
@@ -18,13 +19,18 @@
 
 #define USART_ISR_TXE	BIT(7)
 
-static inline void PUTC_LL(int c)
+static inline void stm32_serial_putc(void *ctx, int c)
 {
-	void __iomem *base = IOMEM(DEBUG_LL_UART_ADDR);
+	void __iomem *base = IOMEM(ctx);
 
 	writel(c, base + TDR_OFFSET);
 
 	while ((readl(base + ISR_OFFSET) & USART_ISR_TXE) == 0);
 }
 
+static inline void PUTC_LL(int c)
+{
+	stm32_serial_putc(IOMEM(DEBUG_LL_UART_ADDR), c);
+}
+
 #endif /* __MACH_STM32MP1_DEBUG_LL_H */
-- 
2.39.2




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

* Re: [PATCH] ARM: stm32mp: define stm32_serial_putc for use with pbl_set_putc
  2023-11-01 12:07 [PATCH] ARM: stm32mp: define stm32_serial_putc for use with pbl_set_putc Ahmad Fatoum
@ 2023-11-03  7:37 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2023-11-03  7:37 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Wed, Nov 01, 2023 at 01:07:38PM +0100, Ahmad Fatoum wrote:
> Unlike other debug_ll headers, such as i.MX's or AT91, the STM32MP1 header
> only defined PUTC_LL, but no function suitable for use with
> pbl_set_putc.
> 
> Remedy that, so PBL entry points can benefit from CONFIG_PBL_CONSOLE and
> while at it, add the missing header that defines BIT().
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  include/mach/stm32mp/debug_ll.h | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/include/mach/stm32mp/debug_ll.h b/include/mach/stm32mp/debug_ll.h
> index 03bb60a239c1..0d88910c1375 100644
> --- a/include/mach/stm32mp/debug_ll.h
> +++ b/include/mach/stm32mp/debug_ll.h
> @@ -5,6 +5,7 @@
>  
>  #include <io.h>
>  #include <mach/stm32mp/stm32.h>
> +#include <linux/bitops.h>
>  
>  #define DEBUG_LL_UART_ADDR	STM32_UART4_BASE
>  
> @@ -18,13 +19,18 @@
>  
>  #define USART_ISR_TXE	BIT(7)
>  
> -static inline void PUTC_LL(int c)
> +static inline void stm32_serial_putc(void *ctx, int c)
>  {
> -	void __iomem *base = IOMEM(DEBUG_LL_UART_ADDR);
> +	void __iomem *base = IOMEM(ctx);
>  
>  	writel(c, base + TDR_OFFSET);
>  
>  	while ((readl(base + ISR_OFFSET) & USART_ISR_TXE) == 0);
>  }
>  
> +static inline void PUTC_LL(int c)
> +{
> +	stm32_serial_putc(IOMEM(DEBUG_LL_UART_ADDR), c);
> +}
> +
>  #endif /* __MACH_STM32MP1_DEBUG_LL_H */
> -- 
> 2.39.2
> 
> 
> 

-- 
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 |



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

end of thread, other threads:[~2023-11-03  7:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-01 12:07 [PATCH] ARM: stm32mp: define stm32_serial_putc for use with pbl_set_putc Ahmad Fatoum
2023-11-03  7:37 ` Sascha Hauer

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