fsl_mcdmafec.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. /*
  2. * fsl_mcdmafec.h -- Multi-channel DMA Fast Ethernet Controller definitions
  3. *
  4. * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
  5. * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
  6. *
  7. * See file CREDITS for list of people who contributed to this
  8. * project.
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License as
  12. * published by the Free Software Foundation; either version 2 of
  13. * the License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  23. * MA 02111-1307 USA
  24. */
  25. #ifndef fsl_mcdmafec_h
  26. #define fsl_mcdmafec_h
  27. /* Re-use of the definitions */
  28. #include <asm/fec.h>
  29. typedef struct fecdma {
  30. u32 rsvd0; /* 0x000 */
  31. u32 eir; /* 0x004 */
  32. u32 eimr; /* 0x008 */
  33. u32 rsvd1[6]; /* 0x00C - 0x023 */
  34. u32 ecr; /* 0x024 */
  35. u32 rsvd2[6]; /* 0x028 - 0x03F */
  36. u32 mmfr; /* 0x040 */
  37. u32 mscr; /* 0x044 */
  38. u32 rsvd3[7]; /* 0x048 - 0x063 */
  39. u32 mibc; /* 0x064 */
  40. u32 rsvd4[7]; /* 0x068 - 0x083 */
  41. u32 rcr; /* 0x084 */
  42. u32 rhr; /* 0x088 */
  43. u32 rsvd5[14]; /* 0x08C - 0x0C3 */
  44. u32 tcr; /* 0x0C4 */
  45. u32 rsvd6[7]; /* 0x0C8 - 0x0E3 */
  46. u32 palr; /* 0x0E4 */
  47. u32 paur; /* 0x0E8 */
  48. u32 opd; /* 0x0EC */
  49. u32 rsvd7[10]; /* 0x0F0 - 0x117 */
  50. u32 iaur; /* 0x118 */
  51. u32 ialr; /* 0x11C */
  52. u32 gaur; /* 0x120 */
  53. u32 galr; /* 0x124 */
  54. u32 rsvd8[7]; /* 0x128 - 0x143 */
  55. u32 tfwr; /* 0x144 */
  56. u32 rsvd9[14]; /* 0x148 - 0x17F */
  57. u32 fmc; /* 0x180 */
  58. u32 rfdr; /* 0x184 */
  59. u32 rfsr; /* 0x188 */
  60. u32 rfcr; /* 0x18C */
  61. u32 rlrfp; /* 0x190 */
  62. u32 rlwfp; /* 0x194 */
  63. u32 rfar; /* 0x198 */
  64. u32 rfrp; /* 0x19C */
  65. u32 rfwp; /* 0x1A0 */
  66. u32 tfdr; /* 0x1A4 */
  67. u32 tfsr; /* 0x1A8 */
  68. u32 tfcr; /* 0x1AC */
  69. u32 tlrfp; /* 0x1B0 */
  70. u32 tlwfp; /* 0x1B4 */
  71. u32 tfar; /* 0x1B8 */
  72. u32 tfrp; /* 0x1BC */
  73. u32 tfwp; /* 0x1C0 */
  74. u32 frst; /* 0x1C4 */
  75. u32 ctcwr; /* 0x1C8 */
  76. } fecdma_t;
  77. struct fec_info_dma {
  78. int index;
  79. u32 iobase;
  80. u32 pinmux;
  81. u32 miibase;
  82. int phy_addr;
  83. int dup_spd;
  84. char *phy_name;
  85. int phyname_init;
  86. cbd_t *rxbd; /* Rx BD */
  87. cbd_t *txbd; /* Tx BD */
  88. uint rxIdx;
  89. uint txIdx;
  90. char *txbuf;
  91. int initialized;
  92. struct fec_info_dma *next;
  93. u16 rxTask; /* DMA receive Task Number */
  94. u16 txTask; /* DMA Transmit Task Number */
  95. u16 rxPri; /* DMA Receive Priority */
  96. u16 txPri; /* DMA Transmit Priority */
  97. u16 rxInit; /* DMA Receive Initiator */
  98. u16 txInit; /* DMA Transmit Initiator */
  99. u16 usedTbdIdx; /* next transmit BD to clean */
  100. u16 cleanTbdNum; /* the number of available transmit BDs */
  101. };
  102. /* Bit definitions and macros for IEVENT */
  103. #define FEC_EIR_TXERR (0x00040000)
  104. #define FEC_EIR_RXERR (0x00020000)
  105. #undef FEC_EIR_CLEAR_ALL
  106. #define FEC_EIR_CLEAR_ALL (0xFFFE0000)
  107. /* Bit definitions and macros for R_HASH */
  108. #define FEC_RHASH_FCE_DC (0x80000000)
  109. #define FEC_RHASH_MULTCAST (0x40000000)
  110. #define FEC_RHASH_HASH(x) (((x)&0x0000003F)<<24)
  111. /* Bit definitions and macros for FEC_TFWR */
  112. #undef FEC_TFWR_X_WMRK
  113. #undef FEC_TFWR_X_WMRK_64
  114. #undef FEC_TFWR_X_WMRK_128
  115. #undef FEC_TFWR_X_WMRK_192
  116. #define FEC_TFWR_X_WMRK(x) ((x)&0x0F)
  117. #define FEC_TFWR_X_WMRK_64 (0x00)
  118. #define FEC_TFWR_X_WMRK_128 (0x01)
  119. #define FEC_TFWR_X_WMRK_192 (0x02)
  120. #define FEC_TFWR_X_WMRK_256 (0x03)
  121. #define FEC_TFWR_X_WMRK_320 (0x04)
  122. #define FEC_TFWR_X_WMRK_384 (0x05)
  123. #define FEC_TFWR_X_WMRK_448 (0x06)
  124. #define FEC_TFWR_X_WMRK_512 (0x07)
  125. #define FEC_TFWR_X_WMRK_576 (0x08)
  126. #define FEC_TFWR_X_WMRK_640 (0x09)
  127. #define FEC_TFWR_X_WMRK_704 (0x0A)
  128. #define FEC_TFWR_X_WMRK_768 (0x0B)
  129. #define FEC_TFWR_X_WMRK_832 (0x0C)
  130. #define FEC_TFWR_X_WMRK_896 (0x0D)
  131. #define FEC_TFWR_X_WMRK_960 (0x0E)
  132. #define FEC_TFWR_X_WMRK_1024 (0x0F)
  133. /* FIFO definitions */
  134. /* Bit definitions and macros for FSTAT */
  135. #define FIFO_STAT_IP (0x80000000)
  136. #define FIFO_STAT_FRAME(x) (((x)&0x0000000F)<<24)
  137. #define FIFO_STAT_FAE (0x00800000)
  138. #define FIFO_STAT_RXW (0x00400000)
  139. #define FIFO_STAT_UF (0x00200000)
  140. #define FIFO_STAT_OF (0x00100000)
  141. #define FIFO_STAT_FR (0x00080000)
  142. #define FIFO_STAT_FULL (0x00040000)
  143. #define FIFO_STAT_ALARM (0x00020000)
  144. #define FIFO_STAT_EMPTY (0x00010000)
  145. /* Bit definitions and macros for FCTRL */
  146. #define FIFO_CTRL_WCTL (0x40000000)
  147. #define FIFO_CTRL_WFR (0x20000000)
  148. #define FIFO_CTRL_FRAME (0x08000000)
  149. #define FIFO_CTRL_GR(x) (((x)&0x00000007)<<24)
  150. #define FIFO_CTRL_IPMASK (0x00800000)
  151. #define FIFO_CTRL_FAEMASK (0x00400000)
  152. #define FIFO_CTRL_RXWMASK (0x00200000)
  153. #define FIFO_CTRL_UFMASK (0x00100000)
  154. #define FIFO_CTRL_OFMASK (0x00080000)
  155. #endif /* fsl_mcdmafec_h */