blob: 9e08b270cfc703f14b5a9ecbc544b76beff049e8 [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Russell Kinga09e64f2008-08-05 16:14:15 +01002/*
3 * arch/arm/mach-ixp4xx/include/mach/uncompress.h
4 *
5 * Copyright (C) 2002 Intel Corporation.
6 * Copyright (C) 2003-2004 MontaVista Software, Inc.
Russell Kinga09e64f2008-08-05 16:14:15 +01007 */
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
Nicolas Pitre8ea0de42011-04-28 17:00:17 -040018volatile u32* uart_base;
Russell Kinga09e64f2008-08-05 16:14:15 +010019
20static 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
30static void flush(void)
31{
32}
33
34static __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() ||
Richard Cochran2b8f0112011-09-28 15:16:41 +020040 machine_is_gateway7001() || machine_is_wg302v2() ||
41 machine_is_devixp() || machine_is_miccpt() || machine_is_mic256())
Russell Kinga09e64f2008-08-05 16:14:15 +010042 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
Russell Kinga09e64f2008-08-05 16:14:15 +010052#endif