smsc9420.h 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. /***************************************************************************
  2. *
  3. * Copyright (C) 2007,2008 SMSC
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License
  7. * as published by the Free Software Foundation; either version 2
  8. * of the License, or (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. *
  19. ***************************************************************************
  20. */
  21. #ifndef _SMSC9420_H
  22. #define _SMSC9420_H
  23. #define TX_RING_SIZE (32)
  24. #define RX_RING_SIZE (128)
  25. /* interrupt deassertion in multiples of 10us */
  26. #define INT_DEAS_TIME (50)
  27. #define NAPI_WEIGHT (64)
  28. #define SMSC_BAR (3)
  29. #ifdef __BIG_ENDIAN
  30. /* Register set is duplicated for BE at an offset of 0x200 */
  31. #define LAN9420_CPSR_ENDIAN_OFFSET (0x200)
  32. #else
  33. #define LAN9420_CPSR_ENDIAN_OFFSET (0)
  34. #endif
  35. #define PCI_VENDOR_ID_9420 (0x1055)
  36. #define PCI_DEVICE_ID_9420 (0xE420)
  37. #define LAN_REGISTER_EXTENT (0x400)
  38. #define SMSC9420_EEPROM_SIZE ((u32)11)
  39. #define SMSC9420_EEPROM_MAGIC (0x9420)
  40. #define PKT_BUF_SZ (VLAN_ETH_FRAME_LEN + NET_IP_ALIGN + 4)
  41. /***********************************************/
  42. /* DMA Controller Control and Status Registers */
  43. /***********************************************/
  44. #define BUS_MODE (0x00)
  45. #define BUS_MODE_SWR_ (BIT(0))
  46. #define BUS_MODE_DMA_BURST_LENGTH_1 (BIT(8))
  47. #define BUS_MODE_DMA_BURST_LENGTH_2 (BIT(9))
  48. #define BUS_MODE_DMA_BURST_LENGTH_4 (BIT(10))
  49. #define BUS_MODE_DMA_BURST_LENGTH_8 (BIT(11))
  50. #define BUS_MODE_DMA_BURST_LENGTH_16 (BIT(12))
  51. #define BUS_MODE_DMA_BURST_LENGTH_32 (BIT(13))
  52. #define BUS_MODE_DBO_ (BIT(20))
  53. #define TX_POLL_DEMAND (0x04)
  54. #define RX_POLL_DEMAND (0x08)
  55. #define RX_BASE_ADDR (0x0C)
  56. #define TX_BASE_ADDR (0x10)
  57. #define DMAC_STATUS (0x14)
  58. #define DMAC_STS_TS_ (7 << 20)
  59. #define DMAC_STS_RS_ (7 << 17)
  60. #define DMAC_STS_NIS_ (BIT(16))
  61. #define DMAC_STS_AIS_ (BIT(15))
  62. #define DMAC_STS_RWT_ (BIT(9))
  63. #define DMAC_STS_RXPS_ (BIT(8))
  64. #define DMAC_STS_RXBU_ (BIT(7))
  65. #define DMAC_STS_RX_ (BIT(6))
  66. #define DMAC_STS_TXUNF_ (BIT(5))
  67. #define DMAC_STS_TXBU_ (BIT(2))
  68. #define DMAC_STS_TXPS_ (BIT(1))
  69. #define DMAC_STS_TX_ (BIT(0))
  70. #define DMAC_CONTROL (0x18)
  71. #define DMAC_CONTROL_TTM_ (BIT(22))
  72. #define DMAC_CONTROL_SF_ (BIT(21))
  73. #define DMAC_CONTROL_ST_ (BIT(13))
  74. #define DMAC_CONTROL_OSF_ (BIT(2))
  75. #define DMAC_CONTROL_SR_ (BIT(1))
  76. #define DMAC_INTR_ENA (0x1C)
  77. #define DMAC_INTR_ENA_NIS_ (BIT(16))
  78. #define DMAC_INTR_ENA_AIS_ (BIT(15))
  79. #define DMAC_INTR_ENA_RWT_ (BIT(9))
  80. #define DMAC_INTR_ENA_RXPS_ (BIT(8))
  81. #define DMAC_INTR_ENA_RXBU_ (BIT(7))
  82. #define DMAC_INTR_ENA_RX_ (BIT(6))
  83. #define DMAC_INTR_ENA_TXBU_ (BIT(2))
  84. #define DMAC_INTR_ENA_TXPS_ (BIT(1))
  85. #define DMAC_INTR_ENA_TX_ (BIT(0))
  86. #define MISS_FRAME_CNTR (0x20)
  87. #define TX_BUFF_ADDR (0x50)
  88. #define RX_BUFF_ADDR (0x54)
  89. /* Transmit Descriptor Bit Defs */
  90. #define TDES0_OWN_ (0x80000000)
  91. #define TDES0_ERROR_SUMMARY_ (0x00008000)
  92. #define TDES0_LOSS_OF_CARRIER_ (0x00000800)
  93. #define TDES0_NO_CARRIER_ (0x00000400)
  94. #define TDES0_LATE_COLLISION_ (0x00000200)
  95. #define TDES0_EXCESSIVE_COLLISIONS_ (0x00000100)
  96. #define TDES0_HEARTBEAT_FAIL_ (0x00000080)
  97. #define TDES0_COLLISION_COUNT_MASK_ (0x00000078)
  98. #define TDES0_COLLISION_COUNT_SHFT_ (3)
  99. #define TDES0_EXCESSIVE_DEFERRAL_ (0x00000004)
  100. #define TDES0_DEFERRED_ (0x00000001)
  101. #define TDES1_IC_ 0x80000000
  102. #define TDES1_LS_ 0x40000000
  103. #define TDES1_FS_ 0x20000000
  104. #define TDES1_TXCSEN_ 0x08000000
  105. #define TDES1_TER_ (BIT(25))
  106. #define TDES1_TCH_ 0x01000000
  107. /* Receive Descriptor 0 Bit Defs */
  108. #define RDES0_OWN_ (0x80000000)
  109. #define RDES0_FRAME_LENGTH_MASK_ (0x07FF0000)
  110. #define RDES0_FRAME_LENGTH_SHFT_ (16)
  111. #define RDES0_ERROR_SUMMARY_ (0x00008000)
  112. #define RDES0_DESCRIPTOR_ERROR_ (0x00004000)
  113. #define RDES0_LENGTH_ERROR_ (0x00001000)
  114. #define RDES0_RUNT_FRAME_ (0x00000800)
  115. #define RDES0_MULTICAST_FRAME_ (0x00000400)
  116. #define RDES0_FIRST_DESCRIPTOR_ (0x00000200)
  117. #define RDES0_LAST_DESCRIPTOR_ (0x00000100)
  118. #define RDES0_FRAME_TOO_LONG_ (0x00000080)
  119. #define RDES0_COLLISION_SEEN_ (0x00000040)
  120. #define RDES0_FRAME_TYPE_ (0x00000020)
  121. #define RDES0_WATCHDOG_TIMEOUT_ (0x00000010)
  122. #define RDES0_MII_ERROR_ (0x00000008)
  123. #define RDES0_DRIBBLING_BIT_ (0x00000004)
  124. #define RDES0_CRC_ERROR_ (0x00000002)
  125. /* Receive Descriptor 1 Bit Defs */
  126. #define RDES1_RER_ (0x02000000)
  127. /***********************************************/
  128. /* MAC Control and Status Registers */
  129. /***********************************************/
  130. #define MAC_CR (0x80)
  131. #define MAC_CR_RXALL_ (0x80000000)
  132. #define MAC_CR_DIS_RXOWN_ (0x00800000)
  133. #define MAC_CR_LOOPBK_ (0x00200000)
  134. #define MAC_CR_FDPX_ (0x00100000)
  135. #define MAC_CR_MCPAS_ (0x00080000)
  136. #define MAC_CR_PRMS_ (0x00040000)
  137. #define MAC_CR_INVFILT_ (0x00020000)
  138. #define MAC_CR_PASSBAD_ (0x00010000)
  139. #define MAC_CR_HFILT_ (0x00008000)
  140. #define MAC_CR_HPFILT_ (0x00002000)
  141. #define MAC_CR_LCOLL_ (0x00001000)
  142. #define MAC_CR_DIS_BCAST_ (0x00000800)
  143. #define MAC_CR_DIS_RTRY_ (0x00000400)
  144. #define MAC_CR_PADSTR_ (0x00000100)
  145. #define MAC_CR_BOLMT_MSK (0x000000C0)
  146. #define MAC_CR_MFCHK_ (0x00000020)
  147. #define MAC_CR_TXEN_ (0x00000008)
  148. #define MAC_CR_RXEN_ (0x00000004)
  149. #define ADDRH (0x84)
  150. #define ADDRL (0x88)
  151. #define HASHH (0x8C)
  152. #define HASHL (0x90)
  153. #define MII_ACCESS (0x94)
  154. #define MII_ACCESS_MII_BUSY_ (0x00000001)
  155. #define MII_ACCESS_MII_WRITE_ (0x00000002)
  156. #define MII_ACCESS_MII_READ_ (0x00000000)
  157. #define MII_ACCESS_INDX_MSK_ (0x000007C0)
  158. #define MII_ACCESS_PHYADDR_MSK_ (0x0000F8C0)
  159. #define MII_ACCESS_INDX_SHFT_CNT (6)
  160. #define MII_ACCESS_PHYADDR_SHFT_CNT (11)
  161. #define MII_DATA (0x98)
  162. #define FLOW (0x9C)
  163. #define VLAN1 (0xA0)
  164. #define VLAN2 (0xA4)
  165. #define WUFF (0xA8)
  166. #define WUCSR (0xAC)
  167. #define COE_CR (0xB0)
  168. #define TX_COE_EN (0x00010000)
  169. #define RX_COE_MODE (0x00000002)
  170. #define RX_COE_EN (0x00000001)
  171. /***********************************************/
  172. /* System Control and Status Registers */
  173. /***********************************************/
  174. #define ID_REV (0xC0)
  175. #define INT_CTL (0xC4)
  176. #define INT_CTL_SW_INT_EN_ (0x00008000)
  177. #define INT_CTL_SBERR_INT_EN_ (1 << 12)
  178. #define INT_CTL_MBERR_INT_EN_ (1 << 13)
  179. #define INT_CTL_GPT_INT_EN_ (0x00000008)
  180. #define INT_CTL_PHY_INT_EN_ (0x00000004)
  181. #define INT_CTL_WAKE_INT_EN_ (0x00000002)
  182. #define INT_STAT (0xC8)
  183. #define INT_STAT_SW_INT_ (1 << 15)
  184. #define INT_STAT_MBERR_INT_ (1 << 13)
  185. #define INT_STAT_SBERR_INT_ (1 << 12)
  186. #define INT_STAT_GPT_INT_ (1 << 3)
  187. #define INT_STAT_PHY_INT_ (0x00000004)
  188. #define INT_STAT_WAKE_INT_ (0x00000002)
  189. #define INT_STAT_DMAC_INT_ (0x00000001)
  190. #define INT_CFG (0xCC)
  191. #define INT_CFG_IRQ_INT_ (0x00080000)
  192. #define INT_CFG_IRQ_EN_ (0x00040000)
  193. #define INT_CFG_INT_DEAS_CLR_ (0x00000200)
  194. #define INT_CFG_INT_DEAS_MASK (0x000000FF)
  195. #define GPIO_CFG (0xD0)
  196. #define GPIO_CFG_LED_3_ (0x40000000)
  197. #define GPIO_CFG_LED_2_ (0x20000000)
  198. #define GPIO_CFG_LED_1_ (0x10000000)
  199. #define GPIO_CFG_EEPR_EN_ (0x00700000)
  200. #define GPT_CFG (0xD4)
  201. #define GPT_CFG_TIMER_EN_ (0x20000000)
  202. #define GPT_CNT (0xD8)
  203. #define BUS_CFG (0xDC)
  204. #define BUS_CFG_RXTXWEIGHT_1_1 (0 << 25)
  205. #define BUS_CFG_RXTXWEIGHT_2_1 (1 << 25)
  206. #define BUS_CFG_RXTXWEIGHT_3_1 (2 << 25)
  207. #define BUS_CFG_RXTXWEIGHT_4_1 (3 << 25)
  208. #define PMT_CTRL (0xE0)
  209. #define FREE_RUN (0xF4)
  210. #define E2P_CMD (0xF8)
  211. #define E2P_CMD_EPC_BUSY_ (0x80000000)
  212. #define E2P_CMD_EPC_CMD_ (0x70000000)
  213. #define E2P_CMD_EPC_CMD_READ_ (0x00000000)
  214. #define E2P_CMD_EPC_CMD_EWDS_ (0x10000000)
  215. #define E2P_CMD_EPC_CMD_EWEN_ (0x20000000)
  216. #define E2P_CMD_EPC_CMD_WRITE_ (0x30000000)
  217. #define E2P_CMD_EPC_CMD_WRAL_ (0x40000000)
  218. #define E2P_CMD_EPC_CMD_ERASE_ (0x50000000)
  219. #define E2P_CMD_EPC_CMD_ERAL_ (0x60000000)
  220. #define E2P_CMD_EPC_CMD_RELOAD_ (0x70000000)
  221. #define E2P_CMD_EPC_TIMEOUT_ (0x00000200)
  222. #define E2P_CMD_MAC_ADDR_LOADED_ (0x00000100)
  223. #define E2P_CMD_EPC_ADDR_ (0x000000FF)
  224. #define E2P_DATA (0xFC)
  225. #define E2P_DATA_EEPROM_DATA_ (0x000000FF)
  226. #endif /* _SMSC9420_H */