aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/include/mach/uncompress.h
diff options
context:
space:
mode:
authorEric Miao <eric.y.miao@gmail.com>2010-02-19 00:49:39 -0500
committerEric Miao <eric.y.miao@gmail.com>2010-03-01 18:40:58 -0500
commitc95efee13303d9ff9e67f2600174f492039311ce (patch)
treef9bfd75688391f2dc999e8431e049371bba8fc97 /arch/arm/mach-pxa/include/mach/uncompress.h
parent2029e5643a3c4fdd4ad20169fb950cc16e023d0c (diff)
[ARM] pxa: refactor uncompress.h for non-PXA uarts
The original patch came from Marc Zyngier where support of 8250-compatible UART is required to show the uncompress information. Modified a little bit here, including changes below: 1. #include <mach/regs-uart.h> is actually not necessary 2. introduced uart_{read,write}() for different base and shift 3. introduced uart_is_enabled() and assumed enabled always for non-PXA uarts Signed-off-by: Eric Miao <eric.y.miao@gmail.com> Acked-by: Marc Zyngier <maz@misterjones.org>
Diffstat (limited to 'arch/arm/mach-pxa/include/mach/uncompress.h')
-rw-r--r--arch/arm/mach-pxa/include/mach/uncompress.h35
1 files changed, 28 insertions, 7 deletions
diff --git a/arch/arm/mach-pxa/include/mach/uncompress.h b/arch/arm/mach-pxa/include/mach/uncompress.h
index 237734b5b1be..4888a21947b0 100644
--- a/arch/arm/mach-pxa/include/mach/uncompress.h
+++ b/arch/arm/mach-pxa/include/mach/uncompress.h
@@ -10,20 +10,41 @@
10 */ 10 */
11 11
12#include <linux/serial_reg.h> 12#include <linux/serial_reg.h>
13#include <mach/regs-uart.h>
14#include <asm/mach-types.h> 13#include <asm/mach-types.h>
15 14
16#define __REG(x) ((volatile unsigned long *)x) 15#define FFUART_BASE (0x40100000)
16#define BTUART_BASE (0x40200000)
17#define STUART_BASE (0x40700000)
17 18
18static volatile unsigned long *UART = FFUART; 19static unsigned long uart_base = FFUART_BASE;
20static unsigned int uart_shift = 2;
21static unsigned int uart_is_pxa = 1;
22
23static inline unsigned char uart_read(int offset)
24{
25 return *(volatile unsigned char *)(uart_base + (offset << uart_shift));
26}
27
28static inline void uart_write(unsigned char val, int offset)
29{
30 *(volatile unsigned char *)(uart_base + (offset << uart_shift)) = val;
31}
32
33static inline int uart_is_enabled(void)
34{
35 /* assume enabled by default for non-PXA uarts */
36 return uart_is_pxa ? uart_read(UART_IER) & UART_IER_UUE : 1;
37}
19 38
20static inline void putc(char c) 39static inline void putc(char c)
21{ 40{
22 if (!(UART[UART_IER] & IER_UUE)) 41 if (!uart_is_enabled())
23 return; 42 return;
24 while (!(UART[UART_LSR] & LSR_TDRQ)) 43
44 while (!(uart_read(UART_LSR) & UART_LSR_THRE))
25 barrier(); 45 barrier();
26 UART[UART_TX] = c; 46
47 uart_write(c, UART_TX);
27} 48}
28 49
29/* 50/*
@@ -38,7 +59,7 @@ static inline void arch_decomp_setup(void)
38 if (machine_is_littleton() || machine_is_intelmote2() 59 if (machine_is_littleton() || machine_is_intelmote2()
39 || machine_is_csb726() || machine_is_stargate2() 60 || machine_is_csb726() || machine_is_stargate2()
40 || machine_is_cm_x300() || machine_is_balloon3()) 61 || machine_is_cm_x300() || machine_is_balloon3())
41 UART = STUART; 62 uart_base = STUART_BASE;
42} 63}
43 64
44/* 65/*