Re: [U-Boot] [PATCH v2 14/18] serial: 16550: allow the driver to support MediaTek serial

2018-10-24 Thread Simon Glass
On 12 October 2018 at 01:01, Ryder Lee  wrote:
> This patch adds an extra operation in ns16550.c to suuport MediaTek
> SoCs as we have a highspeed register which influences the calcualtion
> of the divisor.
>
> Note that we don't support the baudrate greater than 115200 currently.
>
> Signed-off-by: Ryder Lee 
> Tested-by: Matthias Brugger 
> ---
>  drivers/serial/ns16550.c | 10 ++
>  1 file changed, 10 insertions(+)
>

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 14/18] serial: 16550: allow the driver to support MediaTek serial

2018-10-12 Thread Ryder Lee
This patch adds an extra operation in ns16550.c to suuport MediaTek
SoCs as we have a highspeed register which influences the calcualtion
of the divisor.

Note that we don't support the baudrate greater than 115200 currently.

Signed-off-by: Ryder Lee 
Tested-by: Matthias Brugger 
---
 drivers/serial/ns16550.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index f9041aa..f5410af 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -148,6 +148,13 @@ int ns16550_calc_divisor(NS16550_t port, int clock, int 
baudrate)
 
 static void NS16550_setbrg(NS16550_t com_port, int baud_divisor)
 {
+#ifdef CONFIG_ARCH_MEDIATEK
+   /*
+* MediaTek UARTs has an extra highspeed register.
+* We need to clear it if baudrate <= 115200.
+*/
+   serial_out(0, _port->reg9);
+#endif
serial_out(UART_LCR_BKSE | UART_LCRVAL, _port->lcr);
serial_out(baud_divisor & 0xff, _port->dll);
serial_out((baud_divisor >> 8) & 0xff, _port->dlm);
@@ -261,6 +268,9 @@ static inline void _debug_uart_init(void)
serial_dout(_port->mcr, UART_MCRVAL);
serial_dout(_port->fcr, UART_FCR_DEFVAL);
 
+#ifdef CONFIG_ARCH_MEDIATEK
+   serial_dout(_port->reg9, 0);
+#endif
serial_dout(_port->lcr, UART_LCR_BKSE | UART_LCRVAL);
serial_dout(_port->dll, baud_divisor & 0xff);
serial_dout(_port->dlm, (baud_divisor >> 8) & 0xff);
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot