Commit | Line | Data |
---|---|---|
d2912cb1 | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
1da177e4 | 2 | /* |
a09e64fb | 3 | * arch/arm/mach-pxa/include/mach/uncompress.h |
1da177e4 LT |
4 | * |
5 | * Author: Nicolas Pitre | |
6 | * Copyright: (C) 2001 MontaVista Software Inc. | |
1da177e4 LT |
7 | */ |
8 | ||
49db76eb | 9 | #include <linux/serial_reg.h> |
6d3dfe4a | 10 | #include <asm/mach-types.h> |
49db76eb | 11 | |
c95efee1 EM |
12 | #define FFUART_BASE (0x40100000) |
13 | #define BTUART_BASE (0x40200000) | |
14 | #define STUART_BASE (0x40700000) | |
1da177e4 | 15 | |
8ea0de4b NP |
16 | unsigned long uart_base; |
17 | unsigned int uart_shift; | |
18 | unsigned int uart_is_pxa; | |
c95efee1 EM |
19 | |
20 | static inline unsigned char uart_read(int offset) | |
21 | { | |
22 | return *(volatile unsigned char *)(uart_base + (offset << uart_shift)); | |
23 | } | |
24 | ||
25 | static inline void uart_write(unsigned char val, int offset) | |
26 | { | |
27 | *(volatile unsigned char *)(uart_base + (offset << uart_shift)) = val; | |
28 | } | |
29 | ||
30 | static inline int uart_is_enabled(void) | |
31 | { | |
32 | /* assume enabled by default for non-PXA uarts */ | |
33 | return uart_is_pxa ? uart_read(UART_IER) & UART_IER_UUE : 1; | |
34 | } | |
1da177e4 | 35 | |
a081568d | 36 | static inline void putc(char c) |
1da177e4 | 37 | { |
c95efee1 | 38 | if (!uart_is_enabled()) |
49db76eb | 39 | return; |
c95efee1 EM |
40 | |
41 | while (!(uart_read(UART_LSR) & UART_LSR_THRE)) | |
a081568d | 42 | barrier(); |
c95efee1 EM |
43 | |
44 | uart_write(c, UART_TX); | |
1da177e4 LT |
45 | } |
46 | ||
47 | /* | |
48 | * This does not append a newline | |
49 | */ | |
a081568d | 50 | static inline void flush(void) |
1da177e4 | 51 | { |
1da177e4 LT |
52 | } |
53 | ||
6d3dfe4a EM |
54 | static inline void arch_decomp_setup(void) |
55 | { | |
2a8ac187 JC |
56 | /* initialize to default */ |
57 | uart_base = FFUART_BASE; | |
58 | uart_shift = 2; | |
59 | uart_is_pxa = 1; | |
60 | ||
aac42970 | 61 | if (machine_is_littleton() || machine_is_intelmote2() |
321d9eb3 | 62 | || machine_is_csb726() || machine_is_stargate2() |
2a23ec36 | 63 | || machine_is_cm_x300() || machine_is_balloon3()) |
c95efee1 | 64 | uart_base = STUART_BASE; |
662b0836 MZ |
65 | |
66 | if (machine_is_arcom_zeus()) { | |
67 | uart_base = 0x10000000; /* nCS4 */ | |
68 | uart_shift = 1; | |
69 | uart_is_pxa = 0; | |
70 | } | |
6d3dfe4a | 71 | } |