From a081568d7016061ed848696984e3acf1ba0b3054 Mon Sep 17 00:00:00 2001 From: Russell King Date: Tue, 28 Mar 2006 10:24:33 +0100 Subject: [ARM] Fix decompressor serial IO to give CRLF not LFCR As per the corresponding change to the serial drivers, arrange for ARM decompressors to give CRLF. Move the common putstr code into misc.c such that machines only need to supply "putc" and "flush" functions. Signed-off-by: Russell King --- arch/arm/boot/compressed/misc.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'arch/arm/boot/compressed/misc.c') diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c index 5ab94584baee..28626ec2d289 100644 --- a/arch/arm/boot/compressed/misc.c +++ b/arch/arm/boot/compressed/misc.c @@ -20,24 +20,32 @@ unsigned int __machine_arch_type; #include -#include - #ifdef STANDALONE_DEBUG #define putstr printf -#endif +#else -#ifdef CONFIG_DEBUG_ICEDCC -#define putstr icedcc_putstr -#define putc icedcc_putc +static void putstr(const char *ptr); +#include +#include + +#ifdef CONFIG_DEBUG_ICEDCC extern void icedcc_putc(int ch); +#define putc(ch) icedcc_putc(ch) +#define flush() do { } while (0) +#endif -static void -icedcc_putstr(const char *ptr) +static void putstr(const char *ptr) { - for (; *ptr != '\0'; ptr++) { - icedcc_putc(*ptr); + char c; + + while ((c = *ptr++) != '\0') { + if (c == '\n') + putc('\r'); + putc(c); } + + flush(); } #endif -- cgit v1.2.3 From de4533a04eb4f66dbef71f59a9c118256b886823 Mon Sep 17 00:00:00 2001 From: Russell King Date: Tue, 28 Mar 2006 10:34:05 +0100 Subject: [ARM] Move ice-dcc code into misc.c Signed-off-by: Russell King --- arch/arm/boot/compressed/misc.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'arch/arm/boot/compressed/misc.c') diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c index 28626ec2d289..0af3772efcb7 100644 --- a/arch/arm/boot/compressed/misc.c +++ b/arch/arm/boot/compressed/misc.c @@ -30,7 +30,20 @@ static void putstr(const char *ptr); #include #ifdef CONFIG_DEBUG_ICEDCC -extern void icedcc_putc(int ch); +static void icedcc_putc(int ch) +{ + int status, i = 0x4000000; + + do { + if (--i < 0) + return; + + asm("mrc p14, 0, %0, c0, c0, 0" : "=r" (status)); + } while (status & 2); + + asm("mcr p15, 0, %0, c1, c0, 0" : : "r" (ch)); +} + #define putc(ch) icedcc_putc(ch) #define flush() do { } while (0) #endif -- cgit v1.2.3