sync hh.org
[hh.org.git] / arch / m32r / boot / compressed / m32r_sio.c
blobbce8af5e3bb2ab6f542b198770cdb8b0e1e72ab1
1 /*
2 * arch/m32r/boot/compressed/m32r_sio.c
4 * 2003-02-12: Takeo Takahashi
6 */
8 #include <asm/processor.h>
10 static void putc(char c);
12 static int puts(const char *s)
14 char c;
15 while ((c = *s++)) putc(c);
16 return 0;
19 #if defined(CONFIG_PLAT_M32700UT_Alpha) || defined(CONFIG_PLAT_M32700UT)
20 #include <asm/m32r.h>
21 #include <asm/io.h>
23 #define USE_FPGA_MAP 0
25 #if USE_FPGA_MAP
27 * fpga configuration program uses MMU, and define map as same as
28 * M32104 uT-Engine board.
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
39 static void putc(char c)
41 while ((*BOOT_SIO0STS & 0x3) != 0x3)
42 cpu_relax();
43 if (c == '\n') {
44 *BOOT_SIO0TXB = '\r';
45 while ((*BOOT_SIO0STS & 0x3) != 0x3)
46 cpu_relax();
48 *BOOT_SIO0TXB = c;
50 #else /* !(CONFIG_PLAT_M32700UT_Alpha) && !(CONFIG_PLAT_M32700UT) */
51 #if defined(CONFIG_PLAT_MAPPI2)
52 #define SIO0STS (volatile unsigned short *)(0xa0efd000 + 14)
53 #define SIO0TXB (volatile unsigned short *)(0xa0efd000 + 30)
54 #else
55 #define SIO0STS (volatile unsigned short *)(0x00efd000 + 14)
56 #define SIO0TXB (volatile unsigned short *)(0x00efd000 + 30)
57 #endif
59 static void putc(char c)
61 while ((*SIO0STS & 0x1) == 0)
62 cpu_relax();
63 if (c == '\n') {
64 *SIO0TXB = '\r';
65 while ((*SIO0STS & 0x1) == 0)
66 cpu_relax();
68 *SIO0TXB = c;
70 #endif