1 /*
2  * arch/arm/mach-lpc32xx/include/mach/uncompress.h
3  *
4  * Author: Kevin Wells <kevin.wells@nxp.com>
5  *
6  * Copyright (C) 2010 NXP Semiconductors
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  */
18 
19 #ifndef __ASM_ARM_ARCH_UNCOMPRESS_H
20 #define __ASM_ARM_ARCH_UNCOMPRESS_H
21 
22 #include <linux/io.h>
23 
24 #include <mach/hardware.h>
25 #include <mach/platform.h>
26 
27 /*
28  * Uncompress output is hardcoded to standard UART 5
29  */
30 
31 #define UART_FIFO_CTL_TX_RESET	(1 << 2)
32 #define UART_STATUS_TX_MT	(1 << 6)
33 
34 #define _UARTREG(x)		(void __iomem *)(LPC32XX_UART5_BASE + (x))
35 
36 #define LPC32XX_UART_DLLFIFO_O	0x00
37 #define LPC32XX_UART_IIRFCR_O	0x08
38 #define LPC32XX_UART_LSR_O	0x14
39 
putc(int ch)40 static inline void putc(int ch)
41 {
42 	/* Wait for transmit FIFO to empty */
43 	while ((__raw_readl(_UARTREG(LPC32XX_UART_LSR_O)) &
44 		UART_STATUS_TX_MT) == 0)
45 		;
46 
47 	__raw_writel((u32) ch, _UARTREG(LPC32XX_UART_DLLFIFO_O));
48 }
49 
flush(void)50 static inline void flush(void)
51 {
52 	__raw_writel(__raw_readl(_UARTREG(LPC32XX_UART_IIRFCR_O)) |
53 		UART_FIFO_CTL_TX_RESET, _UARTREG(LPC32XX_UART_IIRFCR_O));
54 }
55 
56 /* NULL functions; we don't presently need them */
57 #define arch_decomp_setup()
58 #define arch_decomp_wdog()
59 
60 #endif
61