ftmac100.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /*
  2. * Faraday FTMAC100 Ethernet
  3. *
  4. * (C) Copyright 2009 Faraday Technology
  5. * Po-Yu Chuang <ratbert@faraday-tech.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. */
  21. #ifndef __FTMAC100_H
  22. #define __FTMAC100_H
  23. struct ftmac100 {
  24. unsigned int isr; /* 0x00 */
  25. unsigned int imr; /* 0x04 */
  26. unsigned int mac_madr; /* 0x08 */
  27. unsigned int mac_ladr; /* 0x0c */
  28. unsigned int maht0; /* 0x10 */
  29. unsigned int maht1; /* 0x14 */
  30. unsigned int txpd; /* 0x18 */
  31. unsigned int rxpd; /* 0x1c */
  32. unsigned int txr_badr; /* 0x20 */
  33. unsigned int rxr_badr; /* 0x24 */
  34. unsigned int itc; /* 0x28 */
  35. unsigned int aptc; /* 0x2c */
  36. unsigned int dblac; /* 0x30 */
  37. unsigned int pad1[3]; /* 0x34 - 0x3c */
  38. unsigned int pad2[16]; /* 0x40 - 0x7c */
  39. unsigned int pad3[2]; /* 0x80 - 0x84 */
  40. unsigned int maccr; /* 0x88 */
  41. unsigned int macsr; /* 0x8c */
  42. unsigned int phycr; /* 0x90 */
  43. unsigned int phywdata; /* 0x94 */
  44. unsigned int fcr; /* 0x98 */
  45. unsigned int bpr; /* 0x9c */
  46. unsigned int pad4[8]; /* 0xa0 - 0xbc */
  47. unsigned int pad5; /* 0xc0 */
  48. unsigned int ts; /* 0xc4 */
  49. unsigned int dmafifos; /* 0xc8 */
  50. unsigned int tm; /* 0xcc */
  51. unsigned int pad6; /* 0xd0 */
  52. unsigned int tx_mcol_scol; /* 0xd4 */
  53. unsigned int rpf_aep; /* 0xd8 */
  54. unsigned int xm_pg; /* 0xdc */
  55. unsigned int runt_tlcc; /* 0xe0 */
  56. unsigned int crcer_ftl; /* 0xe4 */
  57. unsigned int rlc_rcc; /* 0xe8 */
  58. unsigned int broc; /* 0xec */
  59. unsigned int mulca; /* 0xf0 */
  60. unsigned int rp; /* 0xf4 */
  61. unsigned int xp; /* 0xf8 */
  62. };
  63. /*
  64. * Interrupt status register & interrupt mask register
  65. */
  66. #define FTMAC100_INT_RPKT_FINISH (1 << 0)
  67. #define FTMAC100_INT_NORXBUF (1 << 1)
  68. #define FTMAC100_INT_XPKT_FINISH (1 << 2)
  69. #define FTMAC100_INT_NOTXBUF (1 << 3)
  70. #define FTMAC100_INT_XPKT_OK (1 << 4)
  71. #define FTMAC100_INT_XPKT_LOST (1 << 5)
  72. #define FTMAC100_INT_RPKT_SAV (1 << 6)
  73. #define FTMAC100_INT_RPKT_LOST (1 << 7)
  74. #define FTMAC100_INT_AHB_ERR (1 << 8)
  75. #define FTMAC100_INT_PHYSTS_CHG (1 << 9)
  76. /*
  77. * Automatic polling timer control register
  78. */
  79. #define FTMAC100_APTC_RXPOLL_CNT(x) (((x) & 0xf) << 0)
  80. #define FTMAC100_APTC_RXPOLL_TIME_SEL (1 << 4)
  81. #define FTMAC100_APTC_TXPOLL_CNT(x) (((x) & 0xf) << 8)
  82. #define FTMAC100_APTC_TXPOLL_TIME_SEL (1 << 12)
  83. /*
  84. * MAC control register
  85. */
  86. #define FTMAC100_MACCR_XDMA_EN (1 << 0)
  87. #define FTMAC100_MACCR_RDMA_EN (1 << 1)
  88. #define FTMAC100_MACCR_SW_RST (1 << 2)
  89. #define FTMAC100_MACCR_LOOP_EN (1 << 3)
  90. #define FTMAC100_MACCR_CRC_DIS (1 << 4)
  91. #define FTMAC100_MACCR_XMT_EN (1 << 5)
  92. #define FTMAC100_MACCR_ENRX_IN_HALFTX (1 << 6)
  93. #define FTMAC100_MACCR_RCV_EN (1 << 8)
  94. #define FTMAC100_MACCR_HT_MULTI_EN (1 << 9)
  95. #define FTMAC100_MACCR_RX_RUNT (1 << 10)
  96. #define FTMAC100_MACCR_RX_FTL (1 << 11)
  97. #define FTMAC100_MACCR_RCV_ALL (1 << 12)
  98. #define FTMAC100_MACCR_CRC_APD (1 << 14)
  99. #define FTMAC100_MACCR_FULLDUP (1 << 15)
  100. #define FTMAC100_MACCR_RX_MULTIPKT (1 << 16)
  101. #define FTMAC100_MACCR_RX_BROADPKT (1 << 17)
  102. /*
  103. * Transmit descriptor, aligned to 16 bytes
  104. */
  105. struct ftmac100_txdes {
  106. unsigned int txdes0;
  107. unsigned int txdes1;
  108. unsigned int txdes2; /* TXBUF_BADR */
  109. unsigned int txdes3; /* not used by HW */
  110. } __attribute__ ((aligned(16)));
  111. #define FTMAC100_TXDES0_TXPKT_LATECOL (1 << 0)
  112. #define FTMAC100_TXDES0_TXPKT_EXSCOL (1 << 1)
  113. #define FTMAC100_TXDES0_TXDMA_OWN (1 << 31)
  114. #define FTMAC100_TXDES1_TXBUF_SIZE(x) ((x) & 0x7ff)
  115. #define FTMAC100_TXDES1_LTS (1 << 27)
  116. #define FTMAC100_TXDES1_FTS (1 << 28)
  117. #define FTMAC100_TXDES1_TX2FIC (1 << 29)
  118. #define FTMAC100_TXDES1_TXIC (1 << 30)
  119. #define FTMAC100_TXDES1_EDOTR (1 << 31)
  120. /*
  121. * Receive descriptor, aligned to 16 bytes
  122. */
  123. struct ftmac100_rxdes {
  124. unsigned int rxdes0;
  125. unsigned int rxdes1;
  126. unsigned int rxdes2; /* RXBUF_BADR */
  127. unsigned int rxdes3; /* not used by HW */
  128. } __attribute__ ((aligned(16)));
  129. #define FTMAC100_RXDES0_RFL(des) ((des) & 0x7ff)
  130. #define FTMAC100_RXDES0_MULTICAST (1 << 16)
  131. #define FTMAC100_RXDES0_BROADCAST (1 << 17)
  132. #define FTMAC100_RXDES0_RX_ERR (1 << 18)
  133. #define FTMAC100_RXDES0_CRC_ERR (1 << 19)
  134. #define FTMAC100_RXDES0_FTL (1 << 20)
  135. #define FTMAC100_RXDES0_RUNT (1 << 21)
  136. #define FTMAC100_RXDES0_RX_ODD_NB (1 << 22)
  137. #define FTMAC100_RXDES0_LRS (1 << 28)
  138. #define FTMAC100_RXDES0_FRS (1 << 29)
  139. #define FTMAC100_RXDES0_RXDMA_OWN (1 << 31)
  140. #define FTMAC100_RXDES1_RXBUF_SIZE(x) ((x) & 0x7ff)
  141. #define FTMAC100_RXDES1_EDORR (1 << 31)
  142. #endif /* __FTMAC100_H */