* [RFC] ARM: OMAP: debug_ll: Add support for PBL console
@ 2022-05-05 9:42 Alexander Shiyan
2022-05-05 9:59 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Shiyan @ 2022-05-05 9:42 UTC (permalink / raw)
To: barebox; +Cc: Alexander Shiyan
Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
---
arch/arm/boards/myirtech-x335x/lowlevel.c | 10 ++++------
arch/arm/mach-omap/include/mach/debug_ll.h | 20 ++++++++++++++------
2 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/arch/arm/boards/myirtech-x335x/lowlevel.c b/arch/arm/boards/myirtech-x335x/lowlevel.c
index 1a883da203..f9f3ec4ddf 100644
--- a/arch/arm/boards/myirtech-x335x/lowlevel.c
+++ b/arch/arm/boards/myirtech-x335x/lowlevel.c
@@ -95,12 +95,10 @@ ENTRY_FUNCTION(start_am33xx_myirtech_sram, bootinfo, r1, r2)
am335x_sdram_init(0x18b, &ddr3_cmd_ctrl, &ddr3_regs, &ddr3_data);
}
- if (IS_ENABLED(CONFIG_DEBUG_LL)) {
- am33xx_uart_soft_reset(IOMEM(AM33XX_UART0_BASE));
- am33xx_enable_uart0_pin_mux();
- omap_uart_lowlevel_init(IOMEM(AM33XX_UART0_BASE));
- putc_ll('>');
- }
+ am33xx_uart_soft_reset(IOMEM(AM33XX_UART0_BASE));
+ am33xx_enable_uart0_pin_mux();
+ omap_uart_lowlevel_init(IOMEM(AM33XX_UART0_BASE));
+ pr_debug("MYIR MYC-AM335X\n");
am335x_barebox_entry(fdt);
}
diff --git a/arch/arm/mach-omap/include/mach/debug_ll.h b/arch/arm/mach-omap/include/mach/debug_ll.h
index 25ddd485be..018171d112 100644
--- a/arch/arm/mach-omap/include/mach/debug_ll.h
+++ b/arch/arm/mach-omap/include/mach/debug_ll.h
@@ -17,6 +17,7 @@
#ifndef __MACH_DEBUG_LL_H__
#define __MACH_DEBUG_LL_H__
+#include <console.h>
#include <io.h>
#include <mach/omap3-silicon.h>
#include <mach/omap4-silicon.h>
@@ -34,6 +35,16 @@
#define MCR (4 << 2)
#define MDR (8 << 2)
+static inline void omap_uart_putc(void *base, int c)
+{
+ /* Wait until there is space in the FIFO */
+ while ((readb(base + LSR) & LSR_THRE) == 0);
+ /* Send the character */
+ writeb(c, base + THR);
+ /* Wait to make sure it hits the line, in case we die too soon. */
+ while ((readb(base + LSR) & LSR_THRE) == 0);
+}
+
static inline void omap_uart_lowlevel_init(void __iomem *base)
{
writeb(0x00, base + LCR);
@@ -46,6 +57,8 @@ static inline void omap_uart_lowlevel_init(void __iomem *base)
writeb(0x03, base + MCR);
writeb(0x07, base + FCR);
writeb(0x00, base + MDR);
+
+ pbl_set_putc(omap_uart_putc, base);
}
#ifdef CONFIG_DEBUG_LL
@@ -68,12 +81,7 @@ static inline void PUTC_LL(char c)
void __iomem *base = (void *)OMAP_UART_BASE(OMAP_DEBUG_SOC,
CONFIG_DEBUG_OMAP_UART_PORT);
- /* Wait until there is space in the FIFO */
- while ((readb(base + LSR) & LSR_THRE) == 0);
- /* Send the character */
- writeb(c, base + THR);
- /* Wait to make sure it hits the line, in case we die too soon. */
- while ((readb(base + LSR) & LSR_THRE) == 0);
+ omap_uart_putc(base, c);
}
#endif
--
2.32.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [RFC] ARM: OMAP: debug_ll: Add support for PBL console
2022-05-05 9:42 [RFC] ARM: OMAP: debug_ll: Add support for PBL console Alexander Shiyan
@ 2022-05-05 9:59 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2022-05-05 9:59 UTC (permalink / raw)
To: Alexander Shiyan; +Cc: barebox
On Thu, May 05, 2022 at 12:42:54PM +0300, Alexander Shiyan wrote:
> Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
> ---
> arch/arm/boards/myirtech-x335x/lowlevel.c | 10 ++++------
> arch/arm/mach-omap/include/mach/debug_ll.h | 20 ++++++++++++++------
> 2 files changed, 18 insertions(+), 12 deletions(-)
>
> diff --git a/arch/arm/boards/myirtech-x335x/lowlevel.c b/arch/arm/boards/myirtech-x335x/lowlevel.c
> index 1a883da203..f9f3ec4ddf 100644
> --- a/arch/arm/boards/myirtech-x335x/lowlevel.c
> +++ b/arch/arm/boards/myirtech-x335x/lowlevel.c
> @@ -95,12 +95,10 @@ ENTRY_FUNCTION(start_am33xx_myirtech_sram, bootinfo, r1, r2)
> am335x_sdram_init(0x18b, &ddr3_cmd_ctrl, &ddr3_regs, &ddr3_data);
> }
>
> - if (IS_ENABLED(CONFIG_DEBUG_LL)) {
> - am33xx_uart_soft_reset(IOMEM(AM33XX_UART0_BASE));
> - am33xx_enable_uart0_pin_mux();
> - omap_uart_lowlevel_init(IOMEM(AM33XX_UART0_BASE));
> - putc_ll('>');
> - }
> + am33xx_uart_soft_reset(IOMEM(AM33XX_UART0_BASE));
> + am33xx_enable_uart0_pin_mux();
> + omap_uart_lowlevel_init(IOMEM(AM33XX_UART0_BASE));
> + pr_debug("MYIR MYC-AM335X\n");
>
> am335x_barebox_entry(fdt);
> }
> diff --git a/arch/arm/mach-omap/include/mach/debug_ll.h b/arch/arm/mach-omap/include/mach/debug_ll.h
> index 25ddd485be..018171d112 100644
> --- a/arch/arm/mach-omap/include/mach/debug_ll.h
> +++ b/arch/arm/mach-omap/include/mach/debug_ll.h
> @@ -17,6 +17,7 @@
> #ifndef __MACH_DEBUG_LL_H__
> #define __MACH_DEBUG_LL_H__
>
> +#include <console.h>
> #include <io.h>
> #include <mach/omap3-silicon.h>
> #include <mach/omap4-silicon.h>
> @@ -34,6 +35,16 @@
> #define MCR (4 << 2)
> #define MDR (8 << 2)
>
> +static inline void omap_uart_putc(void *base, int c)
> +{
> + /* Wait until there is space in the FIFO */
> + while ((readb(base + LSR) & LSR_THRE) == 0);
> + /* Send the character */
> + writeb(c, base + THR);
> + /* Wait to make sure it hits the line, in case we die too soon. */
> + while ((readb(base + LSR) & LSR_THRE) == 0);
> +}
> +
> static inline void omap_uart_lowlevel_init(void __iomem *base)
> {
> writeb(0x00, base + LCR);
> @@ -46,6 +57,8 @@ static inline void omap_uart_lowlevel_init(void __iomem *base)
> writeb(0x03, base + MCR);
> writeb(0x07, base + FCR);
> writeb(0x00, base + MDR);
> +
> + pbl_set_putc(omap_uart_putc, base);
This should be called by the board code. pbl_set_putc() will only work
when we a running in a full C environment, i.e. we are running at the
address we are linked at. omap_uart_lowlevel_init() doesn't have this
constraint and could be used earlier.
Otherwise looks good.
Sascha
--
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:[~2022-05-05 10:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-05 9:42 [RFC] ARM: OMAP: debug_ll: Add support for PBL console Alexander Shiyan
2022-05-05 9:59 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox