diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2006-03-28 04:24:33 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-03-28 04:24:33 -0500 |
commit | a081568d7016061ed848696984e3acf1ba0b3054 (patch) | |
tree | 5a6cd28d51e3c0b694499f4d0795b22a3d020eba | |
parent | 3747b36eeab93d8969e86987bbc1d44971229b26 (diff) |
[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 <rmk+kernel@arm.linux.org.uk>
24 files changed, 187 insertions, 289 deletions
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; | |||
20 | 20 | ||
21 | #include <linux/string.h> | 21 | #include <linux/string.h> |
22 | 22 | ||
23 | #include <asm/arch/uncompress.h> | ||
24 | |||
25 | #ifdef STANDALONE_DEBUG | 23 | #ifdef STANDALONE_DEBUG |
26 | #define putstr printf | 24 | #define putstr printf |
27 | #endif | 25 | #else |
28 | 26 | ||
29 | #ifdef CONFIG_DEBUG_ICEDCC | 27 | static void putstr(const char *ptr); |
30 | #define putstr icedcc_putstr | ||
31 | #define putc icedcc_putc | ||
32 | 28 | ||
29 | #include <linux/compiler.h> | ||
30 | #include <asm/arch/uncompress.h> | ||
31 | |||
32 | #ifdef CONFIG_DEBUG_ICEDCC | ||
33 | extern void icedcc_putc(int ch); | 33 | extern void icedcc_putc(int ch); |
34 | #define putc(ch) icedcc_putc(ch) | ||
35 | #define flush() do { } while (0) | ||
36 | #endif | ||
34 | 37 | ||
35 | static void | 38 | static void putstr(const char *ptr) |
36 | icedcc_putstr(const char *ptr) | ||
37 | { | 39 | { |
38 | for (; *ptr != '\0'; ptr++) { | 40 | char c; |
39 | icedcc_putc(*ptr); | 41 | |
42 | while ((c = *ptr++) != '\0') { | ||
43 | if (c == '\n') | ||
44 | putc('\r'); | ||
45 | putc(c); | ||
40 | } | 46 | } |
47 | |||
48 | flush(); | ||
41 | } | 49 | } |
42 | 50 | ||
43 | #endif | 51 | #endif |
diff --git a/include/asm-arm/arch-aaec2000/uncompress.h b/include/asm-arm/arch-aaec2000/uncompress.h index fff0c94b75c4..300f4bf3bc74 100644 --- a/include/asm-arm/arch-aaec2000/uncompress.h +++ b/include/asm-arm/arch-aaec2000/uncompress.h | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | #define UART(x) (*(volatile unsigned long *)(serial_port + (x))) | 16 | #define UART(x) (*(volatile unsigned long *)(serial_port + (x))) |
17 | 17 | ||
18 | static void putstr( const char *s ) | 18 | static void putc(int c) |
19 | { | 19 | { |
20 | unsigned long serial_port; | 20 | unsigned long serial_port; |
21 | do { | 21 | do { |
@@ -28,17 +28,16 @@ static void putstr( const char *s ) | |||
28 | return; | 28 | return; |
29 | } while (0); | 29 | } while (0); |
30 | 30 | ||
31 | for (; *s; s++) { | 31 | /* wait for space in the UART's transmitter */ |
32 | /* wait for space in the UART's transmitter */ | 32 | while ((UART(UART_SR) & UART_SR_TxFF)) |
33 | while ((UART(UART_SR) & UART_SR_TxFF)); | 33 | barrier(); |
34 | /* send the character out. */ | 34 | |
35 | UART(UART_DR) = *s; | 35 | /* send the character out. */ |
36 | /* if a LF, also do CR... */ | 36 | UART(UART_DR) = c; |
37 | if (*s == 10) { | 37 | } |
38 | while ((UART(UART_SR) & UART_SR_TxFF)); | 38 | |
39 | UART(UART_DR) = 13; | 39 | static inline void flush(void) |
40 | } | 40 | { |
41 | } | ||
42 | } | 41 | } |
43 | 42 | ||
44 | #define arch_decomp_setup() | 43 | #define arch_decomp_setup() |
diff --git a/include/asm-arm/arch-at91rm9200/uncompress.h b/include/asm-arm/arch-at91rm9200/uncompress.h index b30dd5520713..7b38497c24b5 100644 --- a/include/asm-arm/arch-at91rm9200/uncompress.h +++ b/include/asm-arm/arch-at91rm9200/uncompress.h | |||
@@ -31,21 +31,22 @@ | |||
31 | * | 31 | * |
32 | * This does not append a newline | 32 | * This does not append a newline |
33 | */ | 33 | */ |
34 | static void putstr(const char *s) | 34 | static void putc(int c) |
35 | { | ||
36 | void __iomem *sys = (void __iomem *) AT91_BASE_SYS; /* physical address */ | ||
37 | |||
38 | while (!(__raw_readl(sys + AT91_DBGU_SR) & AT91_DBGU_TXRDY)) | ||
39 | barrier(); | ||
40 | __raw_writel(c, sys + AT91_DBGU_THR); | ||
41 | } | ||
42 | |||
43 | static inline void flush(void) | ||
35 | { | 44 | { |
36 | void __iomem *sys = (void __iomem *) AT91_BASE_SYS; /* physical address */ | 45 | void __iomem *sys = (void __iomem *) AT91_BASE_SYS; /* physical address */ |
37 | 46 | ||
38 | while (*s) { | ||
39 | while (!(__raw_readl(sys + AT91_DBGU_SR) & AT91_DBGU_TXRDY)) { barrier(); } | ||
40 | __raw_writel(*s, sys + AT91_DBGU_THR); | ||
41 | if (*s == '\n') { | ||
42 | while (!(__raw_readl(sys + AT91_DBGU_SR) & AT91_DBGU_TXRDY)) { barrier(); } | ||
43 | __raw_writel('\r', sys + AT91_DBGU_THR); | ||
44 | } | ||
45 | s++; | ||
46 | } | ||
47 | /* wait for transmission to complete */ | 47 | /* wait for transmission to complete */ |
48 | while (!(__raw_readl(sys + AT91_DBGU_SR) & AT91_DBGU_TXEMPTY)) { barrier(); } | 48 | while (!(__raw_readl(sys + AT91_DBGU_SR) & AT91_DBGU_TXEMPTY)) |
49 | barrier(); | ||
49 | } | 50 | } |
50 | 51 | ||
51 | #define arch_decomp_setup() | 52 | #define arch_decomp_setup() |
diff --git a/include/asm-arm/arch-cl7500/uncompress.h b/include/asm-arm/arch-cl7500/uncompress.h index 68601b3e3b95..c437e0c88c3f 100644 --- a/include/asm-arm/arch-cl7500/uncompress.h +++ b/include/asm-arm/arch-cl7500/uncompress.h | |||
@@ -3,27 +3,19 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 1999, 2000 Nexus Electronics Ltd. | 4 | * Copyright (C) 1999, 2000 Nexus Electronics Ltd. |
5 | */ | 5 | */ |
6 | |||
7 | #define BASE 0x03010000 | 6 | #define BASE 0x03010000 |
8 | #define SERBASE (BASE + (0x2f8 << 2)) | 7 | #define SERBASE (BASE + (0x2f8 << 2)) |
9 | 8 | ||
10 | static __inline__ void putc(char c) | 9 | static inline void putc(char c) |
11 | { | 10 | { |
12 | while (!(*((volatile unsigned int *)(SERBASE + 0x14)) & 0x20)); | 11 | while (!(*((volatile unsigned int *)(SERBASE + 0x14)) & 0x20)) |
12 | barrier(); | ||
13 | |||
13 | *((volatile unsigned int *)(SERBASE)) = c; | 14 | *((volatile unsigned int *)(SERBASE)) = c; |
14 | } | 15 | } |
15 | 16 | ||
16 | /* | 17 | static inline void flush(void) |
17 | * This does not append a newline | ||
18 | */ | ||
19 | static void putstr(const char *s) | ||
20 | { | 18 | { |
21 | while (*s) { | ||
22 | putc(*s); | ||
23 | if (*s == '\n') | ||
24 | putc('\r'); | ||
25 | s++; | ||
26 | } | ||
27 | } | 19 | } |
28 | 20 | ||
29 | static __inline__ void arch_decomp_setup(void) | 21 | static __inline__ void arch_decomp_setup(void) |
diff --git a/include/asm-arm/arch-clps711x/uncompress.h b/include/asm-arm/arch-clps711x/uncompress.h index 9fc4bcfa1681..07157b7e4b20 100644 --- a/include/asm-arm/arch-clps711x/uncompress.h +++ b/include/asm-arm/arch-clps711x/uncompress.h | |||
@@ -25,7 +25,6 @@ | |||
25 | #undef CLPS7111_BASE | 25 | #undef CLPS7111_BASE |
26 | #define CLPS7111_BASE CLPS7111_PHYS_BASE | 26 | #define CLPS7111_BASE CLPS7111_PHYS_BASE |
27 | 27 | ||
28 | #define barrier() __asm__ __volatile__("": : :"memory") | ||
29 | #define __raw_readl(p) (*(unsigned long *)(p)) | 28 | #define __raw_readl(p) (*(unsigned long *)(p)) |
30 | #define __raw_writel(v,p) (*(unsigned long *)(p) = (v)) | 29 | #define __raw_writel(v,p) (*(unsigned long *)(p) = (v)) |
31 | 30 | ||
@@ -40,21 +39,15 @@ | |||
40 | /* | 39 | /* |
41 | * This does not append a newline | 40 | * This does not append a newline |
42 | */ | 41 | */ |
43 | static void putstr(const char *s) | 42 | static inline void putc(int c) |
44 | { | 43 | { |
45 | char c; | 44 | while (clps_readl(SYSFLGx) & SYSFLG_UTXFF) |
46 | 45 | barrier(); | |
47 | while ((c = *s++) != '\0') { | 46 | clps_writel(c, UARTDRx); |
48 | while (clps_readl(SYSFLGx) & SYSFLG_UTXFF) | 47 | } |
49 | barrier(); | ||
50 | clps_writel(c, UARTDRx); | ||
51 | 48 | ||
52 | if (c == '\n') { | 49 | static inline void flush(void) |
53 | while (clps_readl(SYSFLGx) & SYSFLG_UTXFF) | 50 | { |
54 | barrier(); | ||
55 | clps_writel('\r', UARTDRx); | ||
56 | } | ||
57 | } | ||
58 | while (clps_readl(SYSFLGx) & SYSFLG_UBUSY) | 51 | while (clps_readl(SYSFLGx) & SYSFLG_UBUSY) |
59 | barrier(); | 52 | barrier(); |
60 | } | 53 | } |
diff --git a/include/asm-arm/arch-ebsa110/uncompress.h b/include/asm-arm/arch-ebsa110/uncompress.h index eee95581a923..66b19c7fd908 100644 --- a/include/asm-arm/arch-ebsa110/uncompress.h +++ b/include/asm-arm/arch-ebsa110/uncompress.h | |||
@@ -8,33 +8,34 @@ | |||
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/serial_reg.h> | ||
12 | |||
13 | #define SERIAL_BASE ((unsigned char *)0xfe000be0) | ||
14 | |||
11 | /* | 15 | /* |
12 | * This does not append a newline | 16 | * This does not append a newline |
13 | */ | 17 | */ |
14 | static void putstr(const char *s) | 18 | static inline void putc(int c) |
19 | { | ||
20 | unsigned char v, *base = SERIAL_BASE; | ||
21 | |||
22 | do { | ||
23 | v = base[UART_LSR << 2]; | ||
24 | barrier(); | ||
25 | } while (!(v & UART_LSR_THRE)); | ||
26 | |||
27 | base[UART_TX << 2] = c; | ||
28 | } | ||
29 | |||
30 | static inline void flush(void) | ||
15 | { | 31 | { |
16 | unsigned long tmp1, tmp2; | 32 | unsigned char v, *base = SERIAL_BASE; |
17 | __asm__ __volatile__( | 33 | |
18 | "ldrb %0, [%2], #1\n" | 34 | do { |
19 | " teq %0, #0\n" | 35 | v = base[UART_LSR << 2]; |
20 | " beq 3f\n" | 36 | barrier(); |
21 | "1: strb %0, [%3]\n" | 37 | } while ((v & (UART_LSR_TEMT|UART_LSR_THRE)) != |
22 | "2: ldrb %1, [%3, #0x14]\n" | 38 | (UART_LSR_TEMT|UART_LSR_THRE)); |
23 | " and %1, %1, #0x60\n" | ||
24 | " teq %1, #0x60\n" | ||
25 | " bne 2b\n" | ||
26 | " teq %0, #'\n'\n" | ||
27 | " moveq %0, #'\r'\n" | ||
28 | " beq 1b\n" | ||
29 | " ldrb %0, [%2], #1\n" | ||
30 | " teq %0, #0\n" | ||
31 | " bne 1b\n" | ||
32 | "3: ldrb %1, [%3, #0x14]\n" | ||
33 | " and %1, %1, #0x60\n" | ||
34 | " teq %1, #0x60\n" | ||
35 | " bne 3b" | ||
36 | : "=&r" (tmp1), "=&r" (tmp2) | ||
37 | : "r" (s), "r" (0xf0000be0) : "cc"); | ||
38 | } | 39 | } |
39 | 40 | ||
40 | /* | 41 | /* |
diff --git a/include/asm-arm/arch-ebsa285/uncompress.h b/include/asm-arm/arch-ebsa285/uncompress.h index c2fd84e2d90e..86142c882b3a 100644 --- a/include/asm-arm/arch-ebsa285/uncompress.h +++ b/include/asm-arm/arch-ebsa285/uncompress.h | |||
@@ -15,10 +15,11 @@ | |||
15 | #define DC21285_BASE ((volatile unsigned int *)0x42000160) | 15 | #define DC21285_BASE ((volatile unsigned int *)0x42000160) |
16 | #define SER0_BASE ((volatile unsigned char *)0x7c0003f8) | 16 | #define SER0_BASE ((volatile unsigned char *)0x7c0003f8) |
17 | 17 | ||
18 | static __inline__ void putc(char c) | 18 | static inline void putc(char c) |
19 | { | 19 | { |
20 | if (machine_is_netwinder()) { | 20 | if (machine_is_netwinder()) { |
21 | while ((SER0_BASE[5] & 0x60) != 0x60); | 21 | while ((SER0_BASE[5] & 0x60) != 0x60) |
22 | barrier(); | ||
22 | SER0_BASE[0] = c; | 23 | SER0_BASE[0] = c; |
23 | } else { | 24 | } else { |
24 | while (DC21285_BASE[6] & 8); | 25 | while (DC21285_BASE[6] & 8); |
@@ -26,17 +27,8 @@ static __inline__ void putc(char c) | |||
26 | } | 27 | } |
27 | } | 28 | } |
28 | 29 | ||
29 | /* | 30 | static inline void flush(void) |
30 | * This does not append a newline | ||
31 | */ | ||
32 | static void putstr(const char *s) | ||
33 | { | 31 | { |
34 | while (*s) { | ||
35 | putc(*s); | ||
36 | if (*s == '\n') | ||
37 | putc('\r'); | ||
38 | s++; | ||
39 | } | ||
40 | } | 32 | } |
41 | 33 | ||
42 | /* | 34 | /* |
diff --git a/include/asm-arm/arch-ep93xx/uncompress.h b/include/asm-arm/arch-ep93xx/uncompress.h index 2171082d4fc5..c15274c85d5d 100644 --- a/include/asm-arm/arch-ep93xx/uncompress.h +++ b/include/asm-arm/arch-ep93xx/uncompress.h | |||
@@ -36,7 +36,7 @@ static void __raw_writel(unsigned int value, unsigned int ptr) | |||
36 | #define PHYS_UART1_FLAG 0x808c0018 | 36 | #define PHYS_UART1_FLAG 0x808c0018 |
37 | #define UART1_FLAG_TXFF 0x20 | 37 | #define UART1_FLAG_TXFF 0x20 |
38 | 38 | ||
39 | static __inline__ void putc(char c) | 39 | static inline void putc(int c) |
40 | { | 40 | { |
41 | int i; | 41 | int i; |
42 | 42 | ||
@@ -49,14 +49,8 @@ static __inline__ void putc(char c) | |||
49 | __raw_writeb(c, PHYS_UART1_DATA); | 49 | __raw_writeb(c, PHYS_UART1_DATA); |
50 | } | 50 | } |
51 | 51 | ||
52 | static void putstr(const char *s) | 52 | static inline void flush(void) |
53 | { | 53 | { |
54 | while (*s) { | ||
55 | putc(*s); | ||
56 | if (*s == '\n') | ||
57 | putc('\r'); | ||
58 | s++; | ||
59 | } | ||
60 | } | 54 | } |
61 | 55 | ||
62 | 56 | ||
diff --git a/include/asm-arm/arch-h720x/uncompress.h b/include/asm-arm/arch-h720x/uncompress.h index 9535764bcc71..18c69e0f3585 100644 --- a/include/asm-arm/arch-h720x/uncompress.h +++ b/include/asm-arm/arch-h720x/uncompress.h | |||
@@ -12,22 +12,20 @@ | |||
12 | #define LSR 0x14 | 12 | #define LSR 0x14 |
13 | #define TEMPTY 0x40 | 13 | #define TEMPTY 0x40 |
14 | 14 | ||
15 | static void putstr(const char *s) | 15 | static inline void putc(int c) |
16 | { | 16 | { |
17 | char c; | ||
18 | volatile unsigned char *p = (volatile unsigned char *)(IO_PHYS+0x20000); | 17 | volatile unsigned char *p = (volatile unsigned char *)(IO_PHYS+0x20000); |
19 | 18 | ||
20 | while ( (c = *s++) != '\0') { | 19 | /* wait until transmit buffer is empty */ |
21 | /* wait until transmit buffer is empty */ | 20 | while((p[LSR] & TEMPTY) == 0x0) |
22 | while((p[LSR] & TEMPTY) == 0x0); | 21 | barrier(); |
23 | /* write next character */ | 22 | |
24 | *p = c; | 23 | /* write next character */ |
25 | 24 | *p = c; | |
26 | if(c == '\n') { | 25 | } |
27 | while((p[LSR] & TEMPTY) == 0x0); | 26 | |
28 | *p = '\r'; | 27 | static inline void flush(void) |
29 | } | 28 | { |
30 | } | ||
31 | } | 29 | } |
32 | 30 | ||
33 | /* | 31 | /* |
diff --git a/include/asm-arm/arch-imx/uncompress.h b/include/asm-arm/arch-imx/uncompress.h index 096077f2750b..da333f69136f 100644 --- a/include/asm-arm/arch-imx/uncompress.h +++ b/include/asm-arm/arch-imx/uncompress.h | |||
@@ -39,8 +39,7 @@ | |||
39 | * | 39 | * |
40 | * This does not append a newline | 40 | * This does not append a newline |
41 | */ | 41 | */ |
42 | static void | 42 | static void putc(int c) |
43 | putstr(const char *s) | ||
44 | { | 43 | { |
45 | unsigned long serial_port; | 44 | unsigned long serial_port; |
46 | 45 | ||
@@ -54,20 +53,14 @@ putstr(const char *s) | |||
54 | return; | 53 | return; |
55 | } while(0); | 54 | } while(0); |
56 | 55 | ||
57 | while (*s) { | 56 | while (!(UART(USR2) & USR2_TXFE)) |
58 | while ( !(UART(USR2) & USR2_TXFE) ) | 57 | barrier(); |
59 | barrier(); | ||
60 | 58 | ||
61 | UART(TXR) = *s; | 59 | UART(TXR) = c; |
62 | 60 | } | |
63 | if (*s == '\n') { | ||
64 | while ( !(UART(USR2) & USR2_TXFE) ) | ||
65 | barrier(); | ||
66 | 61 | ||
67 | UART(TXR) = '\r'; | 62 | static inline void flush(void) |
68 | } | 63 | { |
69 | s++; | ||
70 | } | ||
71 | } | 64 | } |
72 | 65 | ||
73 | /* | 66 | /* |
diff --git a/include/asm-arm/arch-integrator/uncompress.h b/include/asm-arm/arch-integrator/uncompress.h index 3957402741d3..f61825c4d901 100644 --- a/include/asm-arm/arch-integrator/uncompress.h +++ b/include/asm-arm/arch-integrator/uncompress.h | |||
@@ -28,21 +28,18 @@ | |||
28 | /* | 28 | /* |
29 | * This does not append a newline | 29 | * This does not append a newline |
30 | */ | 30 | */ |
31 | static void putstr(const char *s) | 31 | static void putc(int c) |
32 | { | 32 | { |
33 | while (*s) { | 33 | while (AMBA_UART_FR & (1 << 5)) |
34 | while (AMBA_UART_FR & (1 << 5)); | 34 | barrier(); |
35 | 35 | ||
36 | AMBA_UART_DR = *s; | 36 | AMBA_UART_DR = c; |
37 | 37 | } | |
38 | if (*s == '\n') { | ||
39 | while (AMBA_UART_FR & (1 << 5)); | ||
40 | 38 | ||
41 | AMBA_UART_DR = '\r'; | 39 | static inline void flush(void) |
42 | } | 40 | { |
43 | s++; | 41 | while (AMBA_UART_FR & (1 << 3)) |
44 | } | 42 | barrier(); |
45 | while (AMBA_UART_FR & (1 << 3)); | ||
46 | } | 43 | } |
47 | 44 | ||
48 | /* | 45 | /* |
diff --git a/include/asm-arm/arch-iop3xx/uncompress.h b/include/asm-arm/arch-iop3xx/uncompress.h index 82b88762c3cc..c98eb6254b1f 100644 --- a/include/asm-arm/arch-iop3xx/uncompress.h +++ b/include/asm-arm/arch-iop3xx/uncompress.h | |||
@@ -19,23 +19,15 @@ static volatile UTYPE uart_base; | |||
19 | 19 | ||
20 | #define TX_DONE (UART_LSR_TEMT|UART_LSR_THRE) | 20 | #define TX_DONE (UART_LSR_TEMT|UART_LSR_THRE) |
21 | 21 | ||
22 | static __inline__ void putc(char c) | 22 | static inline void putc(char c) |
23 | { | 23 | { |
24 | while ((uart_base[UART_LSR] & TX_DONE) != TX_DONE); | 24 | while ((uart_base[UART_LSR] & TX_DONE) != TX_DONE) |
25 | barrier(); | ||
25 | *uart_base = c; | 26 | *uart_base = c; |
26 | } | 27 | } |
27 | 28 | ||
28 | /* | 29 | static inline void flush(void) |
29 | * This does not append a newline | ||
30 | */ | ||
31 | static void putstr(const char *s) | ||
32 | { | 30 | { |
33 | while (*s) { | ||
34 | putc(*s); | ||
35 | if (*s == '\n') | ||
36 | putc('\r'); | ||
37 | s++; | ||
38 | } | ||
39 | } | 31 | } |
40 | 32 | ||
41 | static __inline__ void __arch_decomp_setup(unsigned long arch_id) | 33 | static __inline__ void __arch_decomp_setup(unsigned long arch_id) |
diff --git a/include/asm-arm/arch-ixp2000/uncompress.h b/include/asm-arm/arch-ixp2000/uncompress.h index 3d3d5b2ed6e9..f66b408f363e 100644 --- a/include/asm-arm/arch-ixp2000/uncompress.h +++ b/include/asm-arm/arch-ixp2000/uncompress.h | |||
@@ -29,23 +29,18 @@ | |||
29 | #define UARTSR PHYS(0x14) /* Status reg */ | 29 | #define UARTSR PHYS(0x14) /* Status reg */ |
30 | 30 | ||
31 | 31 | ||
32 | static __inline__ void putc(char c) | 32 | static inline void putc(int c) |
33 | { | 33 | { |
34 | int j = 0x1000; | 34 | int j = 0x1000; |
35 | 35 | ||
36 | while (--j && !(*UARTSR & UART_LSR_THRE)); | 36 | while (--j && !(*UARTSR & UART_LSR_THRE)) |
37 | barrier(); | ||
38 | |||
37 | *UARTDR = c; | 39 | *UARTDR = c; |
38 | } | 40 | } |
39 | 41 | ||
40 | static void putstr(const char *s) | 42 | static inline void flush(void) |
41 | { | 43 | { |
42 | while (*s) | ||
43 | { | ||
44 | putc(*s); | ||
45 | if (*s == '\n') | ||
46 | putc('\r'); | ||
47 | s++; | ||
48 | } | ||
49 | } | 44 | } |
50 | 45 | ||
51 | #define arch_decomp_setup() | 46 | #define arch_decomp_setup() |
diff --git a/include/asm-arm/arch-ixp4xx/uncompress.h b/include/asm-arm/arch-ixp4xx/uncompress.h index 960c35810a22..09ae6c91be60 100644 --- a/include/asm-arm/arch-ixp4xx/uncompress.h +++ b/include/asm-arm/arch-ixp4xx/uncompress.h | |||
@@ -21,26 +21,18 @@ | |||
21 | 21 | ||
22 | static volatile u32* uart_base; | 22 | static volatile u32* uart_base; |
23 | 23 | ||
24 | static __inline__ void putc(char c) | 24 | static inline void putc(int c) |
25 | { | 25 | { |
26 | /* Check THRE and TEMT bits before we transmit the character. | 26 | /* Check THRE and TEMT bits before we transmit the character. |
27 | */ | 27 | */ |
28 | while ((uart_base[UART_LSR] & TX_DONE) != TX_DONE); | 28 | while ((uart_base[UART_LSR] & TX_DONE) != TX_DONE) |
29 | barrier(); | ||
30 | |||
29 | *uart_base = c; | 31 | *uart_base = c; |
30 | } | 32 | } |
31 | 33 | ||
32 | /* | 34 | static void flush(void) |
33 | * This does not append a newline | ||
34 | */ | ||
35 | static void putstr(const char *s) | ||
36 | { | 35 | { |
37 | while (*s) | ||
38 | { | ||
39 | putc(*s); | ||
40 | if (*s == '\n') | ||
41 | putc('\r'); | ||
42 | s++; | ||
43 | } | ||
44 | } | 36 | } |
45 | 37 | ||
46 | static __inline__ void __arch_decomp_setup(unsigned long arch_id) | 38 | static __inline__ void __arch_decomp_setup(unsigned long arch_id) |
diff --git a/include/asm-arm/arch-l7200/uncompress.h b/include/asm-arm/arch-l7200/uncompress.h index 1caa2b560f53..9fcd40aee3e3 100644 --- a/include/asm-arm/arch-l7200/uncompress.h +++ b/include/asm-arm/arch-l7200/uncompress.h | |||
@@ -16,22 +16,17 @@ | |||
16 | #define __raw_writeb(v,p) (*(volatile unsigned char *)(p) = (v)) | 16 | #define __raw_writeb(v,p) (*(volatile unsigned char *)(p) = (v)) |
17 | #define __raw_readb(p) (*(volatile unsigned char *)(p)) | 17 | #define __raw_readb(p) (*(volatile unsigned char *)(p)) |
18 | 18 | ||
19 | static __inline__ void putc(char c) | 19 | static inline void putc(int c) |
20 | { | 20 | { |
21 | while(__raw_readb(IO_UART + 0x18) & 0x20 || | 21 | while(__raw_readb(IO_UART + 0x18) & 0x20 || |
22 | __raw_readb(IO_UART + 0x18) & 0x08); | 22 | __raw_readb(IO_UART + 0x18) & 0x08) |
23 | barrier(); | ||
24 | |||
23 | __raw_writeb(c, IO_UART + 0x00); | 25 | __raw_writeb(c, IO_UART + 0x00); |
24 | } | 26 | } |
25 | 27 | ||
26 | static void putstr(const char *s) | 28 | static inline void flush(void) |
27 | { | 29 | { |
28 | while (*s) { | ||
29 | if (*s == 10) { /* If a LF, add CR */ | ||
30 | putc(10); | ||
31 | putc(13); | ||
32 | } | ||
33 | putc(*(s++)); | ||
34 | } | ||
35 | } | 30 | } |
36 | 31 | ||
37 | static __inline__ void arch_decomp_setup(void) | 32 | static __inline__ void arch_decomp_setup(void) |
diff --git a/include/asm-arm/arch-lh7a40x/uncompress.h b/include/asm-arm/arch-lh7a40x/uncompress.h index ec8ab67122f3..f8053346f608 100644 --- a/include/asm-arm/arch-lh7a40x/uncompress.h +++ b/include/asm-arm/arch-lh7a40x/uncompress.h | |||
@@ -22,20 +22,15 @@ | |||
22 | #define UART_STATUS (*(volatile unsigned long*) (UART2_PHYS + UART_R_STATUS)) | 22 | #define UART_STATUS (*(volatile unsigned long*) (UART2_PHYS + UART_R_STATUS)) |
23 | #define UART_DATA (*(volatile unsigned long*) (UART2_PHYS + UART_R_DATA)) | 23 | #define UART_DATA (*(volatile unsigned long*) (UART2_PHYS + UART_R_DATA)) |
24 | 24 | ||
25 | static __inline__ void putc (char ch) | 25 | static inline void putc(int ch) |
26 | { | 26 | { |
27 | while (UART_STATUS & nTxRdy) | 27 | while (UART_STATUS & nTxRdy) |
28 | ; | 28 | barrier(); |
29 | UART_DATA = ch; | 29 | UART_DATA = ch; |
30 | } | 30 | } |
31 | 31 | ||
32 | static void putstr (const char* sz) | 32 | static inline void flush(void) |
33 | { | 33 | { |
34 | for (; *sz; ++sz) { | ||
35 | putc (*sz); | ||
36 | if (*sz == '\n') | ||
37 | putc ('\r'); | ||
38 | } | ||
39 | } | 34 | } |
40 | 35 | ||
41 | /* NULL functions; we don't presently need them */ | 36 | /* NULL functions; we don't presently need them */ |
diff --git a/include/asm-arm/arch-omap/uncompress.h b/include/asm-arm/arch-omap/uncompress.h index c718264affbd..ca2c8bec82e7 100644 --- a/include/asm-arm/arch-omap/uncompress.h +++ b/include/asm-arm/arch-omap/uncompress.h | |||
@@ -30,8 +30,7 @@ unsigned int system_rev; | |||
30 | #define check_port(base, shift) ((base[UART_OMAP_MDR1 << shift] & 7) == 0) | 30 | #define check_port(base, shift) ((base[UART_OMAP_MDR1 << shift] & 7) == 0) |
31 | #define omap_get_id() ((*(volatile unsigned int *)(0xfffed404)) >> 12) & ID_MASK | 31 | #define omap_get_id() ((*(volatile unsigned int *)(0xfffed404)) >> 12) & ID_MASK |
32 | 32 | ||
33 | static void | 33 | static void putc(int c) |
34 | putstr(const char *s) | ||
35 | { | 34 | { |
36 | volatile u8 * uart = 0; | 35 | volatile u8 * uart = 0; |
37 | int shift = 2; | 36 | int shift = 2; |
@@ -69,16 +68,13 @@ putstr(const char *s) | |||
69 | /* | 68 | /* |
70 | * Now, xmit each character | 69 | * Now, xmit each character |
71 | */ | 70 | */ |
72 | while (*s) { | 71 | while (!(uart[UART_LSR << shift] & UART_LSR_THRE)) |
73 | while (!(uart[UART_LSR << shift] & UART_LSR_THRE)) | 72 | barrier(); |
74 | barrier(); | 73 | uart[UART_TX << shift] = c; |
75 | uart[UART_TX << shift] = *s; | 74 | } |
76 | if (*s++ == '\n') { | 75 | |
77 | while (!(uart[UART_LSR << shift] & UART_LSR_THRE)) | 76 | static inline void flush(void) |
78 | barrier(); | 77 | { |
79 | uart[UART_TX << shift] = '\r'; | ||
80 | } | ||
81 | } | ||
82 | } | 78 | } |
83 | 79 | ||
84 | /* | 80 | /* |
diff --git a/include/asm-arm/arch-pxa/uncompress.h b/include/asm-arm/arch-pxa/uncompress.h index fe38090444e0..178aa2e073ac 100644 --- a/include/asm-arm/arch-pxa/uncompress.h +++ b/include/asm-arm/arch-pxa/uncompress.h | |||
@@ -17,23 +17,18 @@ | |||
17 | #define UART FFUART | 17 | #define UART FFUART |
18 | 18 | ||
19 | 19 | ||
20 | static __inline__ void putc(char c) | 20 | static inline void putc(char c) |
21 | { | 21 | { |
22 | while (!(UART[5] & 0x20)); | 22 | while (!(UART[5] & 0x20)) |
23 | barrier(); | ||
23 | UART[0] = c; | 24 | UART[0] = c; |
24 | } | 25 | } |
25 | 26 | ||
26 | /* | 27 | /* |
27 | * This does not append a newline | 28 | * This does not append a newline |
28 | */ | 29 | */ |
29 | static void putstr(const char *s) | 30 | static inline void flush(void) |
30 | { | 31 | { |
31 | while (*s) { | ||
32 | putc(*s); | ||
33 | if (*s == '\n') | ||
34 | putc('\r'); | ||
35 | s++; | ||
36 | } | ||
37 | } | 32 | } |
38 | 33 | ||
39 | /* | 34 | /* |
diff --git a/include/asm-arm/arch-realview/uncompress.h b/include/asm-arm/arch-realview/uncompress.h index b5e4d360665b..f05631d76743 100644 --- a/include/asm-arm/arch-realview/uncompress.h +++ b/include/asm-arm/arch-realview/uncompress.h | |||
@@ -27,22 +27,16 @@ | |||
27 | /* | 27 | /* |
28 | * This does not append a newline | 28 | * This does not append a newline |
29 | */ | 29 | */ |
30 | static void putstr(const char *s) | 30 | static inline void putc(int c) |
31 | { | 31 | { |
32 | while (*s) { | 32 | while (AMBA_UART_FR & (1 << 5)) |
33 | while (AMBA_UART_FR & (1 << 5)) | 33 | barrier(); |
34 | barrier(); | ||
35 | |||
36 | AMBA_UART_DR = *s; | ||
37 | 34 | ||
38 | if (*s == '\n') { | 35 | AMBA_UART_DR = c; |
39 | while (AMBA_UART_FR & (1 << 5)) | 36 | } |
40 | barrier(); | ||
41 | 37 | ||
42 | AMBA_UART_DR = '\r'; | 38 | static inline void flush(void) |
43 | } | 39 | { |
44 | s++; | ||
45 | } | ||
46 | while (AMBA_UART_FR & (1 << 3)) | 40 | while (AMBA_UART_FR & (1 << 3)) |
47 | barrier(); | 41 | barrier(); |
48 | } | 42 | } |
diff --git a/include/asm-arm/arch-rpc/uncompress.h b/include/asm-arm/arch-rpc/uncompress.h index 43035fec64d2..06231ede54e5 100644 --- a/include/asm-arm/arch-rpc/uncompress.h +++ b/include/asm-arm/arch-rpc/uncompress.h | |||
@@ -67,31 +67,28 @@ extern __attribute__((pure)) struct param_struct *params(void); | |||
67 | /* | 67 | /* |
68 | * This does not append a newline | 68 | * This does not append a newline |
69 | */ | 69 | */ |
70 | static void putstr(const char *s) | 70 | static void putc(int c) |
71 | { | 71 | { |
72 | extern void ll_write_char(char *, char c, char white); | 72 | extern void ll_write_char(char *, char c, char white); |
73 | int x,y; | 73 | int x,y; |
74 | unsigned char c; | ||
75 | char *ptr; | 74 | char *ptr; |
76 | 75 | ||
77 | x = params->video_x; | 76 | x = params->video_x; |
78 | y = params->video_y; | 77 | y = params->video_y; |
79 | 78 | ||
80 | while ( ( c = *(unsigned char *)s++ ) != '\0' ) { | 79 | if (c == '\n') { |
81 | if ( c == '\n' ) { | 80 | if (++y >= video_num_lines) |
81 | y--; | ||
82 | } else if (c == '\r') { | ||
83 | x = 0; | ||
84 | } else { | ||
85 | ptr = VIDMEM + ((y*video_num_columns*params->bytes_per_char_v+x)*bytes_per_char_h); | ||
86 | ll_write_char(ptr, c, white); | ||
87 | if (++x >= video_num_columns) { | ||
82 | x = 0; | 88 | x = 0; |
83 | if ( ++y >= video_num_lines ) { | 89 | if ( ++y >= video_num_lines ) { |
84 | y--; | 90 | y--; |
85 | } | 91 | } |
86 | } else { | ||
87 | ptr = VIDMEM + ((y*video_num_columns*params->bytes_per_char_v+x)*bytes_per_char_h); | ||
88 | ll_write_char(ptr, c, white); | ||
89 | if ( ++x >= video_num_columns ) { | ||
90 | x = 0; | ||
91 | if ( ++y >= video_num_lines ) { | ||
92 | y--; | ||
93 | } | ||
94 | } | ||
95 | } | 92 | } |
96 | } | 93 | } |
97 | 94 | ||
@@ -99,6 +96,10 @@ static void putstr(const char *s) | |||
99 | params->video_y = y; | 96 | params->video_y = y; |
100 | } | 97 | } |
101 | 98 | ||
99 | static inline void flush(void) | ||
100 | { | ||
101 | } | ||
102 | |||
102 | static void error(char *x); | 103 | static void error(char *x); |
103 | 104 | ||
104 | /* | 105 | /* |
diff --git a/include/asm-arm/arch-s3c2410/uncompress.h b/include/asm-arm/arch-s3c2410/uncompress.h index 4367ec054b51..a6f6a0e44afa 100644 --- a/include/asm-arm/arch-s3c2410/uncompress.h +++ b/include/asm-arm/arch-s3c2410/uncompress.h | |||
@@ -67,8 +67,7 @@ uart_rd(unsigned int reg) | |||
67 | * waiting for tx to happen... | 67 | * waiting for tx to happen... |
68 | */ | 68 | */ |
69 | 69 | ||
70 | static void | 70 | static void putc(int ch) |
71 | putc(char ch) | ||
72 | { | 71 | { |
73 | int cpuid = S3C2410_GSTATUS1_2410; | 72 | int cpuid = S3C2410_GSTATUS1_2410; |
74 | 73 | ||
@@ -77,9 +76,6 @@ putc(char ch) | |||
77 | cpuid &= S3C2410_GSTATUS1_IDMASK; | 76 | cpuid &= S3C2410_GSTATUS1_IDMASK; |
78 | #endif | 77 | #endif |
79 | 78 | ||
80 | if (ch == '\n') | ||
81 | putc('\r'); /* expand newline to \r\n */ | ||
82 | |||
83 | if (uart_rd(S3C2410_UFCON) & S3C2410_UFCON_FIFOMODE) { | 79 | if (uart_rd(S3C2410_UFCON) & S3C2410_UFCON_FIFOMODE) { |
84 | int level; | 80 | int level; |
85 | 81 | ||
@@ -101,19 +97,16 @@ putc(char ch) | |||
101 | } else { | 97 | } else { |
102 | /* not using fifos */ | 98 | /* not using fifos */ |
103 | 99 | ||
104 | while ((uart_rd(S3C2410_UTRSTAT) & S3C2410_UTRSTAT_TXE) != S3C2410_UTRSTAT_TXE); | 100 | while ((uart_rd(S3C2410_UTRSTAT) & S3C2410_UTRSTAT_TXE) != S3C2410_UTRSTAT_TXE) |
101 | barrier(); | ||
105 | } | 102 | } |
106 | 103 | ||
107 | /* write byte to transmission register */ | 104 | /* write byte to transmission register */ |
108 | uart_wr(S3C2410_UTXH, ch); | 105 | uart_wr(S3C2410_UTXH, ch); |
109 | } | 106 | } |
110 | 107 | ||
111 | static void | 108 | static inline void flush(void) |
112 | putstr(const char *ptr) | ||
113 | { | 109 | { |
114 | for (; *ptr != '\0'; ptr++) { | ||
115 | putc(*ptr); | ||
116 | } | ||
117 | } | 110 | } |
118 | 111 | ||
119 | #define __raw_writel(d,ad) do { *((volatile unsigned int *)(ad)) = (d); } while(0) | 112 | #define __raw_writel(d,ad) do { *((volatile unsigned int *)(ad)) = (d); } while(0) |
diff --git a/include/asm-arm/arch-sa1100/uncompress.h b/include/asm-arm/arch-sa1100/uncompress.h index 43453501ee66..2601a77a6dda 100644 --- a/include/asm-arm/arch-sa1100/uncompress.h +++ b/include/asm-arm/arch-sa1100/uncompress.h | |||
@@ -17,7 +17,7 @@ | |||
17 | 17 | ||
18 | #define UART(x) (*(volatile unsigned long *)(serial_port + (x))) | 18 | #define UART(x) (*(volatile unsigned long *)(serial_port + (x))) |
19 | 19 | ||
20 | static void putstr( const char *s ) | 20 | static void putc(int c) |
21 | { | 21 | { |
22 | unsigned long serial_port; | 22 | unsigned long serial_port; |
23 | 23 | ||
@@ -31,19 +31,16 @@ static void putstr( const char *s ) | |||
31 | return; | 31 | return; |
32 | } while (0); | 32 | } while (0); |
33 | 33 | ||
34 | for (; *s; s++) { | 34 | /* wait for space in the UART's transmitter */ |
35 | /* wait for space in the UART's transmitter */ | 35 | while (!(UART(UTSR1) & UTSR1_TNF)) |
36 | while (!(UART(UTSR1) & UTSR1_TNF)); | 36 | barrier(); |
37 | 37 | ||
38 | /* send the character out. */ | 38 | /* send the character out. */ |
39 | UART(UTDR) = *s; | 39 | UART(UTDR) = c; |
40 | } | ||
40 | 41 | ||
41 | /* if a LF, also do CR... */ | 42 | static inline void flush(void) |
42 | if (*s == 10) { | 43 | { |
43 | while (!(UART(UTSR1) & UTSR1_TNF)); | ||
44 | UART(UTDR) = 13; | ||
45 | } | ||
46 | } | ||
47 | } | 44 | } |
48 | 45 | ||
49 | /* | 46 | /* |
diff --git a/include/asm-arm/arch-shark/uncompress.h b/include/asm-arm/arch-shark/uncompress.h index 910a8e0a0ca5..7eca6534f1bb 100644 --- a/include/asm-arm/arch-shark/uncompress.h +++ b/include/asm-arm/arch-shark/uncompress.h | |||
@@ -9,7 +9,7 @@ | |||
9 | 9 | ||
10 | #define SERIAL_BASE ((volatile unsigned char *)0x400003f8) | 10 | #define SERIAL_BASE ((volatile unsigned char *)0x400003f8) |
11 | 11 | ||
12 | static __inline__ void putc(char c) | 12 | static inline void putc(int c) |
13 | { | 13 | { |
14 | int t; | 14 | int t; |
15 | 15 | ||
@@ -18,17 +18,8 @@ static __inline__ void putc(char c) | |||
18 | while (t--); | 18 | while (t--); |
19 | } | 19 | } |
20 | 20 | ||
21 | /* | 21 | static inline void flush(void) |
22 | * This does not append a newline | ||
23 | */ | ||
24 | static void putstr(const char *s) | ||
25 | { | 22 | { |
26 | while (*s) { | ||
27 | putc(*s); | ||
28 | if (*s == '\n') | ||
29 | putc('\r'); | ||
30 | s++; | ||
31 | } | ||
32 | } | 23 | } |
33 | 24 | ||
34 | #ifdef DEBUG | 25 | #ifdef DEBUG |
diff --git a/include/asm-arm/arch-versatile/uncompress.h b/include/asm-arm/arch-versatile/uncompress.h index 2f57499c7b92..7215133d0514 100644 --- a/include/asm-arm/arch-versatile/uncompress.h +++ b/include/asm-arm/arch-versatile/uncompress.h | |||
@@ -25,22 +25,16 @@ | |||
25 | /* | 25 | /* |
26 | * This does not append a newline | 26 | * This does not append a newline |
27 | */ | 27 | */ |
28 | static void putstr(const char *s) | 28 | static inline void putc(int c) |
29 | { | 29 | { |
30 | while (*s) { | 30 | while (AMBA_UART_FR & (1 << 5)) |
31 | while (AMBA_UART_FR & (1 << 5)) | 31 | barrier(); |
32 | barrier(); | ||
33 | |||
34 | AMBA_UART_DR = *s; | ||
35 | 32 | ||
36 | if (*s == '\n') { | 33 | AMBA_UART_DR = c; |
37 | while (AMBA_UART_FR & (1 << 5)) | 34 | } |
38 | barrier(); | ||
39 | 35 | ||
40 | AMBA_UART_DR = '\r'; | 36 | static inline void flush(void) |
41 | } | 37 | { |
42 | s++; | ||
43 | } | ||
44 | while (AMBA_UART_FR & (1 << 3)) | 38 | while (AMBA_UART_FR & (1 << 3)) |
45 | barrier(); | 39 | barrier(); |
46 | } | 40 | } |