treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 333
[linux-2.6-microblaze.git] / arch / arm / mach-netx / include / mach / uncompress.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * arch/arm/mach-netx/include/mach/uncompress.h
4  *
5  * Copyright (C) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
6  */
7
8 /*
9  * The following code assumes the serial port has already been
10  * initialized by the bootloader.  We search for the first enabled
11  * port in the most probable order.  If you didn't setup a port in
12  * your bootloader then nothing will appear (which might be desired).
13  *
14  * This does not append a newline
15  */
16
17 #define REG(x) (*(volatile unsigned long *)(x))
18
19 #define UART1_BASE 0x100a00
20 #define UART2_BASE 0x100a80
21
22 #define UART_DR 0x0
23
24 #define UART_CR 0x14
25 #define CR_UART_EN (1<<0)
26
27 #define UART_FR 0x18
28 #define FR_BUSY (1<<3)
29 #define FR_TXFF (1<<5)
30
31 static inline void putc(char c)
32 {
33         unsigned long base;
34
35         if (REG(UART1_BASE + UART_CR) & CR_UART_EN)
36                 base = UART1_BASE;
37         else if (REG(UART2_BASE + UART_CR) & CR_UART_EN)
38                 base = UART2_BASE;
39         else
40                 return;
41
42         while (REG(base + UART_FR) & FR_TXFF);
43         REG(base + UART_DR) = c;
44 }
45
46 static inline void flush(void)
47 {
48         unsigned long base;
49
50         if (REG(UART1_BASE + UART_CR) & CR_UART_EN)
51                 base = UART1_BASE;
52         else if (REG(UART2_BASE + UART_CR) & CR_UART_EN)
53                 base = UART2_BASE;
54         else
55                 return;
56
57         while (REG(base + UART_FR) & FR_BUSY);
58 }
59
60 /*
61  * nothing to do
62  */
63 #define arch_decomp_setup()