[RFC PATCH 05/11] arm: sunxi: Add debug_ll

Jules Maselbas jmaselbas at zdiv.net
Fri May 19 03:36:16 PDT 2023


On Thu, May 18, 2023 at 09:05:21PM +0200, Ahmad Fatoum wrote:
> On 11.05.23 01:37, Jules Maselbas wrote:
snip
> > 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?
While taking look at this, the initial code (in sun50i_cpu_lowlevel_init)
and now the lowlevel board code. There is bits done every where, and the
acctual pin mux is done in lowlevel board code, in a function setup_uart.
I think I will "fuse" setup_uart and the bits originally done by
sun50i_cpu_lowlevel_init: lowlevel code will call sunxi_uart_setup (for
clock gating, un-reset and pinmux).
 
> > +
> > +	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