ax88796c_main.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2010 ASIX Electronics Corporation
  4. * Copyright (c) 2020 Samsung Electronics
  5. *
  6. * ASIX AX88796C SPI Fast Ethernet Linux driver
  7. */
  8. #ifndef _AX88796C_MAIN_H
  9. #define _AX88796C_MAIN_H
  10. #include <linux/netdevice.h>
  11. #include <linux/mii.h>
  12. #include "ax88796c_spi.h"
  13. /* These identify the driver base version and may not be removed. */
  14. #define DRV_NAME "ax88796c"
  15. #define ADP_NAME "ASIX AX88796C SPI Ethernet Adapter"
  16. #define TX_QUEUE_HIGH_WATER 45 /* Tx queue high water mark */
  17. #define TX_QUEUE_LOW_WATER 20 /* Tx queue low water mark */
  18. #define AX88796C_REGDUMP_LEN 256
  19. #define AX88796C_PHY_REGDUMP_LEN 14
  20. #define AX88796C_PHY_ID 0x10
  21. #define TX_OVERHEAD 8
  22. #define TX_EOP_SIZE 4
  23. #define AX_MCAST_FILTER_SIZE 8
  24. #define AX_MAX_MCAST 64
  25. #define AX_MAX_CLK 80000000
  26. #define TX_HDR_SOP_DICF 0x8000
  27. #define TX_HDR_SOP_CPHI 0x4000
  28. #define TX_HDR_SOP_INT 0x2000
  29. #define TX_HDR_SOP_MDEQ 0x1000
  30. #define TX_HDR_SOP_PKTLEN 0x07FF
  31. #define TX_HDR_SOP_SEQNUM 0xF800
  32. #define TX_HDR_SOP_PKTLENBAR 0x07FF
  33. #define TX_HDR_SEG_FS 0x8000
  34. #define TX_HDR_SEG_LS 0x4000
  35. #define TX_HDR_SEG_SEGNUM 0x3800
  36. #define TX_HDR_SEG_SEGLEN 0x0700
  37. #define TX_HDR_SEG_EOFST 0xC000
  38. #define TX_HDR_SEG_SOFST 0x3800
  39. #define TX_HDR_SEG_SEGLENBAR 0x07FF
  40. #define TX_HDR_EOP_SEQNUM 0xF800
  41. #define TX_HDR_EOP_PKTLEN 0x07FF
  42. #define TX_HDR_EOP_SEQNUMBAR 0xF800
  43. #define TX_HDR_EOP_PKTLENBAR 0x07FF
  44. /* Rx header fields mask */
  45. #define RX_HDR1_MCBC 0x8000
  46. #define RX_HDR1_STUFF_PKT 0x4000
  47. #define RX_HDR1_MII_ERR 0x2000
  48. #define RX_HDR1_CRC_ERR 0x1000
  49. #define RX_HDR1_PKT_LEN 0x07FF
  50. #define RX_HDR2_SEQ_NUM 0xF800
  51. #define RX_HDR2_PKT_LEN_BAR 0x7FFF
  52. #define RX_HDR3_PE 0x8000
  53. #define RX_HDR3_L3_TYPE_IPV4V6 0x6000
  54. #define RX_HDR3_L3_TYPE_IP 0x4000
  55. #define RX_HDR3_L3_TYPE_IPV6 0x2000
  56. #define RX_HDR3_L4_TYPE_ICMPV6 0x1400
  57. #define RX_HDR3_L4_TYPE_TCP 0x1000
  58. #define RX_HDR3_L4_TYPE_IGMP 0x0c00
  59. #define RX_HDR3_L4_TYPE_ICMP 0x0800
  60. #define RX_HDR3_L4_TYPE_UDP 0x0400
  61. #define RX_HDR3_L3_ERR 0x0200
  62. #define RX_HDR3_L4_ERR 0x0100
  63. #define RX_HDR3_PRIORITY(x) ((x) << 4)
  64. #define RX_HDR3_STRIP 0x0008
  65. #define RX_HDR3_VLAN_ID 0x0007
  66. struct ax88796c_pcpu_stats {
  67. u64_stats_t rx_packets;
  68. u64_stats_t rx_bytes;
  69. u64_stats_t tx_packets;
  70. u64_stats_t tx_bytes;
  71. struct u64_stats_sync syncp;
  72. u32 rx_dropped;
  73. u32 tx_dropped;
  74. u32 rx_frame_errors;
  75. u32 rx_crc_errors;
  76. };
  77. struct ax88796c_device {
  78. struct spi_device *spi;
  79. struct net_device *ndev;
  80. struct ax88796c_pcpu_stats __percpu *stats;
  81. struct work_struct ax_work;
  82. struct mutex spi_lock; /* device access */
  83. struct sk_buff_head tx_wait_q;
  84. struct axspi_data ax_spi;
  85. struct mii_bus *mdiobus;
  86. struct phy_device *phydev;
  87. int msg_enable;
  88. u16 seq_num;
  89. u8 multi_filter[AX_MCAST_FILTER_SIZE];
  90. int link;
  91. int speed;
  92. int duplex;
  93. int pause;
  94. int asym_pause;
  95. int flowctrl;
  96. #define AX_FC_NONE 0
  97. #define AX_FC_RX BIT(0)
  98. #define AX_FC_TX BIT(1)
  99. #define AX_FC_ANEG BIT(2)
  100. u32 priv_flags;
  101. #define AX_CAP_COMP BIT(0)
  102. #define AX_PRIV_FLAGS_MASK (AX_CAP_COMP)
  103. unsigned long flags;
  104. #define EVENT_INTR 0
  105. #define EVENT_TX 1
  106. #define EVENT_SET_MULTI 2
  107. };
  108. #define to_ax88796c_device(ndev) ((struct ax88796c_device *)netdev_priv(ndev))
  109. enum skb_state {
  110. illegal = 0,
  111. tx_done,
  112. rx_done,
  113. rx_err,
  114. };
  115. struct skb_data {
  116. enum skb_state state;
  117. size_t len;
  118. };
  119. /* A88796C register definition */
  120. /* Definition of PAGE0 */
  121. #define P0_PSR (0x00)
  122. #define PSR_DEV_READY BIT(7)
  123. #define PSR_RESET (0 << 15)
  124. #define PSR_RESET_CLR BIT(15)
  125. #define P0_BOR (0x02)
  126. #define P0_FER (0x04)
  127. #define FER_IPALM BIT(0)
  128. #define FER_DCRC BIT(1)
  129. #define FER_RH3M BIT(2)
  130. #define FER_HEADERSWAP BIT(7)
  131. #define FER_WSWAP BIT(8)
  132. #define FER_BSWAP BIT(9)
  133. #define FER_INTHI BIT(10)
  134. #define FER_INTLO (0 << 10)
  135. #define FER_IRQ_PULL BIT(11)
  136. #define FER_RXEN BIT(14)
  137. #define FER_TXEN BIT(15)
  138. #define P0_ISR (0x06)
  139. #define ISR_RXPKT BIT(0)
  140. #define ISR_MDQ BIT(4)
  141. #define ISR_TXT BIT(5)
  142. #define ISR_TXPAGES BIT(6)
  143. #define ISR_TXERR BIT(8)
  144. #define ISR_LINK BIT(9)
  145. #define P0_IMR (0x08)
  146. #define IMR_RXPKT BIT(0)
  147. #define IMR_MDQ BIT(4)
  148. #define IMR_TXT BIT(5)
  149. #define IMR_TXPAGES BIT(6)
  150. #define IMR_TXERR BIT(8)
  151. #define IMR_LINK BIT(9)
  152. #define IMR_MASKALL (0xFFFF)
  153. #define IMR_DEFAULT (IMR_TXERR)
  154. #define P0_WFCR (0x0A)
  155. #define WFCR_PMEIND BIT(0) /* PME indication */
  156. #define WFCR_PMETYPE BIT(1) /* PME I/O type */
  157. #define WFCR_PMEPOL BIT(2) /* PME polarity */
  158. #define WFCR_PMERST BIT(3) /* Reset PME */
  159. #define WFCR_SLEEP BIT(4) /* Enable sleep mode */
  160. #define WFCR_WAKEUP BIT(5) /* Enable wakeup mode */
  161. #define WFCR_WAITEVENT BIT(6) /* Reserved */
  162. #define WFCR_CLRWAKE BIT(7) /* Clear wakeup */
  163. #define WFCR_LINKCH BIT(8) /* Enable link change */
  164. #define WFCR_MAGICP BIT(9) /* Enable magic packet */
  165. #define WFCR_WAKEF BIT(10) /* Enable wakeup frame */
  166. #define WFCR_PMEEN BIT(11) /* Enable PME pin */
  167. #define WFCR_LINKCHS BIT(12) /* Link change status */
  168. #define WFCR_MAGICPS BIT(13) /* Magic packet status */
  169. #define WFCR_WAKEFS BIT(14) /* Wakeup frame status */
  170. #define WFCR_PMES BIT(15) /* PME pin status */
  171. #define P0_PSCR (0x0C)
  172. #define PSCR_PS_MASK (0xFFF0)
  173. #define PSCR_PS_D0 (0)
  174. #define PSCR_PS_D1 BIT(0)
  175. #define PSCR_PS_D2 BIT(1)
  176. #define PSCR_FPS BIT(3) /* Enable fiber mode PS */
  177. #define PSCR_SWPS BIT(4) /* Enable software */
  178. /* PS control */
  179. #define PSCR_WOLPS BIT(5) /* Enable WOL PS */
  180. #define PSCR_SWWOL BIT(6) /* Enable software select */
  181. /* WOL PS */
  182. #define PSCR_PHYOSC BIT(7) /* Internal PHY OSC control */
  183. #define PSCR_FOFEF BIT(8) /* Force PHY generate FEF */
  184. #define PSCR_FOF BIT(9) /* Force PHY in fiber mode */
  185. #define PSCR_PHYPD BIT(10) /* PHY power down. */
  186. /* Active high */
  187. #define PSCR_PHYRST BIT(11) /* PHY reset signal. */
  188. /* Active low */
  189. #define PSCR_PHYCSIL BIT(12) /* PHY cable energy detect */
  190. #define PSCR_PHYCOFF BIT(13) /* PHY cable off */
  191. #define PSCR_PHYLINK BIT(14) /* PHY link status */
  192. #define PSCR_EEPOK BIT(15) /* EEPROM load complete */
  193. #define P0_MACCR (0x0E)
  194. #define MACCR_RXEN BIT(0) /* Enable RX */
  195. #define MACCR_DUPLEX_FULL BIT(1) /* 1: Full, 0: Half */
  196. #define MACCR_SPEED_100 BIT(2) /* 1: 100Mbps, 0: 10Mbps */
  197. #define MACCR_RXFC_ENABLE BIT(3)
  198. #define MACCR_RXFC_MASK 0xFFF7
  199. #define MACCR_TXFC_ENABLE BIT(4)
  200. #define MACCR_TXFC_MASK 0xFFEF
  201. #define MACCR_PSI BIT(6) /* Software Cable-Off */
  202. /* Power Saving Interrupt */
  203. #define MACCR_PF BIT(7)
  204. #define MACCR_PMM_BITS 8
  205. #define MACCR_PMM_MASK (0x1F00)
  206. #define MACCR_PMM_RESET BIT(8)
  207. #define MACCR_PMM_WAIT (2 << 8)
  208. #define MACCR_PMM_READY (3 << 8)
  209. #define MACCR_PMM_D1 (4 << 8)
  210. #define MACCR_PMM_D2 (5 << 8)
  211. #define MACCR_PMM_WAKE (7 << 8)
  212. #define MACCR_PMM_D1_WAKE (8 << 8)
  213. #define MACCR_PMM_D2_WAKE (9 << 8)
  214. #define MACCR_PMM_SLEEP (10 << 8)
  215. #define MACCR_PMM_PHY_RESET (11 << 8)
  216. #define MACCR_PMM_SOFT_D1 (16 << 8)
  217. #define MACCR_PMM_SOFT_D2 (17 << 8)
  218. #define P0_TFBFCR (0x10)
  219. #define TFBFCR_SCHE_FREE_PAGE 0xE07F
  220. #define TFBFCR_FREE_PAGE_BITS 0x07
  221. #define TFBFCR_FREE_PAGE_LATCH BIT(6)
  222. #define TFBFCR_SET_FREE_PAGE(x) (((x) & 0x3F) << TFBFCR_FREE_PAGE_BITS)
  223. #define TFBFCR_TX_PAGE_SET BIT(13)
  224. #define TFBFCR_MANU_ENTX BIT(15)
  225. #define TX_FREEBUF_MASK 0x003F
  226. #define TX_DPTSTART 0x4000
  227. #define P0_TSNR (0x12)
  228. #define TXNR_TXB_ERR BIT(5)
  229. #define TXNR_TXB_IDLE BIT(6)
  230. #define TSNR_PKT_CNT(x) (((x) & 0x3F) << 8)
  231. #define TXNR_TXB_REINIT BIT(14)
  232. #define TSNR_TXB_START BIT(15)
  233. #define P0_RTDPR (0x14)
  234. #define P0_RXBCR1 (0x16)
  235. #define RXBCR1_RXB_DISCARD BIT(14)
  236. #define RXBCR1_RXB_START BIT(15)
  237. #define P0_RXBCR2 (0x18)
  238. #define RXBCR2_PKT_MASK (0xFF)
  239. #define RXBCR2_RXPC_MASK (0x7F)
  240. #define RXBCR2_RXB_READY BIT(13)
  241. #define RXBCR2_RXB_IDLE BIT(14)
  242. #define RXBCR2_RXB_REINIT BIT(15)
  243. #define P0_RTWCR (0x1A)
  244. #define RTWCR_RXWC_MASK (0x3FFF)
  245. #define RTWCR_RX_LATCH BIT(15)
  246. #define P0_RCPHR (0x1C)
  247. /* Definition of PAGE1 */
  248. #define P1_RPPER (0x22)
  249. #define RPPER_RXEN BIT(0)
  250. #define P1_MRCR (0x28)
  251. #define P1_MDR (0x2A)
  252. #define P1_RMPR (0x2C)
  253. #define P1_TMPR (0x2E)
  254. #define P1_RXBSPCR (0x30)
  255. #define RXBSPCR_STUF_WORD_CNT(x) (((x) & 0x7000) >> 12)
  256. #define RXBSPCR_STUF_ENABLE BIT(15)
  257. #define P1_MCR (0x32)
  258. #define MCR_SBP BIT(8)
  259. #define MCR_SM BIT(9)
  260. #define MCR_CRCENLAN BIT(11)
  261. #define MCR_STP BIT(12)
  262. /* Definition of PAGE2 */
  263. #define P2_CIR (0x42)
  264. #define P2_PCR (0x44)
  265. #define PCR_POLL_EN BIT(0)
  266. #define PCR_POLL_FLOWCTRL BIT(1)
  267. #define PCR_POLL_BMCR BIT(2)
  268. #define PCR_PHYID(x) ((x) << 8)
  269. #define P2_PHYSR (0x46)
  270. #define P2_MDIODR (0x48)
  271. #define P2_MDIOCR (0x4A)
  272. #define MDIOCR_RADDR(x) ((x) & 0x1F)
  273. #define MDIOCR_FADDR(x) (((x) & 0x1F) << 8)
  274. #define MDIOCR_VALID BIT(13)
  275. #define MDIOCR_READ BIT(14)
  276. #define MDIOCR_WRITE BIT(15)
  277. #define P2_LCR0 (0x4C)
  278. #define LCR_LED0_EN BIT(0)
  279. #define LCR_LED0_100MODE BIT(1)
  280. #define LCR_LED0_DUPLEX BIT(2)
  281. #define LCR_LED0_LINK BIT(3)
  282. #define LCR_LED0_ACT BIT(4)
  283. #define LCR_LED0_COL BIT(5)
  284. #define LCR_LED0_10MODE BIT(6)
  285. #define LCR_LED0_DUPCOL BIT(7)
  286. #define LCR_LED1_EN BIT(8)
  287. #define LCR_LED1_100MODE BIT(9)
  288. #define LCR_LED1_DUPLEX BIT(10)
  289. #define LCR_LED1_LINK BIT(11)
  290. #define LCR_LED1_ACT BIT(12)
  291. #define LCR_LED1_COL BIT(13)
  292. #define LCR_LED1_10MODE BIT(14)
  293. #define LCR_LED1_DUPCOL BIT(15)
  294. #define P2_LCR1 (0x4E)
  295. #define LCR_LED2_MASK (0xFF00)
  296. #define LCR_LED2_EN BIT(0)
  297. #define LCR_LED2_100MODE BIT(1)
  298. #define LCR_LED2_DUPLEX BIT(2)
  299. #define LCR_LED2_LINK BIT(3)
  300. #define LCR_LED2_ACT BIT(4)
  301. #define LCR_LED2_COL BIT(5)
  302. #define LCR_LED2_10MODE BIT(6)
  303. #define LCR_LED2_DUPCOL BIT(7)
  304. #define P2_IPGCR (0x50)
  305. #define P2_CRIR (0x52)
  306. #define P2_FLHWCR (0x54)
  307. #define P2_RXCR (0x56)
  308. #define RXCR_PRO BIT(0)
  309. #define RXCR_AMALL BIT(1)
  310. #define RXCR_SEP BIT(2)
  311. #define RXCR_AB BIT(3)
  312. #define RXCR_AM BIT(4)
  313. #define RXCR_AP BIT(5)
  314. #define RXCR_ARP BIT(6)
  315. #define P2_JLCR (0x58)
  316. #define P2_MPLR (0x5C)
  317. /* Definition of PAGE3 */
  318. #define P3_MACASR0 (0x62)
  319. #define P3_MACASR(x) (P3_MACASR0 + 2 * (x))
  320. #define MACASR_LOWBYTE_MASK 0x00FF
  321. #define MACASR_HIGH_BITS 0x08
  322. #define P3_MACASR1 (0x64)
  323. #define P3_MACASR2 (0x66)
  324. #define P3_MFAR01 (0x68)
  325. #define P3_MFAR_BASE (0x68)
  326. #define P3_MFAR(x) (P3_MFAR_BASE + 2 * (x))
  327. #define P3_MFAR23 (0x6A)
  328. #define P3_MFAR45 (0x6C)
  329. #define P3_MFAR67 (0x6E)
  330. #define P3_VID0FR (0x70)
  331. #define P3_VID1FR (0x72)
  332. #define P3_EECSR (0x74)
  333. #define P3_EEDR (0x76)
  334. #define P3_EECR (0x78)
  335. #define EECR_ADDR_MASK (0x00FF)
  336. #define EECR_READ_ACT BIT(8)
  337. #define EECR_WRITE_ACT BIT(9)
  338. #define EECR_WRITE_DISABLE BIT(10)
  339. #define EECR_WRITE_ENABLE BIT(11)
  340. #define EECR_EE_READY BIT(13)
  341. #define EECR_RELOAD BIT(14)
  342. #define EECR_RESET BIT(15)
  343. #define P3_TPCR (0x7A)
  344. #define TPCR_PATT_MASK (0xFF)
  345. #define TPCR_RAND_PKT_EN BIT(14)
  346. #define TPCR_FIXED_PKT_EN BIT(15)
  347. #define P3_TPLR (0x7C)
  348. /* Definition of PAGE4 */
  349. #define P4_SPICR (0x8A)
  350. #define SPICR_RCEN BIT(0)
  351. #define SPICR_QCEN BIT(1)
  352. #define SPICR_RBRE BIT(3)
  353. #define SPICR_PMM BIT(4)
  354. #define SPICR_LOOPBACK BIT(8)
  355. #define SPICR_CORE_RES_CLR BIT(10)
  356. #define SPICR_SPI_RES_CLR BIT(11)
  357. #define P4_SPIISMR (0x8C)
  358. #define P4_COERCR0 (0x92)
  359. #define COERCR0_RXIPCE BIT(0)
  360. #define COERCR0_RXIPVE BIT(1)
  361. #define COERCR0_RXV6PE BIT(2)
  362. #define COERCR0_RXTCPE BIT(3)
  363. #define COERCR0_RXUDPE BIT(4)
  364. #define COERCR0_RXICMP BIT(5)
  365. #define COERCR0_RXIGMP BIT(6)
  366. #define COERCR0_RXICV6 BIT(7)
  367. #define COERCR0_RXTCPV6 BIT(8)
  368. #define COERCR0_RXUDPV6 BIT(9)
  369. #define COERCR0_RXICMV6 BIT(10)
  370. #define COERCR0_RXIGMV6 BIT(11)
  371. #define COERCR0_RXICV6V6 BIT(12)
  372. #define COERCR0_DEFAULT (COERCR0_RXIPCE | COERCR0_RXV6PE | \
  373. COERCR0_RXTCPE | COERCR0_RXUDPE | \
  374. COERCR0_RXTCPV6 | COERCR0_RXUDPV6)
  375. #define P4_COERCR1 (0x94)
  376. #define COERCR1_IPCEDP BIT(0)
  377. #define COERCR1_IPVEDP BIT(1)
  378. #define COERCR1_V6VEDP BIT(2)
  379. #define COERCR1_TCPEDP BIT(3)
  380. #define COERCR1_UDPEDP BIT(4)
  381. #define COERCR1_ICMPDP BIT(5)
  382. #define COERCR1_IGMPDP BIT(6)
  383. #define COERCR1_ICV6DP BIT(7)
  384. #define COERCR1_RX64TE BIT(8)
  385. #define COERCR1_RXPPPE BIT(9)
  386. #define COERCR1_TCP6DP BIT(10)
  387. #define COERCR1_UDP6DP BIT(11)
  388. #define COERCR1_IC6DP BIT(12)
  389. #define COERCR1_IG6DP BIT(13)
  390. #define COERCR1_ICV66DP BIT(14)
  391. #define COERCR1_RPCE BIT(15)
  392. #define COERCR1_DEFAULT (COERCR1_RXPPPE)
  393. #define P4_COETCR0 (0x96)
  394. #define COETCR0_TXIP BIT(0)
  395. #define COETCR0_TXTCP BIT(1)
  396. #define COETCR0_TXUDP BIT(2)
  397. #define COETCR0_TXICMP BIT(3)
  398. #define COETCR0_TXIGMP BIT(4)
  399. #define COETCR0_TXICV6 BIT(5)
  400. #define COETCR0_TXTCPV6 BIT(8)
  401. #define COETCR0_TXUDPV6 BIT(9)
  402. #define COETCR0_TXICMV6 BIT(10)
  403. #define COETCR0_TXIGMV6 BIT(11)
  404. #define COETCR0_TXICV6V6 BIT(12)
  405. #define COETCR0_DEFAULT (COETCR0_TXIP | COETCR0_TXTCP | \
  406. COETCR0_TXUDP | COETCR0_TXTCPV6 | \
  407. COETCR0_TXUDPV6)
  408. #define P4_COETCR1 (0x98)
  409. #define COETCR1_TX64TE BIT(0)
  410. #define COETCR1_TXPPPE BIT(1)
  411. #define P4_COECEDR (0x9A)
  412. #define P4_L2CECR (0x9C)
  413. /* Definition of PAGE5 */
  414. #define P5_WFTR (0xA2)
  415. #define WFTR_2MS (0x01)
  416. #define WFTR_4MS (0x02)
  417. #define WFTR_8MS (0x03)
  418. #define WFTR_16MS (0x04)
  419. #define WFTR_32MS (0x05)
  420. #define WFTR_64MS (0x06)
  421. #define WFTR_128MS (0x07)
  422. #define WFTR_256MS (0x08)
  423. #define WFTR_512MS (0x09)
  424. #define WFTR_1024MS (0x0A)
  425. #define WFTR_2048MS (0x0B)
  426. #define WFTR_4096MS (0x0C)
  427. #define WFTR_8192MS (0x0D)
  428. #define WFTR_16384MS (0x0E)
  429. #define WFTR_32768MS (0x0F)
  430. #define P5_WFCCR (0xA4)
  431. #define P5_WFCR03 (0xA6)
  432. #define WFCR03_F0_EN BIT(0)
  433. #define WFCR03_F1_EN BIT(4)
  434. #define WFCR03_F2_EN BIT(8)
  435. #define WFCR03_F3_EN BIT(12)
  436. #define P5_WFCR47 (0xA8)
  437. #define WFCR47_F4_EN BIT(0)
  438. #define WFCR47_F5_EN BIT(4)
  439. #define WFCR47_F6_EN BIT(8)
  440. #define WFCR47_F7_EN BIT(12)
  441. #define P5_WF0BMR0 (0xAA)
  442. #define P5_WF0BMR1 (0xAC)
  443. #define P5_WF0CR (0xAE)
  444. #define P5_WF0OBR (0xB0)
  445. #define P5_WF1BMR0 (0xB2)
  446. #define P5_WF1BMR1 (0xB4)
  447. #define P5_WF1CR (0xB6)
  448. #define P5_WF1OBR (0xB8)
  449. #define P5_WF2BMR0 (0xBA)
  450. #define P5_WF2BMR1 (0xBC)
  451. /* Definition of PAGE6 */
  452. #define P6_WF2CR (0xC2)
  453. #define P6_WF2OBR (0xC4)
  454. #define P6_WF3BMR0 (0xC6)
  455. #define P6_WF3BMR1 (0xC8)
  456. #define P6_WF3CR (0xCA)
  457. #define P6_WF3OBR (0xCC)
  458. #define P6_WF4BMR0 (0xCE)
  459. #define P6_WF4BMR1 (0xD0)
  460. #define P6_WF4CR (0xD2)
  461. #define P6_WF4OBR (0xD4)
  462. #define P6_WF5BMR0 (0xD6)
  463. #define P6_WF5BMR1 (0xD8)
  464. #define P6_WF5CR (0xDA)
  465. #define P6_WF5OBR (0xDC)
  466. /* Definition of PAGE7 */
  467. #define P7_WF6BMR0 (0xE2)
  468. #define P7_WF6BMR1 (0xE4)
  469. #define P7_WF6CR (0xE6)
  470. #define P7_WF6OBR (0xE8)
  471. #define P7_WF7BMR0 (0xEA)
  472. #define P7_WF7BMR1 (0xEC)
  473. #define P7_WF7CR (0xEE)
  474. #define P7_WF7OBR (0xF0)
  475. #define P7_WFR01 (0xF2)
  476. #define P7_WFR23 (0xF4)
  477. #define P7_WFR45 (0xF6)
  478. #define P7_WFR67 (0xF8)
  479. #define P7_WFPC0 (0xFA)
  480. #define P7_WFPC1 (0xFC)
  481. /* Tx headers structure */
  482. struct tx_sop_header {
  483. /* bit 15-11: flags, bit 10-0: packet length */
  484. u16 flags_len;
  485. /* bit 15-11: sequence number, bit 11-0: packet length bar */
  486. u16 seq_lenbar;
  487. };
  488. struct tx_segment_header {
  489. /* bit 15-14: flags, bit 13-11: segment number */
  490. /* bit 10-0: segment length */
  491. u16 flags_seqnum_seglen;
  492. /* bit 15-14: end offset, bit 13-11: start offset */
  493. /* bit 10-0: segment length bar */
  494. u16 eo_so_seglenbar;
  495. };
  496. struct tx_eop_header {
  497. /* bit 15-11: sequence number, bit 10-0: packet length */
  498. u16 seq_len;
  499. /* bit 15-11: sequence number bar, bit 10-0: packet length bar */
  500. u16 seqbar_lenbar;
  501. };
  502. struct tx_pkt_info {
  503. struct tx_sop_header sop;
  504. struct tx_segment_header seg;
  505. struct tx_eop_header eop;
  506. u16 pkt_len;
  507. u16 seq_num;
  508. };
  509. /* Rx headers structure */
  510. struct rx_header {
  511. u16 flags_len;
  512. u16 seq_lenbar;
  513. u16 flags;
  514. };
  515. extern unsigned long ax88796c_no_regs_mask[];
  516. #endif /* #ifndef _AX88796C_MAIN_H */