1 /*
2  * arch/arm/mach-pxa/include/mach/uncompress.h
3  *
4  * Author:	Nicolas Pitre
5  * Copyright:	(C) 2001 MontaVista Software Inc.
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation.
10  */
11 
12 #include <linux/serial_reg.h>
13 #include <asm/mach-types.h>
14 
15 #define FFUART_BASE	(0x40100000)
16 #define BTUART_BASE	(0x40200000)
17 #define STUART_BASE	(0x40700000)
18 
19 unsigned long uart_base;
20 unsigned int uart_shift;
21 unsigned int uart_is_pxa;
22 
uart_read(int offset)23 static inline unsigned char uart_read(int offset)
24 {
25 	return *(volatile unsigned char *)(uart_base + (offset << uart_shift));
26 }
27 
uart_write(unsigned char val,int offset)28 static inline void uart_write(unsigned char val, int offset)
29 {
30 	*(volatile unsigned char *)(uart_base + (offset << uart_shift)) = val;
31 }
32 
uart_is_enabled(void)33 static 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 }
38 
putc(char c)39 static inline void putc(char c)
40 {
41 	if (!uart_is_enabled())
42 		return;
43 
44 	while (!(uart_read(UART_LSR) & UART_LSR_THRE))
45 		barrier();
46 
47 	uart_write(c, UART_TX);
48 }
49 
50 /*
51  * This does not append a newline
52  */
flush(void)53 static inline void flush(void)
54 {
55 }
56 
arch_decomp_setup(void)57 static inline void arch_decomp_setup(void)
58 {
59 	/* initialize to default */
60 	uart_base = FFUART_BASE;
61 	uart_shift = 2;
62 	uart_is_pxa = 1;
63 
64 	if (machine_is_littleton() || machine_is_intelmote2()
65 	    || machine_is_csb726() || machine_is_stargate2()
66 	    || machine_is_cm_x300() || machine_is_balloon3())
67 		uart_base = STUART_BASE;
68 
69 	if (machine_is_arcom_zeus()) {
70 		uart_base = 0x10000000;	/* nCS4 */
71 		uart_shift = 1;
72 		uart_is_pxa = 0;
73 	}
74 }
75 
76 /*
77  * nothing to do
78  */
79 #define arch_decomp_wdog()
80