mv64x60_dbg.c 2.0 KB

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