Commit | Line | Data |
---|---|---|
1da177e4 | 1 | /* |
a09e64fb | 2 | * arch/arm/mach-pxa/include/mach/uncompress.h |
1da177e4 LT |
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 | ||
49db76eb | 12 | #include <linux/serial_reg.h> |
6d3dfe4a | 13 | #include <asm/mach-types.h> |
49db76eb | 14 | |
c95efee1 EM |
15 | #define FFUART_BASE (0x40100000) |
16 | #define BTUART_BASE (0x40200000) | |
17 | #define STUART_BASE (0x40700000) | |
1da177e4 | 18 | |
8ea0de4b NP |
19 | unsigned long uart_base; |
20 | unsigned int uart_shift; | |
21 | unsigned int uart_is_pxa; | |
c95efee1 EM |
22 | |
23 | static inline unsigned char uart_read(int offset) | |
24 | { | |
25 | return *(volatile unsigned char *)(uart_base + (offset << uart_shift)); | |
26 | } | |
27 | ||
28 | static inline void uart_write(unsigned char val, int offset) | |
29 | { | |
30 | *(volatile unsigned char *)(uart_base + (offset << uart_shift)) = val; | |
31 | } | |
32 | ||
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 | } | |
1da177e4 | 38 | |
a081568d | 39 | static inline void putc(char c) |
1da177e4 | 40 | { |
c95efee1 | 41 | if (!uart_is_enabled()) |
49db76eb | 42 | return; |
c95efee1 EM |
43 | |
44 | while (!(uart_read(UART_LSR) & UART_LSR_THRE)) | |
a081568d | 45 | barrier(); |
c95efee1 EM |
46 | |
47 | uart_write(c, UART_TX); | |
1da177e4 LT |
48 | } |
49 | ||
50 | /* | |
51 | * This does not append a newline | |
52 | */ | |
a081568d | 53 | static inline void flush(void) |
1da177e4 | 54 | { |
1da177e4 LT |
55 | } |
56 | ||
6d3dfe4a EM |
57 | static inline void arch_decomp_setup(void) |
58 | { | |
2a8ac187 JC |
59 | /* initialize to default */ |
60 | uart_base = FFUART_BASE; | |
61 | uart_shift = 2; | |
62 | uart_is_pxa = 1; | |
63 | ||
aac42970 | 64 | if (machine_is_littleton() || machine_is_intelmote2() |
321d9eb3 | 65 | || machine_is_csb726() || machine_is_stargate2() |
2a23ec36 | 66 | || machine_is_cm_x300() || machine_is_balloon3()) |
c95efee1 | 67 | uart_base = STUART_BASE; |
662b0836 MZ |
68 | |
69 | if (machine_is_arcom_zeus()) { | |
70 | uart_base = 0x10000000; /* nCS4 */ | |
71 | uart_shift = 1; | |
72 | uart_is_pxa = 0; | |
73 | } | |
6d3dfe4a | 74 | } |