[RFC PATCH 05/11] arm: sunxi: Add debug_ll
Ahmad Fatoum
a.fatoum at pengutronix.de
Thu May 18 12:05:21 PDT 2023
On 11.05.23 01:37, Jules Maselbas wrote:
> ---
> arch/arm/include/asm/debug_ll.h | 2 ++
> arch/arm/mach-sunxi/Kconfig | 4 ++++
> include/mach/sunxi/debug_ll.h | 35 +++++++++++++++++++++++++++++++++
> 3 files changed, 41 insertions(+)
> create mode 100644 include/mach/sunxi/debug_ll.h
>
> diff --git a/arch/arm/include/asm/debug_ll.h b/arch/arm/include/asm/debug_ll.h
> index a1d5161ccf..054d021bab 100644
> --- a/arch/arm/include/asm/debug_ll.h
> +++ b/arch/arm/include/asm/debug_ll.h
> @@ -50,6 +50,8 @@
> #include <mach/uemd/debug_ll.h>
> #elif defined CONFIG_ARCH_SOCFPGA
> #include <mach/socfpga/debug_ll.h>
> +#elif defined CONFIG_ARCH_SUNXI
> +#include <mach/sunxi/debug_ll.h>
> #elif defined CONFIG_ARCH_PXA
> #include <mach/pxa/debug_ll.h>
> #elif defined CONFIG_ARCH_NOMADIK
> diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
> index e28f04c354..2580a9e56a 100644
> --- a/arch/arm/mach-sunxi/Kconfig
> +++ b/arch/arm/mach-sunxi/Kconfig
> @@ -9,6 +9,10 @@ config SUNXI_RVBAR_IOMAP
> default 0x017000a0 if ARCH_SUN50I_A64
> # default 0x09010040 if ARCH_SUN50I_H5
>
> +config SUNXI_DEBUG_LL_UART_BASE
> + hex
> + default 0x01c28000
> +
> menuconfig SUNXI_MULTI_BOARDS
> bool "Allwinner boards"
> select HAVE_PBL_MULTI_IMAGES
> diff --git a/include/mach/sunxi/debug_ll.h b/include/mach/sunxi/debug_ll.h
> new file mode 100644
> index 0000000000..64c65a5917
> --- /dev/null
> +++ b/include/mach/sunxi/debug_ll.h
> @@ -0,0 +1,35 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +
> +#ifndef __MACH_DEBUG_LL_H__
> +#define __MACH_DEBUG_LL_H__
> +
> +#include <io.h>
> +
> +#define DEBUG_LL_UART_ADDR CONFIG_SUNXI_DEBUG_LL_UART_BASE
> +
> +static inline uint8_t debug_ll_read_reg(int reg)
> +{
> + return readl(IOMEM(DEBUG_LL_UART_ADDR) + reg * sizeof(uint32_t));
> +}
> +
> +static inline void debug_ll_write_reg(int reg, uint8_t val)
> +{
> + writel(val, IOMEM(DEBUG_LL_UART_ADDR) + reg * sizeof(uint32_t));
> +}
> +
> +#include <debug_ll/ns16550.h>
> +
> +static inline void debug_ll_init(void)
> +{
> + uint16_t divisor;
Call sunxi_uart_setup here?
> +
> + divisor = debug_ll_ns16550_calc_divisor(24 * 1000 * 1000);
> + debug_ll_ns16550_init(divisor);
> +}
> +
> +static inline void PUTC_LL(int c)
> +{
> + debug_ll_ns16550_putc(c);
> +}
> +
> +#endif
--
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 |
More information about the barebox
mailing list