Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * arch/m32r/boot/compressed/m32r_sio.c | |
3 | * | |
4 | * 2003-02-12: Takeo Takahashi | |
d93f7de8 | 5 | * 2006-11-30: OPSPUT support by Kazuhiro Inaoka |
1da177e4 LT |
6 | * |
7 | */ | |
8 | ||
23680863 | 9 | #include <asm/processor.h> |
1da177e4 | 10 | |
9babed6a | 11 | static void m32r_putc(char c); |
1da177e4 LT |
12 | |
13 | static int puts(const char *s) | |
14 | { | |
15 | char c; | |
9babed6a SM |
16 | while ((c = *s++)) |
17 | m32r_putc(c); | |
1da177e4 LT |
18 | return 0; |
19 | } | |
20 | ||
7852375b | 21 | #if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_OPSPUT) |
1da177e4 LT |
22 | #include <asm/m32r.h> |
23 | #include <asm/io.h> | |
24 | ||
25 | #define USE_FPGA_MAP 0 | |
26 | ||
27 | #if USE_FPGA_MAP | |
28 | /* | |
29 | * fpga configuration program uses MMU, and define map as same as | |
30 | * M32104 uT-Engine board. | |
31 | */ | |
32 | #define BOOT_SIO0STS (volatile unsigned short *)(0x02c00000 + 0x20006) | |
33 | #define BOOT_SIO0TXB (volatile unsigned short *)(0x02c00000 + 0x2000c) | |
34 | #else | |
35 | #undef PLD_BASE | |
d93f7de8 HT |
36 | #if defined(CONFIG_PLAT_OPSPUT) |
37 | #define PLD_BASE 0x1cc00000 | |
38 | #else | |
1da177e4 | 39 | #define PLD_BASE 0xa4c00000 |
d93f7de8 | 40 | #endif |
1da177e4 LT |
41 | #define BOOT_SIO0STS PLD_ESIO0STS |
42 | #define BOOT_SIO0TXB PLD_ESIO0TXB | |
43 | #endif | |
44 | ||
9babed6a | 45 | static void m32r_putc(char c) |
1da177e4 | 46 | { |
23680863 HT |
47 | while ((*BOOT_SIO0STS & 0x3) != 0x3) |
48 | cpu_relax(); | |
1da177e4 LT |
49 | if (c == '\n') { |
50 | *BOOT_SIO0TXB = '\r'; | |
23680863 HT |
51 | while ((*BOOT_SIO0STS & 0x3) != 0x3) |
52 | cpu_relax(); | |
1da177e4 LT |
53 | } |
54 | *BOOT_SIO0TXB = c; | |
55 | } | |
7852375b | 56 | #else /* !(CONFIG_PLAT_M32700UT) */ |
23680863 | 57 | #if defined(CONFIG_PLAT_MAPPI2) |
1da177e4 LT |
58 | #define SIO0STS (volatile unsigned short *)(0xa0efd000 + 14) |
59 | #define SIO0TXB (volatile unsigned short *)(0xa0efd000 + 30) | |
60 | #else | |
61 | #define SIO0STS (volatile unsigned short *)(0x00efd000 + 14) | |
62 | #define SIO0TXB (volatile unsigned short *)(0x00efd000 + 30) | |
63 | #endif | |
64 | ||
9babed6a | 65 | static void m32r_putc(char c) |
1da177e4 | 66 | { |
23680863 HT |
67 | while ((*SIO0STS & 0x1) == 0) |
68 | cpu_relax(); | |
1da177e4 LT |
69 | if (c == '\n') { |
70 | *SIO0TXB = '\r'; | |
23680863 HT |
71 | while ((*SIO0STS & 0x1) == 0) |
72 | cpu_relax(); | |
1da177e4 LT |
73 | } |
74 | *SIO0TXB = c; | |
75 | } | |
76 | #endif |