public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] serial: stm32: Automatically generate CR when LF is observed
@ 2015-05-12 19:25 Daniel Thompson
  2015-05-12 20:35 ` Kamil Lulko
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Thompson @ 2015-05-12 19:25 UTC (permalink / raw)
  To: u-boot

Currently the u-boot output looks rather odd when running the minicom
terminal emulator in its default mode (just a string of "random" looking
text down the right hand side of the screen).

This is caused by a combination of minicom not automatically wrapping
lines and the stm32 serial driver never sending a carriage return.

Issue is trivially solved by automatically generating a CR whenever a LF
is transmitted, Several other serial drivers implement this behaviour.

Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Kamil Lulko <rev13@wp.pl>
---
 drivers/serial/serial_stm32.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/serial/serial_stm32.c b/drivers/serial/serial_stm32.c
index 3c80096..8c613db 100644
--- a/drivers/serial/serial_stm32.c
+++ b/drivers/serial/serial_stm32.c
@@ -81,6 +81,10 @@ static int stm32_serial_getc(void)
 static void stm32_serial_putc(const char c)
 {
 	struct stm32_serial *usart = (struct stm32_serial *)USART_BASE;
+
+	if (c == '\n')
+		stm32_serial_putc('\r');
+
 	while ((readl(&usart->sr) & USART_SR_FLAG_TXE) == 0)
 		;
 	writel(c, &usart->dr);
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-05-13 14:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-12 19:25 [U-Boot] [PATCH] serial: stm32: Automatically generate CR when LF is observed Daniel Thompson
2015-05-12 20:35 ` Kamil Lulko
2015-05-12 21:56   ` Tom Rini
2015-05-13  4:41     ` Kunhua Huang
2015-05-13 14:11     ` Daniel Thompson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox