m32r_sio.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * arch/m32r/boot/compressed/m32r_sio.c
  3. *
  4. * 2003-02-12: Takeo Takahashi
  5. *
  6. */
  7. #include <asm/processor.h>
  8. static void putc(char c);
  9. static int puts(const char *s)
  10. {
  11. char c;
  12. while ((c = *s++)) putc(c);
  13. return 0;
  14. }
  15. #if defined(CONFIG_PLAT_M32700UT_Alpha) || defined(CONFIG_PLAT_M32700UT)
  16. #include <asm/m32r.h>
  17. #include <asm/io.h>
  18. #define USE_FPGA_MAP 0
  19. #if USE_FPGA_MAP
  20. /*
  21. * fpga configuration program uses MMU, and define map as same as
  22. * M32104 uT-Engine board.
  23. */
  24. #define BOOT_SIO0STS (volatile unsigned short *)(0x02c00000 + 0x20006)
  25. #define BOOT_SIO0TXB (volatile unsigned short *)(0x02c00000 + 0x2000c)
  26. #else
  27. #undef PLD_BASE
  28. #define PLD_BASE 0xa4c00000
  29. #define BOOT_SIO0STS PLD_ESIO0STS
  30. #define BOOT_SIO0TXB PLD_ESIO0TXB
  31. #endif
  32. static void putc(char c)
  33. {
  34. while ((*BOOT_SIO0STS & 0x3) != 0x3)
  35. cpu_relax();
  36. if (c == '\n') {
  37. *BOOT_SIO0TXB = '\r';
  38. while ((*BOOT_SIO0STS & 0x3) != 0x3)
  39. cpu_relax();
  40. }
  41. *BOOT_SIO0TXB = c;
  42. }
  43. #else /* !(CONFIG_PLAT_M32700UT_Alpha) && !(CONFIG_PLAT_M32700UT) */
  44. #if defined(CONFIG_PLAT_MAPPI2)
  45. #define SIO0STS (volatile unsigned short *)(0xa0efd000 + 14)
  46. #define SIO0TXB (volatile unsigned short *)(0xa0efd000 + 30)
  47. #else
  48. #define SIO0STS (volatile unsigned short *)(0x00efd000 + 14)
  49. #define SIO0TXB (volatile unsigned short *)(0x00efd000 + 30)
  50. #endif
  51. static void putc(char c)
  52. {
  53. while ((*SIO0STS & 0x1) == 0)
  54. cpu_relax();
  55. if (c == '\n') {
  56. *SIO0TXB = '\r';
  57. while ((*SIO0STS & 0x1) == 0)
  58. cpu_relax();
  59. }
  60. *SIO0TXB = c;
  61. }
  62. #endif