[U-Boot] [PATCH v6 07/10] ns16550: map register base address for debug UART
Thomas Chou
thomas at wytron.com.tw
Mon Jan 4 14:07:50 CET 2016
Hi Wills,
On 2016年01月04日 19:14, Wills Wang wrote:
> MIPS need to use KSEG1 address for register operation, this patch
> add map_physmem to convert CONFIG_DEBUG_UART_BASE for debug UART.
>
> Signed-off-by: Wills Wang <wills.wang at live.com>
> ---
>
> Changes in v6: None
> Changes in v5: None
> Changes in v4: None
> Changes in v3: None
> Changes in v2: None
>
> drivers/serial/ns16550.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
> index 3b24af0..1e2538e 100644
> --- a/drivers/serial/ns16550.c
> +++ b/drivers/serial/ns16550.c
> @@ -270,7 +270,8 @@ int NS16550_tstc(NS16550_t com_port)
>
> static inline void _debug_uart_init(void)
> {
> - struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE;
> + struct NS16550 *com_port = (struct NS16550 *)map_physmem(
> + CONFIG_DEBUG_UART_BASE, 0, MAP_NOCACHE);
> int baud_divisor;
>
> /*
> @@ -293,7 +294,8 @@ static inline void _debug_uart_init(void)
>
> static inline void _debug_uart_putc(int ch)
> {
> - struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE;
> + struct NS16550 *com_port = (struct NS16550 *)map_physmem(
> + CONFIG_DEBUG_UART_BASE, 0, MAP_NOCACHE);
>
> while (!(serial_din(&com_port->lsr) & UART_LSR_THRE))
> ;
>
As debug uart may be used in very early stage and SPL, I would suggest
the CONFIG_DEBUG_UART_BASE here is mapped to uncached space already. So
that we can keep the code and stack usage minimal.
My concern is that the uncache mapping in nios2 arch is different
between NOMMU and MMU core, which will be decoded from device tree. So
it won't work for nios2 until DM initialized.
Naked-by: Thomas Chou <thomas at wytron.com.tw>
Best regards,
Thomas
More information about the U-Boot
mailing list