m32r_sio.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * arch/m32r/boot/compressed/m32r_sio.c
  3. *
  4. * 2003-02-12: Takeo Takahashi
  5. *
  6. */
  7. #include <linux/config.h>
  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_Alpha) || defined(CONFIG_PLAT_M32700UT)
  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. #define PLD_BASE 0xa4c00000
  30. #define BOOT_SIO0STS PLD_ESIO0STS
  31. #define BOOT_SIO0TXB PLD_ESIO0TXB
  32. #endif
  33. static void putc(char c)
  34. {
  35. while ((*BOOT_SIO0STS & 0x3) != 0x3)
  36. cpu_relax();
  37. if (c == '\n') {
  38. *BOOT_SIO0TXB = '\r';
  39. while ((*BOOT_SIO0STS & 0x3) != 0x3)
  40. cpu_relax();
  41. }
  42. *BOOT_SIO0TXB = c;
  43. }
  44. #else /* !(CONFIG_PLAT_M32700UT_Alpha) && !(CONFIG_PLAT_M32700UT) */
  45. #if defined(CONFIG_PLAT_MAPPI2)
  46. #define SIO0STS (volatile unsigned short *)(0xa0efd000 + 14)
  47. #define SIO0TXB (volatile unsigned short *)(0xa0efd000 + 30)
  48. #else
  49. #define SIO0STS (volatile unsigned short *)(0x00efd000 + 14)
  50. #define SIO0TXB (volatile unsigned short *)(0x00efd000 + 30)
  51. #endif
  52. static void putc(char c)
  53. {
  54. while ((*SIO0STS & 0x1) == 0)
  55. cpu_relax();
  56. if (c == '\n') {
  57. *SIO0TXB = '\r';
  58. while ((*SIO0STS & 0x1) == 0)
  59. cpu_relax();
  60. }
  61. *SIO0TXB = c;
  62. }
  63. #endif