Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / arch / m32r / boot / compressed / m32r_sio.c
index 469c4dc..8f9a572 100644 (file)
@@ -6,12 +6,11 @@
  */
 
 #include <linux/config.h>
-#include <asm/m32r.h>
-#include <asm/io.h>
+#include <asm/processor.h>
 
-void putc(char c);
+static void putc(char c);
 
-int puts(const char *s)
+static int puts(const char *s)
 {
        char c;
        while ((c = *s++)) putc(c);
@@ -19,6 +18,9 @@ int puts(const char *s)
 }
 
 #if defined(CONFIG_PLAT_M32700UT_Alpha) || defined(CONFIG_PLAT_M32700UT)
+#include <asm/m32r.h>
+#include <asm/io.h>
+
 #define USE_FPGA_MAP   0
 
 #if USE_FPGA_MAP
@@ -35,19 +37,35 @@ int puts(const char *s)
 #define BOOT_SIO0TXB   PLD_ESIO0TXB
 #endif
 
-void putc(char c)
+static void putc(char c)
 {
-
-       while ((*BOOT_SIO0STS & 0x3) != 0x3) ;
+       while ((*BOOT_SIO0STS & 0x3) != 0x3)
+               cpu_relax();
        if (c == '\n') {
                *BOOT_SIO0TXB = '\r';
-               while ((*BOOT_SIO0STS & 0x3) != 0x3) ;
+               while ((*BOOT_SIO0STS & 0x3) != 0x3)
+                       cpu_relax();
        }
        *BOOT_SIO0TXB = c;
 }
+#else /* !(CONFIG_PLAT_M32700UT_Alpha) && !(CONFIG_PLAT_M32700UT) */
+#if defined(CONFIG_PLAT_MAPPI2)
+#define SIO0STS        (volatile unsigned short *)(0xa0efd000 + 14)
+#define SIO0TXB        (volatile unsigned short *)(0xa0efd000 + 30)
 #else
-void putc(char c)
+#define SIO0STS        (volatile unsigned short *)(0x00efd000 + 14)
+#define SIO0TXB        (volatile unsigned short *)(0x00efd000 + 30)
+#endif
+
+static void putc(char c)
 {
-       /* do nothing */
+       while ((*SIO0STS & 0x1) == 0)
+               cpu_relax();
+       if (c == '\n') {
+               *SIO0TXB = '\r';
+               while ((*SIO0STS & 0x1) == 0)
+                       cpu_relax();
+       }
+       *SIO0TXB = c;
 }
 #endif