1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * arch/arm/mach-ixp4xx/include/mach/uncompress.h
4  *
5  * Copyright (C) 2002 Intel Corporation.
6  * Copyright (C) 2003-2004 MontaVista Software, Inc.
7  */
8 
9 #ifndef _ARCH_UNCOMPRESS_H_
10 #define _ARCH_UNCOMPRESS_H_
11 
12 #include "ixp4xx-regs.h"
13 #include <asm/mach-types.h>
14 #include <linux/serial_reg.h>
15 
16 #define TX_DONE (UART_LSR_TEMT|UART_LSR_THRE)
17 
18 volatile u32* uart_base;
19 
putc(int c)20 static inline void putc(int c)
21 {
22 	/* Check THRE and TEMT bits before we transmit the character.
23 	 */
24 	while ((uart_base[UART_LSR] & TX_DONE) != TX_DONE)
25 		barrier();
26 
27 	*uart_base = c;
28 }
29 
flush(void)30 static void flush(void)
31 {
32 }
33 
__arch_decomp_setup(unsigned long arch_id)34 static __inline__ void __arch_decomp_setup(unsigned long arch_id)
35 {
36 	/*
37 	 * Some boards are using UART2 as console
38 	 */
39 	if (machine_is_adi_coyote() || machine_is_gtwx5715() ||
40 	    machine_is_gateway7001() || machine_is_wg302v2() ||
41 	    machine_is_devixp() || machine_is_miccpt() || machine_is_mic256())
42 		uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS;
43 	else
44 		uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS;
45 }
46 
47 /*
48  * arch_id is a variable in decompress_kernel()
49  */
50 #define arch_decomp_setup()	__arch_decomp_setup(arch_id)
51 
52 #endif
53