mv64x60_dbg.c 2.1 KB

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