mpsc.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /*
  2. * (C) Copyright 2001
  3. * John Clemens <clemens@mclx.com>, Mission Critical Linux, Inc.
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. /*************************************************************************
  24. * changes for Marvell DB64460 eval board 2003 by Ingo Assmus <ingo.assmus@keymile.com>
  25. *
  26. ************************************************************************/
  27. /*
  28. * mpsc.h - header file for MPSC in uart mode (console driver)
  29. */
  30. #ifndef __MPSC_H__
  31. #define __MPSC_H__
  32. /* include actual Galileo defines */
  33. #include "../include/mv_gen_reg.h"
  34. /* driver related defines */
  35. int mpsc_init(int baud);
  36. void mpsc_sdma_init(void);
  37. void mpsc_init2(void);
  38. int galbrg_set_baudrate(int channel, int rate);
  39. int mpsc_putchar_early(char ch);
  40. char mpsc_getchar_debug(void);
  41. int mpsc_test_char_debug(void);
  42. int mpsc_test_char_sdma(void);
  43. extern int (*mpsc_putchar)(char ch);
  44. extern char (*mpsc_getchar)(void);
  45. extern int (*mpsc_test_char)(void);
  46. #define CHANNEL CONFIG_MPSC_PORT
  47. #define TX_DESC 5
  48. #define RX_DESC 20
  49. #define DESC_FIRST 0x00010000
  50. #define DESC_LAST 0x00020000
  51. #define DESC_OWNER_BIT 0x80000000
  52. #define TX_DEMAND 0x00800000
  53. #define TX_STOP 0x00010000
  54. #define RX_ENABLE 0x00000080
  55. #define SDMA_RX_ABORT (1 << 15)
  56. #define SDMA_TX_ABORT (1 << 31)
  57. #define MPSC_TX_ABORT (1 << 7)
  58. #define MPSC_RX_ABORT (1 << 23)
  59. #define MPSC_ENTER_HUNT (1 << 31)
  60. /* MPSC defines */
  61. #define GALMPSC_CONNECT 0x1
  62. #define GALMPSC_DISCONNECT 0x0
  63. #define GALMPSC_UART 0x1
  64. #define GALMPSC_STOP_BITS_1 0x0
  65. #define GALMPSC_STOP_BITS_2 0x1
  66. #define GALMPSC_CHAR_LENGTH_8 0x3
  67. #define GALMPSC_CHAR_LENGTH_7 0x2
  68. #define GALMPSC_PARITY_ODD 0x0
  69. #define GALMPSC_PARITY_EVEN 0x2
  70. #define GALMPSC_PARITY_MARK 0x3
  71. #define GALMPSC_PARITY_SPACE 0x1
  72. #define GALMPSC_PARITY_NONE -1
  73. #define GALMPSC_SERIAL_MULTIPLEX SERIAL_PORT_MULTIPLEX /* 0xf010 */
  74. #define GALMPSC_ROUTING_REGISTER MAIN_ROUTING_REGISTER /* 0xb400 */
  75. #define GALMPSC_RxC_ROUTE RECEIVE_CLOCK_ROUTING_REGISTER /* 0xb404 */
  76. #define GALMPSC_TxC_ROUTE TRANSMIT_CLOCK_ROUTING_REGISTER /* 0xb408 */
  77. #define GALMPSC_MCONF_LOW MPSC0_MAIN_CONFIGURATION_LOW /* 0x8000 */
  78. #define GALMPSC_MCONF_HIGH MPSC0_MAIN_CONFIGURATION_HIGH /* 0x8004 */
  79. #define GALMPSC_PROTOCONF_REG MPSC0_PROTOCOL_CONFIGURATION /* 0x8008 */
  80. #define GALMPSC_REG_GAP 0x1000
  81. #define GALMPSC_MCONF_CHREG_BASE CHANNEL0_REGISTER1 /* 0x800c */
  82. #define GALMPSC_CHANNELREG_1 CHANNEL0_REGISTER1 /* 0x800c */
  83. #define GALMPSC_CHANNELREG_2 CHANNEL0_REGISTER2 /* 0x8010 */
  84. #define GALMPSC_CHANNELREG_3 CHANNEL0_REGISTER3 /* 0x8014 */
  85. #define GALMPSC_CHANNELREG_4 CHANNEL0_REGISTER4 /* 0x8018 */
  86. #define GALMPSC_CHANNELREG_5 CHANNEL0_REGISTER5 /* 0x801c */
  87. #define GALMPSC_CHANNELREG_6 CHANNEL0_REGISTER6 /* 0x8020 */
  88. #define GALMPSC_CHANNELREG_7 CHANNEL0_REGISTER7 /* 0x8024 */
  89. #define GALMPSC_CHANNELREG_8 CHANNEL0_REGISTER8 /* 0x8028 */
  90. #define GALMPSC_CHANNELREG_9 CHANNEL0_REGISTER9 /* 0x802c */
  91. #define GALMPSC_CHANNELREG_10 CHANNEL0_REGISTER10 /* 0x8030 */
  92. #define GALMPSC_CHANNELREG_11 CHANNEL0_REGISTER11 /* 0x8034 */
  93. #define GALSDMA_COMMAND_FIRST (1 << 16)
  94. #define GALSDMA_COMMAND_LAST (1 << 17)
  95. #define GALSDMA_COMMAND_ENABLEINT (1 << 23)
  96. #define GALSDMA_COMMAND_AUTO (1 << 30)
  97. #define GALSDMA_COMMAND_OWNER (1 << 31)
  98. #define GALSDMA_RX 0
  99. #define GALSDMA_TX 1
  100. /* CHANNEL2 should be CHANNEL1, according to documentation,
  101. * but to work with the current GTREGS file...
  102. */
  103. #define GALSDMA_0_CONF_REG CHANNEL0_CONFIGURATION_REGISTER /* 0x4000 */
  104. #define GALSDMA_1_CONF_REG CHANNEL2_CONFIGURATION_REGISTER /* 0x6000 */
  105. #define GALSDMA_0_COM_REG CHANNEL0_COMMAND_REGISTER /* 0x4008 */
  106. #define GALSDMA_1_COM_REG CHANNEL2_COMMAND_REGISTER /* 0x6008 */
  107. #define GALSDMA_0_CUR_RX_PTR CHANNEL0_CURRENT_RX_DESCRIPTOR_POINTER /* 0x4810 */
  108. #define GALSDMA_0_CUR_TX_PTR CHANNEL0_CURRENT_TX_DESCRIPTOR_POINTER /* 0x4c10 */
  109. #define GALSDMA_0_FIR_TX_PTR CHANNEL0_FIRST_TX_DESCRIPTOR_POINTER /* 0x4c14 */
  110. #define GALSDMA_1_CUR_RX_PTR CHANNEL2_CURRENT_RX_DESCRIPTOR_POINTER /* 0x6810 */
  111. #define GALSDMA_1_CUR_TX_PTR CHANNEL2_CURRENT_TX_DESCRIPTOR_POINTER /* 0x6c10 */
  112. #define GALSDMA_1_FIR_TX_PTR CHANNEL2_FIRST_TX_DESCRIPTOR_POINTER /* 0x6c14 */
  113. #define GALSDMA_REG_DIFF 0x2000
  114. /* WRONG in gt64260R.h */
  115. #define GALSDMA_INT_CAUSE 0xb800 /* SDMA_CAUSE */
  116. #define GALSDMA_INT_MASK 0xb880 /* SDMA_MASK */
  117. #define GALMPSC_0_INT_CAUSE 0xb804
  118. #define GALMPSC_0_INT_MASK 0xb884
  119. #define GALSDMA_MODE_UART 0
  120. #define GALSDMA_MODE_BISYNC 1
  121. #define GALSDMA_MODE_HDLC 2
  122. #define GALSDMA_MODE_TRANSPARENT 3
  123. #define GALBRG_0_CONFREG BRG0_CONFIGURATION_REGISTER /* 0xb200 */
  124. #define GALBRG_REG_GAP 0x0008
  125. #define GALBRG_0_BTREG BRG0_BAUDE_TUNING_REGISTER /* 0xb204 */
  126. #endif /* __MPSC_H__ */