Skip to contentSkip to conversation

ARM: earlycon: Fix <CR><LF><CR> end-of-line

PATCH New Alexander Sverdlin 2 participants 5 messages Sep 27, 2017 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

cover ARM: earlycon: Fix <CR><LF><CR> end-of-line

Since very beginning the early serial console on ARM produces <CR><LF><CR> line terminator. There are couple of problems connected:
1. C function early_write() adds <CR> to each <LF> even though underlying Assembler printch() does this already
2. printch() adds <CR> *after* <LF>, not before, as it is usually being done

This patchset is tested on a Keystone2 machine (Cortex-A15) with CONFIG_THUMB2_KERNEL=n.

Alexander Sverdlin (2):
ARM: Make DEBUG_LL produce CRLF instead of LFCR
ARM: early_printk: Stop emitting double CR on the console

 arch/arm/kernel/debug.S        | 11 +++++++----
 arch/arm/kernel/early_printk.c |  2 --
 2 files changed, 7 insertions(+), 6 deletions(-)
Signature · 1 line
2.4.6
#1 lore raw

PATCH 1/2 ARM: Make DEBUG_LL produce CRLF instead of LFCR

This change almost doubles the usage of DEBUG_LL macros but in exchange terminates all the console output with CRLF not LFCR.

---
 arch/arm/kernel/debug.S | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
arch/arm/kernel/debug.S +7 -4
index ea9646c..ca502cc 100644
@@ -80,12 +80,15 @@ hexbuf:		.space 16
 ENTRY(printascii)
 		addruart_current r3, r1, r2
 		b	2f
-1:		waituart r2, r3
+1:		teq	r1, #'\n'
+		bne	3f
+		waituart r2, r3
+		mov	r2, #'\r'
+		senduart r2, r3
+		busyuart r2, r3
+3:		waituart r2, r3
 		senduart r1, r3
 		busyuart r2, r3
-		teq	r1, #'\n'
-		moveq	r1, #'\r'
-		beq	1b
 2:		teq	r0, #0
 		ldrneb	r1, [r0], #1
 		teqne	r1, #0
Signature · 1 line
2.4.6
#2 lore raw

PATCH 2/2 ARM: early_printk: Stop emitting double CR on the console

In reply to Alexander Sverdlin

printch already takes care about LF->CRLF translation, so early_write() just produced extra CR.

---
 arch/arm/kernel/early_printk.c | 2 --
 1 file changed, 2 deletions(-)
arch/arm/kernel/early_printk.c +0 -2
index 4307653..8300d5b 100644
@@ -17,8 +17,6 @@ extern void printch(int);
 static void early_write(const char *s, unsigned n)
 {
 	while (n-- > 0) {
-		if (*s == '\n')
-			printch('\r');
 		printch(*s);
 		s++;
 	}
Signature · 1 line
2.4.6
#3 lore raw

cover ARM: earlycon: Fix <CR><LF><CR> end-of-line

In reply to Alexander Sverdlin
Quoted 5 lines · Alexander Sverdlin

Since very beginning the early serial console on ARM produces <CR><LF><CR> line terminator. There are couple of problems connected:
1. C function early_write() adds <CR> to each <LF> even though underlying Assembler printch() does this already
2. printch() adds <CR> *after* <LF>, not before, as it is usually being done

You omit to say why you want this change...

Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up
#4 lore raw

cover ARM: earlycon: Fix <CR><LF><CR> end-of-line

Quoted 6 lines · Russell King - ARM Linux
Quoted 5 lines

Since very beginning the early serial console on ARM produces <CR><LF><CR> line terminator. There are couple of problems connected:
1. C function early_write() adds <CR> to each <LF> even though underlying Assembler printch() does this already
2. printch() adds <CR> *after* <LF>, not before, as it is usually being done

You omit to say why you want this change...

Well, only because it produces normal serial log after the change, as all other ARCHs do. Depending on the viewer one either doesn't have extra "^M" at the beginning of each line or the lines are not interlaced (with extra empty lines) any more.

Signature · 2 lines
Best regards,
Alexander Sverdlin.