m32r_sio.c 1.4 KB

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