Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / arch / m32r / boot / compressed / m32r_sio.c
blob9d34bd063c318277400ec17efe62da45e06a1e1c
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * arch/m32r/boot/compressed/m32r_sio.c
5 * 2003-02-12: Takeo Takahashi
6 * 2006-11-30: OPSPUT support by Kazuhiro Inaoka
8 */
10 #include <asm/processor.h>
12 static void m32r_putc(char c);
14 static int puts(const char *s)
16 char c;
17 while ((c = *s++))
18 m32r_putc(c);
19 return 0;
22 #if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_OPSPUT)
23 #include <asm/m32r.h>
24 #include <asm/io.h>
26 #define USE_FPGA_MAP 0
28 #if USE_FPGA_MAP
30 * fpga configuration program uses MMU, and define map as same as
31 * M32104 uT-Engine board.
33 #define BOOT_SIO0STS (volatile unsigned short *)(0x02c00000 + 0x20006)
34 #define BOOT_SIO0TXB (volatile unsigned short *)(0x02c00000 + 0x2000c)
35 #else
36 #undef PLD_BASE
37 #if defined(CONFIG_PLAT_OPSPUT)
38 #define PLD_BASE 0x1cc00000
39 #else
40 #define PLD_BASE 0xa4c00000
41 #endif
42 #define BOOT_SIO0STS PLD_ESIO0STS
43 #define BOOT_SIO0TXB PLD_ESIO0TXB
44 #endif
46 static void m32r_putc(char c)
48 while ((*BOOT_SIO0STS & 0x3) != 0x3)
49 cpu_relax();
50 if (c == '\n') {
51 *BOOT_SIO0TXB = '\r';
52 while ((*BOOT_SIO0STS & 0x3) != 0x3)
53 cpu_relax();
55 *BOOT_SIO0TXB = c;
57 #else /* !(CONFIG_PLAT_M32700UT) */
58 #if defined(CONFIG_PLAT_MAPPI2)
59 #define SIO0STS (volatile unsigned short *)(0xa0efd000 + 14)
60 #define SIO0TXB (volatile unsigned short *)(0xa0efd000 + 30)
61 #else
62 #define SIO0STS (volatile unsigned short *)(0x00efd000 + 14)
63 #define SIO0TXB (volatile unsigned short *)(0x00efd000 + 30)
64 #endif
66 static void m32r_putc(char c)
68 while ((*SIO0STS & 0x1) == 0)
69 cpu_relax();
70 if (c == '\n') {
71 *SIO0TXB = '\r';
72 while ((*SIO0STS & 0x1) == 0)
73 cpu_relax();
75 *SIO0TXB = c;
77 #endif