blob: 8f9a57271f8345cfd61e43ec5968bdd086f6600a [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * arch/m32r/boot/compressed/m32r_sio.c
3 *
4 * 2003-02-12: Takeo Takahashi
5 *
6 */
7
8#include <linux/config.h>
Hirokazu Takata23680862005-06-21 17:16:10 -07009#include <asm/processor.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070010
11static void putc(char c);
12
13static int puts(const char *s)
14{
15 char c;
16 while ((c = *s++)) putc(c);
17 return 0;
18}
19
20#if defined(CONFIG_PLAT_M32700UT_Alpha) || defined(CONFIG_PLAT_M32700UT)
21#include <asm/m32r.h>
22#include <asm/io.h>
23
24#define USE_FPGA_MAP 0
25
26#if USE_FPGA_MAP
27/*
28 * fpga configuration program uses MMU, and define map as same as
29 * M32104 uT-Engine board.
30 */
31#define BOOT_SIO0STS (volatile unsigned short *)(0x02c00000 + 0x20006)
32#define BOOT_SIO0TXB (volatile unsigned short *)(0x02c00000 + 0x2000c)
33#else
34#undef PLD_BASE
35#define PLD_BASE 0xa4c00000
36#define BOOT_SIO0STS PLD_ESIO0STS
37#define BOOT_SIO0TXB PLD_ESIO0TXB
38#endif
39
40static void putc(char c)
41{
Hirokazu Takata23680862005-06-21 17:16:10 -070042 while ((*BOOT_SIO0STS & 0x3) != 0x3)
43 cpu_relax();
Linus Torvalds1da177e2005-04-16 15:20:36 -070044 if (c == '\n') {
45 *BOOT_SIO0TXB = '\r';
Hirokazu Takata23680862005-06-21 17:16:10 -070046 while ((*BOOT_SIO0STS & 0x3) != 0x3)
47 cpu_relax();
Linus Torvalds1da177e2005-04-16 15:20:36 -070048 }
49 *BOOT_SIO0TXB = c;
50}
Hirokazu Takata23680862005-06-21 17:16:10 -070051#else /* !(CONFIG_PLAT_M32700UT_Alpha) && !(CONFIG_PLAT_M32700UT) */
52#if defined(CONFIG_PLAT_MAPPI2)
Linus Torvalds1da177e2005-04-16 15:20:36 -070053#define SIO0STS (volatile unsigned short *)(0xa0efd000 + 14)
54#define SIO0TXB (volatile unsigned short *)(0xa0efd000 + 30)
55#else
56#define SIO0STS (volatile unsigned short *)(0x00efd000 + 14)
57#define SIO0TXB (volatile unsigned short *)(0x00efd000 + 30)
58#endif
59
60static void putc(char c)
61{
Hirokazu Takata23680862005-06-21 17:16:10 -070062 while ((*SIO0STS & 0x1) == 0)
63 cpu_relax();
Linus Torvalds1da177e2005-04-16 15:20:36 -070064 if (c == '\n') {
65 *SIO0TXB = '\r';
Hirokazu Takata23680862005-06-21 17:16:10 -070066 while ((*SIO0STS & 0x1) == 0)
67 cpu_relax();
Linus Torvalds1da177e2005-04-16 15:20:36 -070068 }
69 *SIO0TXB = c;
70}
71#endif