mv64x60_dbg.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. #if defined(CONFIG_SERIAL_TEXT_DEBUG)
  25. #define MPSC_CHR_1 0x000c
  26. #define MPSC_CHR_2 0x0010
  27. static struct mv64x60_handle mv64x60_dbg_bh;
  28. void
  29. mv64x60_progress_init(u32 base)
  30. {
  31. mv64x60_dbg_bh.v_base = base;
  32. return;
  33. }
  34. static void
  35. mv64x60_polled_putc(int chan, char c)
  36. {
  37. u32 offset;
  38. if (chan == 0)
  39. offset = 0x8000;
  40. else
  41. offset = 0x9000;
  42. mv64x60_write(&mv64x60_dbg_bh, offset + MPSC_CHR_1, (u32)c);
  43. mv64x60_write(&mv64x60_dbg_bh, offset + MPSC_CHR_2, 0x200);
  44. udelay(2000);
  45. }
  46. void
  47. mv64x60_mpsc_progress(char *s, unsigned short hex)
  48. {
  49. volatile char c;
  50. mv64x60_polled_putc(0, '\r');
  51. while ((c = *s++) != 0)
  52. mv64x60_polled_putc(0, c);
  53. mv64x60_polled_putc(0, '\n');
  54. mv64x60_polled_putc(0, '\r');
  55. return;
  56. }
  57. #endif /* CONFIG_SERIAL_TEXT_DEBUG */
  58. #if defined(CONFIG_KGDB)
  59. #if defined(CONFIG_KGDB_TTYS0)
  60. #define KGDB_PORT 0
  61. #elif defined(CONFIG_KGDB_TTYS1)
  62. #define KGDB_PORT 1
  63. #else
  64. #error "Invalid kgdb_tty port"
  65. #endif
  66. void
  67. putDebugChar(unsigned char c)
  68. {
  69. mv64x60_polled_putc(KGDB_PORT, (char)c);
  70. }
  71. int
  72. getDebugChar(void)
  73. {
  74. unsigned char c;
  75. while (!mv64x60_polled_getc(KGDB_PORT, &c));
  76. return (int)c;
  77. }
  78. void
  79. putDebugString(char* str)
  80. {
  81. while (*str != '\0') {
  82. putDebugChar(*str);
  83. str++;
  84. }
  85. putDebugChar('\r');
  86. return;
  87. }
  88. void
  89. kgdb_interruptible(int enable)
  90. {
  91. }
  92. void
  93. kgdb_map_scc(void)
  94. {
  95. if (ppc_md.early_serial_map)
  96. ppc_md.early_serial_map();
  97. }
  98. #endif /* CONFIG_KGDB */