m32r_sio.c 1.5 KB

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