blob: 759b851ec985e02939d2b8f23cb7b9af8019a1c0 [file] [log] [blame]
Russell Kinga09e64f2008-08-05 16:14:15 +01001/*
2 * arch/arm/mach-pxa/include/mach/uncompress.h
3 *
4 * Author: Nicolas Pitre
5 * Copyright: (C) 2001 MontaVista Software Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/serial_reg.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010013#include <asm/mach-types.h>
14
Eric Miaoc95efee2010-02-19 13:49:39 +080015#define FFUART_BASE (0x40100000)
16#define BTUART_BASE (0x40200000)
17#define STUART_BASE (0x40700000)
Russell Kinga09e64f2008-08-05 16:14:15 +010018
Jonathan Cameron2a8ac182010-03-08 17:44:19 +000019static unsigned long uart_base;
20static unsigned int uart_shift;
21static unsigned int uart_is_pxa;
Eric Miaoc95efee2010-02-19 13:49:39 +080022
23static inline unsigned char uart_read(int offset)
24{
25 return *(volatile unsigned char *)(uart_base + (offset << uart_shift));
26}
27
28static inline void uart_write(unsigned char val, int offset)
29{
30 *(volatile unsigned char *)(uart_base + (offset << uart_shift)) = val;
31}
32
33static inline int uart_is_enabled(void)
34{
35 /* assume enabled by default for non-PXA uarts */
36 return uart_is_pxa ? uart_read(UART_IER) & UART_IER_UUE : 1;
37}
Russell Kinga09e64f2008-08-05 16:14:15 +010038
39static inline void putc(char c)
40{
Eric Miaoc95efee2010-02-19 13:49:39 +080041 if (!uart_is_enabled())
Russell Kinga09e64f2008-08-05 16:14:15 +010042 return;
Eric Miaoc95efee2010-02-19 13:49:39 +080043
44 while (!(uart_read(UART_LSR) & UART_LSR_THRE))
Russell Kinga09e64f2008-08-05 16:14:15 +010045 barrier();
Eric Miaoc95efee2010-02-19 13:49:39 +080046
47 uart_write(c, UART_TX);
Russell Kinga09e64f2008-08-05 16:14:15 +010048}
49
50/*
51 * This does not append a newline
52 */
53static inline void flush(void)
54{
55}
56
57static inline void arch_decomp_setup(void)
58{
Jonathan Cameron2a8ac182010-03-08 17:44:19 +000059 /* initialize to default */
60 uart_base = FFUART_BASE;
61 uart_shift = 2;
62 uart_is_pxa = 1;
63
Dmitry Eremin-Solenikovaac42972009-02-16 20:40:55 +030064 if (machine_is_littleton() || machine_is_intelmote2()
Mike Rapoport321d9eb2009-06-04 10:44:53 +030065 || machine_is_csb726() || machine_is_stargate2()
Jonathan McDowell2a23ec32009-07-04 14:43:56 +010066 || machine_is_cm_x300() || machine_is_balloon3())
Eric Miaoc95efee2010-02-19 13:49:39 +080067 uart_base = STUART_BASE;
Marc Zyngier662b08362010-02-19 14:07:37 +080068
69 if (machine_is_arcom_zeus()) {
70 uart_base = 0x10000000; /* nCS4 */
71 uart_shift = 1;
72 uart_is_pxa = 0;
73 }
Russell Kinga09e64f2008-08-05 16:14:15 +010074}
75
76/*
77 * nothing to do
78 */
79#define arch_decomp_wdog()