asc_serial.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. /* incaAscSio.h - (INCA) ASC UART tty driver header */
  2. #ifndef __INCincaAscSioh
  3. #define __INCincaAscSioh
  4. #include <asm/inca-ip.h>
  5. /* channel operating modes */
  6. #define ASCOPT_CSIZE 0x00000003
  7. #define ASCOPT_CS7 0x00000001
  8. #define ASCOPT_CS8 0x00000002
  9. #define ASCOPT_PARENB 0x00000004
  10. #define ASCOPT_STOPB 0x00000008
  11. #define ASCOPT_PARODD 0x00000010
  12. #define ASCOPT_CREAD 0x00000020
  13. #define ASC_OPTIONS (ASCOPT_CREAD | ASCOPT_CS8)
  14. /* ASC input select (0 or 1) */
  15. #define CONSOLE_TTY 0
  16. /* use fractional divider for baudrate settings */
  17. #define INCAASC_USE_FDV
  18. #ifdef INCAASC_USE_FDV
  19. #define INCAASC_FDV_LOW_BAUDRATE 71
  20. #define INCAASC_FDV_HIGH_BAUDRATE 453
  21. #endif /*INCAASC_USE_FDV*/
  22. #define INCAASC_TXFIFO_FL 1
  23. #define INCAASC_RXFIFO_FL 1
  24. #define INCAASC_TXFIFO_FULL 16
  25. /* interrupt lines masks for the ASC device interrupts*/
  26. /* change these macroses if it's necessary */
  27. #define INCAASC_IRQ_LINE_ALL 0x000F0000 /* all IRQs */
  28. #define INCAASC_IRQ_LINE_TIR 0x00010000 /* TIR - Tx */
  29. #define INCAASC_IRQ_LINE_RIR 0x00020000 /* RIR - Rx */
  30. #define INCAASC_IRQ_LINE_EIR 0x00040000 /* EIR - Err */
  31. #define INCAASC_IRQ_LINE_TBIR 0x00080000 /* TBIR - Tx Buf*/
  32. /* interrupt controller access macros */
  33. #define ASC_INTERRUPTS_ENABLE(X) \
  34. *((volatile unsigned int*) INCA_IP_ICU_IM2_IER) |= X;
  35. #define ASC_INTERRUPTS_DISABLE(X) \
  36. *((volatile unsigned int*) INCA_IP_ICU_IM2_IER) &= ~X;
  37. #define ASC_INTERRUPTS_CLEAR(X) \
  38. *((volatile unsigned int*) INCA_IP_ICU_IM2_ISR) = X;
  39. /* CLC register's bits and bitfields */
  40. #define ASCCLC_DISR 0x00000001
  41. #define ASCCLC_DISS 0x00000002
  42. #define ASCCLC_RMCMASK 0x0000FF00
  43. #define ASCCLC_RMCOFFSET 8
  44. /* CON register's bits and bitfields */
  45. #define ASCCON_MODEMASK 0x0007
  46. #define ASCCON_M_8SYNC 0x0
  47. #define ASCCON_M_8ASYNC 0x1
  48. #define ASCCON_M_8IRDAASYNC 0x2
  49. #define ASCCON_M_7ASYNCPAR 0x3
  50. #define ASCCON_M_9ASYNC 0x4
  51. #define ASCCON_M_8WAKEUPASYNC 0x5
  52. #define ASCCON_M_8ASYNCPAR 0x7
  53. #define ASCCON_STP 0x0008
  54. #define ASCCON_REN 0x0010
  55. #define ASCCON_PEN 0x0020
  56. #define ASCCON_FEN 0x0040
  57. #define ASCCON_OEN 0x0080
  58. #define ASCCON_PE 0x0100
  59. #define ASCCON_FE 0x0200
  60. #define ASCCON_OE 0x0400
  61. #define ASCCON_FDE 0x0800
  62. #define ASCCON_ODD 0x1000
  63. #define ASCCON_BRS 0x2000
  64. #define ASCCON_LB 0x4000
  65. #define ASCCON_R 0x8000
  66. /* WHBCON register's bits and bitfields */
  67. #define ASCWHBCON_CLRREN 0x0010
  68. #define ASCWHBCON_SETREN 0x0020
  69. #define ASCWHBCON_CLRPE 0x0100
  70. #define ASCWHBCON_CLRFE 0x0200
  71. #define ASCWHBCON_CLROE 0x0400
  72. #define ASCWHBCON_SETPE 0x0800
  73. #define ASCWHBCON_SETFE 0x1000
  74. #define ASCWHBCON_SETOE 0x2000
  75. /* ABCON register's bits and bitfields */
  76. #define ASCABCON_ABEN 0x0001
  77. #define ASCABCON_AUREN 0x0002
  78. #define ASCABCON_ABSTEN 0x0004
  79. #define ASCABCON_ABDETEN 0x0008
  80. #define ASCABCON_FCDETEN 0x0010
  81. #define ASCABCON_EMMASK 0x0300
  82. #define ASCABCON_EMOFF 8
  83. #define ASCABCON_EM_DISAB 0x0
  84. #define ASCABCON_EM_DURAB 0x1
  85. #define ASCABCON_EM_ALWAYS 0x2
  86. #define ASCABCON_TXINV 0x0400
  87. #define ASCABCON_RXINV 0x0800
  88. /* FDV register mask, offset and bitfields*/
  89. #define ASCFDV_VALUE_MASK 0x000001FF
  90. /* WHBABCON register's bits and bitfields */
  91. #define ASCWHBABCON_SETABEN 0x0001
  92. #define ASCWHBABCON_CLRABEN 0x0002
  93. /* ABSTAT register's bits and bitfields */
  94. #define ASCABSTAT_FCSDET 0x0001
  95. #define ASCABSTAT_FCCDET 0x0002
  96. #define ASCABSTAT_SCSDET 0x0004
  97. #define ASCABSTAT_SCCDET 0x0008
  98. #define ASCABSTAT_DETWAIT 0x0010
  99. /* WHBABSTAT register's bits and bitfields */
  100. #define ASCWHBABSTAT_CLRFCSDET 0x0001
  101. #define ASCWHBABSTAT_SETFCSDET 0x0002
  102. #define ASCWHBABSTAT_CLRFCCDET 0x0004
  103. #define ASCWHBABSTAT_SETFCCDET 0x0008
  104. #define ASCWHBABSTAT_CLRSCSDET 0x0010
  105. #define ASCWHBABSTAT_SETSCSDET 0x0020
  106. #define ASCWHBABSTAT_SETSCCDET 0x0040
  107. #define ASCWHBABSTAT_CLRSCCDET 0x0080
  108. #define ASCWHBABSTAT_CLRDETWAIT 0x0100
  109. #define ASCWHBABSTAT_SETDETWAIT 0x0200
  110. /* TXFCON register's bits and bitfields */
  111. #define ASCTXFCON_TXFEN 0x0001
  112. #define ASCTXFCON_TXFFLU 0x0002
  113. #define ASCTXFCON_TXTMEN 0x0004
  114. #define ASCTXFCON_TXFITLMASK 0x3F00
  115. #define ASCTXFCON_TXFITLOFF 8
  116. /* RXFCON register's bits and bitfields */
  117. #define ASCRXFCON_RXFEN 0x0001
  118. #define ASCRXFCON_RXFFLU 0x0002
  119. #define ASCRXFCON_RXTMEN 0x0004
  120. #define ASCRXFCON_RXFITLMASK 0x3F00
  121. #define ASCRXFCON_RXFITLOFF 8
  122. /* FSTAT register's bits and bitfields */
  123. #define ASCFSTAT_RXFFLMASK 0x003F
  124. #define ASCFSTAT_TXFFLMASK 0x3F00
  125. #define ASCFSTAT_TXFFLOFF 8
  126. #define INCAASC_PMU_ENABLE(BIT) *((volatile ulong*)0xBF102000) |= (0x1 << BIT);
  127. typedef struct /* incaAsc_t */
  128. {
  129. volatile unsigned long asc_clc; /*0x0000*/
  130. volatile unsigned long asc_pisel; /*0x0004*/
  131. volatile unsigned long asc_rsvd1[2]; /* for mapping */ /*0x0008*/
  132. volatile unsigned long asc_con; /*0x0010*/
  133. volatile unsigned long asc_bg; /*0x0014*/
  134. volatile unsigned long asc_fdv; /*0x0018*/
  135. volatile unsigned long asc_pmw; /* not used */ /*0x001C*/
  136. volatile unsigned long asc_tbuf; /*0x0020*/
  137. volatile unsigned long asc_rbuf; /*0x0024*/
  138. volatile unsigned long asc_rsvd2[2]; /* for mapping */ /*0x0028*/
  139. volatile unsigned long asc_abcon; /*0x0030*/
  140. volatile unsigned long asc_abstat; /* not used */ /*0x0034*/
  141. volatile unsigned long asc_rsvd3[2]; /* for mapping */ /*0x0038*/
  142. volatile unsigned long asc_rxfcon; /*0x0040*/
  143. volatile unsigned long asc_txfcon; /*0x0044*/
  144. volatile unsigned long asc_fstat; /*0x0048*/
  145. volatile unsigned long asc_rsvd4; /* for mapping */ /*0x004C*/
  146. volatile unsigned long asc_whbcon; /*0x0050*/
  147. volatile unsigned long asc_whbabcon; /*0x0054*/
  148. volatile unsigned long asc_whbabstat; /* not used */ /*0x0058*/
  149. } incaAsc_t;
  150. #endif /* __INCincaAscSioh */