mv64x60_dbg.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. * arch/ppc/syslib/mv64x60_dbg.c
  3. *
  4. * KGDB and progress routines for the Marvell/Galileo MV64x60 (Discovery).
  5. *
  6. * Author: Mark A. Greer <mgreer@mvista.com>
  7. *
  8. * 2003 (c) MontaVista Software, Inc. This file is licensed under
  9. * the terms of the GNU General Public License version 2. This program
  10. * is licensed "as is" without any warranty of any kind, whether express
  11. * or implied.
  12. */
  13. /*
  14. *****************************************************************************
  15. *
  16. * Low-level MPSC/UART I/O routines
  17. *
  18. *****************************************************************************
  19. */
  20. #include <linux/config.h>
  21. #include <linux/irq.h>
  22. #include <asm/delay.h>
  23. #include <asm/mv64x60.h>
  24. #include <asm/machdep.h>
  25. #if defined(CONFIG_SERIAL_TEXT_DEBUG)
  26. #define MPSC_CHR_1 0x000c
  27. #define MPSC_CHR_2 0x0010
  28. static struct mv64x60_handle mv64x60_dbg_bh;
  29. void
  30. mv64x60_progress_init(u32 base)
  31. {
  32. mv64x60_dbg_bh.v_base = base;
  33. return;
  34. }
  35. static void
  36. mv64x60_polled_putc(int chan, char c)
  37. {
  38. u32 offset;
  39. if (chan == 0)
  40. offset = 0x8000;
  41. else
  42. offset = 0x9000;
  43. mv64x60_write(&mv64x60_dbg_bh, offset + MPSC_CHR_1, (u32)c);
  44. mv64x60_write(&mv64x60_dbg_bh, offset + MPSC_CHR_2, 0x200);
  45. udelay(2000);
  46. }
  47. void
  48. mv64x60_mpsc_progress(char *s, unsigned short hex)
  49. {
  50. volatile char c;
  51. mv64x60_polled_putc(0, '\r');
  52. while ((c = *s++) != 0)
  53. mv64x60_polled_putc(0, c);
  54. mv64x60_polled_putc(0, '\n');
  55. mv64x60_polled_putc(0, '\r');
  56. return;
  57. }
  58. #endif /* CONFIG_SERIAL_TEXT_DEBUG */
  59. #if defined(CONFIG_KGDB)
  60. #if defined(CONFIG_KGDB_TTYS0)
  61. #define KGDB_PORT 0
  62. #elif defined(CONFIG_KGDB_TTYS1)
  63. #define KGDB_PORT 1
  64. #else
  65. #error "Invalid kgdb_tty port"
  66. #endif
  67. void
  68. putDebugChar(unsigned char c)
  69. {
  70. mv64x60_polled_putc(KGDB_PORT, (char)c);
  71. }
  72. int
  73. getDebugChar(void)
  74. {
  75. unsigned char c;
  76. while (!mv64x60_polled_getc(KGDB_PORT, &c));
  77. return (int)c;
  78. }
  79. void
  80. putDebugString(char* str)
  81. {
  82. while (*str != '\0') {
  83. putDebugChar(*str);
  84. str++;
  85. }
  86. putDebugChar('\r');
  87. return;
  88. }
  89. void
  90. kgdb_interruptible(int enable)
  91. {
  92. }
  93. void
  94. kgdb_map_scc(void)
  95. {
  96. if (ppc_md.early_serial_map)
  97. ppc_md.early_serial_map();
  98. }
  99. #endif /* CONFIG_KGDB */