提交 26f7a7de 编写于 作者: M Masahiro Yamada

serial: uniphier: flush transmitter before changing hardware settings

Ensure the transmitter is empty when chaining the baudrate or any
hardware settings. If a character is remaining in the transmitter,
the console will be garbled.
Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
上级 70434ab9
......@@ -43,6 +43,10 @@ static int uniphier_serial_setbrg(struct udevice *dev, int baudrate)
divisor = DIV_ROUND_CLOSEST(priv->uartclk, mode_x_div * baudrate);
/* flush the trasmitter before changing hw setting */
while (!(readl(priv->membase + UNIPHIER_UART_LSR) & UART_LSR_TEMT))
;
writel(divisor, priv->membase + UNIPHIER_UART_DLR);
return 0;
......@@ -132,6 +136,10 @@ static int uniphier_serial_probe(struct udevice *dev)
priv->uartclk = clk_data->clk_rate;
/* flush the trasmitter empty before changing hw setting */
while (!(readl(priv->membase + UNIPHIER_UART_LSR) & UART_LSR_TEMT))
;
tmp = readl(priv->membase + UNIPHIER_UART_LCR_MCR);
tmp &= ~UNIPHIER_UART_LCR_MASK;
tmp |= FIELD_PREP(UNIPHIER_UART_LCR_MASK, UART_LCR_WLEN8);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册