m32r_sio.c 1.6 KB

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