1/*
2 * linux/include/asm-arm/arch-nexuspci/uncompress.h
3 *
4 * Copyright (C) 1998, 1999, 2000 Philip Blundell
5 */
6
7/*
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13
14#include <asm/hardware.h>
15#include <asm/io.h>
16
17/*
18 * Write a character to the UART
19 */
20void _ll_write_char(char c)
21{
22	while (!(__raw_readb(DUART_START + 0x4) & 0x4))
23		barrier();
24	__raw_writeb(c, DUART_START + 0xc);
25}
26
27/*
28 * This does not append a newline
29 */
30static void puts(const char *s)
31{
32	while (*s) {
33		if (*s == '\n')
34			_ll_write_char('\r');
35		_ll_write_char(*(s++));
36	}
37}
38
39/*
40 * Set up for decompression
41 */
42static void arch_decomp_setup(void)
43{
44	/* LED off */
45	__raw_writel(INTCONT_LED, INTCONT_START);
46
47	/* Set up SCC */
48	__raw_writeb(42, DUART_START + 8);
49	__raw_writeb(48, DUART_START + 8);
50	__raw_writeb(16, DUART_START + 8);
51	__raw_writeb(0x93, DUART_START);
52	__raw_writeb(0x17, DUART_START);
53	__raw_writeb(0xbb, DUART_START + 4);
54	__raw_writeb(0x78, DUART_START + 16);
55	__raw_writeb(0xa0, DUART_START + 8);
56	__raw_writeb(5, DUART_START + 8);
57}
58
59/*
60 * Stroke the watchdog so we don't get reset during decompression.
61 */
62static inline void arch_decomp_wdog(void)
63{
64	__raw_writel(INTCONT_WATCHDOG, INTCONT_START);
65	__raw_writel(INTCONT_WATCHDOG | 1, INTCONT_START);
66}
67