aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m32r/boot/compressed/m32r_sio.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/m32r/boot/compressed/m32r_sio.c')
-rw-r--r--arch/m32r/boot/compressed/m32r_sio.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/arch/m32r/boot/compressed/m32r_sio.c b/arch/m32r/boot/compressed/m32r_sio.c
new file mode 100644
index 000000000000..bad5475eff90
--- /dev/null
+++ b/arch/m32r/boot/compressed/m32r_sio.c
@@ -0,0 +1,68 @@
1/*
2 * arch/m32r/boot/compressed/m32r_sio.c
3 *
4 * 2003-02-12: Takeo Takahashi
5 *
6 */
7
8#include <linux/config.h>
9
10static void putc(char c);
11
12static int puts(const char *s)
13{
14 char c;
15 while ((c = *s++)) putc(c);
16 return 0;
17}
18
19#if defined(CONFIG_PLAT_M32700UT_Alpha) || defined(CONFIG_PLAT_M32700UT)
20#include <asm/m32r.h>
21#include <asm/io.h>
22
23#define USE_FPGA_MAP 0
24
25#if USE_FPGA_MAP
26/*
27 * fpga configuration program uses MMU, and define map as same as
28 * M32104 uT-Engine board.
29 */
30#define BOOT_SIO0STS (volatile unsigned short *)(0x02c00000 + 0x20006)
31#define BOOT_SIO0TXB (volatile unsigned short *)(0x02c00000 + 0x2000c)
32#else
33#undef PLD_BASE
34#define PLD_BASE 0xa4c00000
35#define BOOT_SIO0STS PLD_ESIO0STS
36#define BOOT_SIO0TXB PLD_ESIO0TXB
37#endif
38
39static void putc(char c)
40{
41
42 while ((*BOOT_SIO0STS & 0x3) != 0x3) ;
43 if (c == '\n') {
44 *BOOT_SIO0TXB = '\r';
45 while ((*BOOT_SIO0STS & 0x3) != 0x3) ;
46 }
47 *BOOT_SIO0TXB = c;
48}
49#else /* defined(CONFIG_PLAT_M32700UT_Alpha) || defined(CONFIG_PLAT_M32700UT) */
50#ifdef CONFIG_MMU
51#define SIO0STS (volatile unsigned short *)(0xa0efd000 + 14)
52#define SIO0TXB (volatile unsigned short *)(0xa0efd000 + 30)
53#else
54#define SIO0STS (volatile unsigned short *)(0x00efd000 + 14)
55#define SIO0TXB (volatile unsigned short *)(0x00efd000 + 30)
56#endif
57
58static void putc(char c)
59{
60
61 while ((*SIO0STS & 0x1) == 0) ;
62 if (c == '\n') {
63 *SIO0TXB = '\r';
64 while ((*SIO0STS & 0x1) == 0) ;
65 }
66 *SIO0TXB = c;
67}
68#endif