patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / include / asm-arm / arch-omap / uncompress.h
1 /*
2  * linux/include/asm-arm/arch-omap/uncompress.h
3  *
4  * Serial port stubs for kernel decompress status messages
5  *
6  * Initially based on:
7  * linux-2.4.15-rmk1-dsplinux1.6/include/asm-arm/arch-omap1510/uncompress.h
8  * Copyright (C) 2000 RidgeRun, Inc.
9  * Author: Greg Lonnon <glonnon@ridgerun.com>
10  *
11  * Rewritten by:
12  * Author: <source@mvista.com>
13  * 2004 (c) MontaVista Software, Inc.
14  *
15  * This file is licensed under the terms of the GNU General Public License
16  * version 2. This program is licensed "as is" without any warranty of any
17  * kind, whether express or implied.
18  */
19
20 #include <linux/config.h>
21 #include <linux/types.h>
22 #include <linux/serial_reg.h>
23 #include <asm/hardware.h>
24 #include <asm/arch/serial.h>
25
26 #define UART_OMAP_MDR1          0x08    /* mode definition register */
27 #define check_port(base, shift) ((base[UART_OMAP_MDR1 << shift] & 7) == 0)
28 #define omap_get_id() ((*(volatile unsigned int *)(0xfffed404)) >> 12) & ID_MASK
29
30 static void
31 puts(const char *s)
32 {
33         volatile u8 * uart = 0;
34         int shift = 0;
35
36 #ifdef  CONFIG_OMAP_LL_DEBUG_UART3
37         uart = (volatile u8 *)(OMAP_UART3_BASE);
38 #elif   CONFIG_OMAP_LL_DEBUG_UART2
39         uart = (volatile u8 *)(OMAP_UART2_BASE);
40 #else
41         uart = (volatile u8 *)(OMAP_UART1_BASE);
42 #endif
43
44         /* Determine which serial port to use */
45         do {
46                 /* MMU is not on, so cpu_is_omapXXXX() won't work here */
47                 unsigned int omap_id = omap_get_id();
48
49                 if (omap_id == OMAP_ID_1510 || omap_id == OMAP_ID_1610 ||
50                     omap_id == OMAP_ID_1710 || omap_id == OMAP_ID_5912) {
51                         shift = 2;
52                 } else if (omap_id == OMAP_ID_730) {
53                         shift = 0;
54                 } else {
55                         /* Assume nothing for unknown OMAP processors.
56                          * Add an entry for your OMAP type to select
57                          * the default serial console here. If the
58                          * serial port is enabled, we'll use it to
59                          * display status messages. Else we'll be
60                          * quiet.
61                          */
62                         return;
63                 }
64                 if (check_port(uart, shift))
65                         break;
66                 /* Silent boot if no serial ports are enabled. */
67                 return;
68         } while (0);
69
70         /*
71          * Now, xmit each character
72          */
73         while (*s) {
74                 while (!(uart[UART_LSR << shift] & UART_LSR_THRE))
75                         barrier();
76                 uart[UART_TX << shift] = *s;
77                 if (*s++ == '\n') {
78                         while (!(uart[UART_LSR << shift] & UART_LSR_THRE))
79                                 barrier();
80                         uart[UART_TX << shift] = '\r';
81                 }
82         }
83 }
84
85 /*
86  * nothing to do
87  */
88 #define arch_decomp_setup()
89 #define arch_decomp_wdog()