atl2.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  1. /* atl2.h -- atl2 driver definitions
  2. *
  3. * Copyright(c) 2007 Atheros Corporation. All rights reserved.
  4. * Copyright(c) 2006 xiong huang <xiong.huang@atheros.com>
  5. * Copyright(c) 2007 Chris Snook <csnook@redhat.com>
  6. *
  7. * Derived from Intel e1000 driver
  8. * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by the Free
  12. * Software Foundation; either version 2 of the License, or (at your option)
  13. * any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful, but WITHOUT
  16. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  17. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  18. * more details.
  19. *
  20. * You should have received a copy of the GNU General Public License along with
  21. * this program; if not, write to the Free Software Foundation, Inc., 59
  22. * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  23. */
  24. #ifndef _ATL2_H_
  25. #define _ATL2_H_
  26. #include <linux/atomic.h>
  27. #include <linux/netdevice.h>
  28. #ifndef _ATL2_HW_H_
  29. #define _ATL2_HW_H_
  30. #ifndef _ATL2_OSDEP_H_
  31. #define _ATL2_OSDEP_H_
  32. #include <linux/pci.h>
  33. #include <linux/delay.h>
  34. #include <linux/interrupt.h>
  35. #include <linux/if_ether.h>
  36. #include "atlx.h"
  37. #ifdef ETHTOOL_OPS_COMPAT
  38. int ethtool_ioctl(struct ifreq *ifr);
  39. #endif
  40. #define PCI_COMMAND_REGISTER PCI_COMMAND
  41. #define CMD_MEM_WRT_INVALIDATE PCI_COMMAND_INVALIDATE
  42. #define ATL2_WRITE_REG(a, reg, value) (iowrite32((value), \
  43. ((a)->hw_addr + (reg))))
  44. #define ATL2_WRITE_FLUSH(a) (ioread32((a)->hw_addr))
  45. #define ATL2_READ_REG(a, reg) (ioread32((a)->hw_addr + (reg)))
  46. #define ATL2_WRITE_REGB(a, reg, value) (iowrite8((value), \
  47. ((a)->hw_addr + (reg))))
  48. #define ATL2_READ_REGB(a, reg) (ioread8((a)->hw_addr + (reg)))
  49. #define ATL2_WRITE_REGW(a, reg, value) (iowrite16((value), \
  50. ((a)->hw_addr + (reg))))
  51. #define ATL2_READ_REGW(a, reg) (ioread16((a)->hw_addr + (reg)))
  52. #define ATL2_WRITE_REG_ARRAY(a, reg, offset, value) \
  53. (iowrite32((value), (((a)->hw_addr + (reg)) + ((offset) << 2))))
  54. #define ATL2_READ_REG_ARRAY(a, reg, offset) \
  55. (ioread32(((a)->hw_addr + (reg)) + ((offset) << 2)))
  56. #endif /* _ATL2_OSDEP_H_ */
  57. struct atl2_adapter;
  58. struct atl2_hw;
  59. /* function prototype */
  60. static s32 atl2_reset_hw(struct atl2_hw *hw);
  61. static s32 atl2_read_mac_addr(struct atl2_hw *hw);
  62. static s32 atl2_init_hw(struct atl2_hw *hw);
  63. static s32 atl2_get_speed_and_duplex(struct atl2_hw *hw, u16 *speed,
  64. u16 *duplex);
  65. static u32 atl2_hash_mc_addr(struct atl2_hw *hw, u8 *mc_addr);
  66. static void atl2_hash_set(struct atl2_hw *hw, u32 hash_value);
  67. static s32 atl2_read_phy_reg(struct atl2_hw *hw, u16 reg_addr, u16 *phy_data);
  68. static s32 atl2_write_phy_reg(struct atl2_hw *hw, u32 reg_addr, u16 phy_data);
  69. static void atl2_read_pci_cfg(struct atl2_hw *hw, u32 reg, u16 *value);
  70. static void atl2_write_pci_cfg(struct atl2_hw *hw, u32 reg, u16 *value);
  71. static void atl2_set_mac_addr(struct atl2_hw *hw);
  72. static bool atl2_read_eeprom(struct atl2_hw *hw, u32 Offset, u32 *pValue);
  73. static bool atl2_write_eeprom(struct atl2_hw *hw, u32 offset, u32 value);
  74. static s32 atl2_phy_init(struct atl2_hw *hw);
  75. static int atl2_check_eeprom_exist(struct atl2_hw *hw);
  76. static void atl2_force_ps(struct atl2_hw *hw);
  77. /* register definition */
  78. /* Block IDLE Status Register */
  79. #define IDLE_STATUS_RXMAC 1 /* 1: RXMAC is non-IDLE */
  80. #define IDLE_STATUS_TXMAC 2 /* 1: TXMAC is non-IDLE */
  81. #define IDLE_STATUS_DMAR 8 /* 1: DMAR is non-IDLE */
  82. #define IDLE_STATUS_DMAW 4 /* 1: DMAW is non-IDLE */
  83. /* MDIO Control Register */
  84. #define MDIO_WAIT_TIMES 10
  85. /* MAC Control Register */
  86. #define MAC_CTRL_DBG_TX_BKPRESURE 0x100000 /* 1: TX max backoff */
  87. #define MAC_CTRL_MACLP_CLK_PHY 0x8000000 /* 1: 25MHz from phy */
  88. #define MAC_CTRL_HALF_LEFT_BUF_SHIFT 28
  89. #define MAC_CTRL_HALF_LEFT_BUF_MASK 0xF /* MAC retry buf x32B */
  90. /* Internal SRAM Partition Register */
  91. #define REG_SRAM_TXRAM_END 0x1500 /* Internal tail address of TXRAM
  92. * default: 2byte*1024 */
  93. #define REG_SRAM_RXRAM_END 0x1502 /* Internal tail address of RXRAM
  94. * default: 2byte*1024 */
  95. /* Descriptor Control register */
  96. #define REG_TXD_BASE_ADDR_LO 0x1544 /* The base address of the Transmit
  97. * Data Mem low 32-bit(dword align) */
  98. #define REG_TXD_MEM_SIZE 0x1548 /* Transmit Data Memory size(by
  99. * double word , max 256KB) */
  100. #define REG_TXS_BASE_ADDR_LO 0x154C /* The base address of the Transmit
  101. * Status Memory low 32-bit(dword word
  102. * align) */
  103. #define REG_TXS_MEM_SIZE 0x1550 /* double word unit, max 4*2047
  104. * bytes. */
  105. #define REG_RXD_BASE_ADDR_LO 0x1554 /* The base address of the Transmit
  106. * Status Memory low 32-bit(unit 8
  107. * bytes) */
  108. #define REG_RXD_BUF_NUM 0x1558 /* Receive Data & Status Memory buffer
  109. * number (unit 1536bytes, max
  110. * 1536*2047) */
  111. /* DMAR Control Register */
  112. #define REG_DMAR 0x1580
  113. #define DMAR_EN 0x1 /* 1: Enable DMAR */
  114. /* TX Cur-Through (early tx threshold) Control Register */
  115. #define REG_TX_CUT_THRESH 0x1590 /* TxMac begin transmit packet
  116. * threshold(unit word) */
  117. /* DMAW Control Register */
  118. #define REG_DMAW 0x15A0
  119. #define DMAW_EN 0x1
  120. /* Flow control register */
  121. #define REG_PAUSE_ON_TH 0x15A8 /* RXD high watermark of overflow
  122. * threshold configuration register */
  123. #define REG_PAUSE_OFF_TH 0x15AA /* RXD lower watermark of overflow
  124. * threshold configuration register */
  125. /* Mailbox Register */
  126. #define REG_MB_TXD_WR_IDX 0x15f0 /* double word align */
  127. #define REG_MB_RXD_RD_IDX 0x15F4 /* RXD Read index (unit: 1536byets) */
  128. /* Interrupt Status Register */
  129. #define ISR_TIMER 1 /* Interrupt when Timer counts down to zero */
  130. #define ISR_MANUAL 2 /* Software manual interrupt, for debug. Set
  131. * when SW_MAN_INT_EN is set in Table 51
  132. * Selene Master Control Register
  133. * (Offset 0x1400). */
  134. #define ISR_RXF_OV 4 /* RXF overflow interrupt */
  135. #define ISR_TXF_UR 8 /* TXF underrun interrupt */
  136. #define ISR_TXS_OV 0x10 /* Internal transmit status buffer full
  137. * interrupt */
  138. #define ISR_RXS_OV 0x20 /* Internal receive status buffer full
  139. * interrupt */
  140. #define ISR_LINK_CHG 0x40 /* Link Status Change Interrupt */
  141. #define ISR_HOST_TXD_UR 0x80
  142. #define ISR_HOST_RXD_OV 0x100 /* Host rx data memory full , one pulse */
  143. #define ISR_DMAR_TO_RST 0x200 /* DMAR op timeout interrupt. SW should
  144. * do Reset */
  145. #define ISR_DMAW_TO_RST 0x400
  146. #define ISR_PHY 0x800 /* phy interrupt */
  147. #define ISR_TS_UPDATE 0x10000 /* interrupt after new tx pkt status written
  148. * to host */
  149. #define ISR_RS_UPDATE 0x20000 /* interrupt ater new rx pkt status written
  150. * to host. */
  151. #define ISR_TX_EARLY 0x40000 /* interrupt when txmac begin transmit one
  152. * packet */
  153. #define ISR_TX_EVENT (ISR_TXF_UR | ISR_TXS_OV | ISR_HOST_TXD_UR |\
  154. ISR_TS_UPDATE | ISR_TX_EARLY)
  155. #define ISR_RX_EVENT (ISR_RXF_OV | ISR_RXS_OV | ISR_HOST_RXD_OV |\
  156. ISR_RS_UPDATE)
  157. #define IMR_NORMAL_MASK (\
  158. /*ISR_LINK_CHG |*/\
  159. ISR_MANUAL |\
  160. ISR_DMAR_TO_RST |\
  161. ISR_DMAW_TO_RST |\
  162. ISR_PHY |\
  163. ISR_PHY_LINKDOWN |\
  164. ISR_TS_UPDATE |\
  165. ISR_RS_UPDATE)
  166. /* Receive MAC Statistics Registers */
  167. #define REG_STS_RX_PAUSE 0x1700 /* Num pause packets received */
  168. #define REG_STS_RXD_OV 0x1704 /* Num frames dropped due to RX
  169. * FIFO overflow */
  170. #define REG_STS_RXS_OV 0x1708 /* Num frames dropped due to RX
  171. * Status Buffer Overflow */
  172. #define REG_STS_RX_FILTER 0x170C /* Num packets dropped due to
  173. * address filtering */
  174. /* MII definitions */
  175. /* PHY Common Register */
  176. #define MII_SMARTSPEED 0x14
  177. #define MII_DBG_ADDR 0x1D
  178. #define MII_DBG_DATA 0x1E
  179. /* PCI Command Register Bit Definitions */
  180. #define PCI_REG_COMMAND 0x04
  181. #define CMD_IO_SPACE 0x0001
  182. #define CMD_MEMORY_SPACE 0x0002
  183. #define CMD_BUS_MASTER 0x0004
  184. #define MEDIA_TYPE_100M_FULL 1
  185. #define MEDIA_TYPE_100M_HALF 2
  186. #define MEDIA_TYPE_10M_FULL 3
  187. #define MEDIA_TYPE_10M_HALF 4
  188. #define AUTONEG_ADVERTISE_SPEED_DEFAULT 0x000F /* Everything */
  189. /* The size (in bytes) of a ethernet packet */
  190. #define MAXIMUM_ETHERNET_FRAME_SIZE 1518 /* with FCS */
  191. #define MINIMUM_ETHERNET_FRAME_SIZE 64 /* with FCS */
  192. #define MAX_JUMBO_FRAME_SIZE 0x2000
  193. struct tx_pkt_header {
  194. unsigned pkt_size:11;
  195. unsigned:4; /* reserved */
  196. unsigned ins_vlan:1; /* txmac should insert vlan */
  197. unsigned short vlan; /* vlan tag */
  198. };
  199. /* FIXME: replace above bitfields with MASK/SHIFT defines below */
  200. #define TX_PKT_HEADER_SIZE_MASK 0x7FF
  201. #define TX_PKT_HEADER_SIZE_SHIFT 0
  202. #define TX_PKT_HEADER_INS_VLAN_MASK 0x1
  203. #define TX_PKT_HEADER_INS_VLAN_SHIFT 15
  204. #define TX_PKT_HEADER_VLAN_TAG_MASK 0xFFFF
  205. #define TX_PKT_HEADER_VLAN_TAG_SHIFT 16
  206. struct tx_pkt_status {
  207. unsigned pkt_size:11;
  208. unsigned:5; /* reserved */
  209. unsigned ok:1; /* current packet transmitted without error */
  210. unsigned bcast:1; /* broadcast packet */
  211. unsigned mcast:1; /* multicast packet */
  212. unsigned pause:1; /* transmiited a pause frame */
  213. unsigned ctrl:1;
  214. unsigned defer:1; /* current packet is xmitted with defer */
  215. unsigned exc_defer:1;
  216. unsigned single_col:1;
  217. unsigned multi_col:1;
  218. unsigned late_col:1;
  219. unsigned abort_col:1;
  220. unsigned underun:1; /* current packet is aborted
  221. * due to txram underrun */
  222. unsigned:3; /* reserved */
  223. unsigned update:1; /* always 1'b1 in tx_status_buf */
  224. };
  225. /* FIXME: replace above bitfields with MASK/SHIFT defines below */
  226. #define TX_PKT_STATUS_SIZE_MASK 0x7FF
  227. #define TX_PKT_STATUS_SIZE_SHIFT 0
  228. #define TX_PKT_STATUS_OK_MASK 0x1
  229. #define TX_PKT_STATUS_OK_SHIFT 16
  230. #define TX_PKT_STATUS_BCAST_MASK 0x1
  231. #define TX_PKT_STATUS_BCAST_SHIFT 17
  232. #define TX_PKT_STATUS_MCAST_MASK 0x1
  233. #define TX_PKT_STATUS_MCAST_SHIFT 18
  234. #define TX_PKT_STATUS_PAUSE_MASK 0x1
  235. #define TX_PKT_STATUS_PAUSE_SHIFT 19
  236. #define TX_PKT_STATUS_CTRL_MASK 0x1
  237. #define TX_PKT_STATUS_CTRL_SHIFT 20
  238. #define TX_PKT_STATUS_DEFER_MASK 0x1
  239. #define TX_PKT_STATUS_DEFER_SHIFT 21
  240. #define TX_PKT_STATUS_EXC_DEFER_MASK 0x1
  241. #define TX_PKT_STATUS_EXC_DEFER_SHIFT 22
  242. #define TX_PKT_STATUS_SINGLE_COL_MASK 0x1
  243. #define TX_PKT_STATUS_SINGLE_COL_SHIFT 23
  244. #define TX_PKT_STATUS_MULTI_COL_MASK 0x1
  245. #define TX_PKT_STATUS_MULTI_COL_SHIFT 24
  246. #define TX_PKT_STATUS_LATE_COL_MASK 0x1
  247. #define TX_PKT_STATUS_LATE_COL_SHIFT 25
  248. #define TX_PKT_STATUS_ABORT_COL_MASK 0x1
  249. #define TX_PKT_STATUS_ABORT_COL_SHIFT 26
  250. #define TX_PKT_STATUS_UNDERRUN_MASK 0x1
  251. #define TX_PKT_STATUS_UNDERRUN_SHIFT 27
  252. #define TX_PKT_STATUS_UPDATE_MASK 0x1
  253. #define TX_PKT_STATUS_UPDATE_SHIFT 31
  254. struct rx_pkt_status {
  255. unsigned pkt_size:11; /* packet size, max 2047 bytes */
  256. unsigned:5; /* reserved */
  257. unsigned ok:1; /* current packet received ok without error */
  258. unsigned bcast:1; /* current packet is broadcast */
  259. unsigned mcast:1; /* current packet is multicast */
  260. unsigned pause:1;
  261. unsigned ctrl:1;
  262. unsigned crc:1; /* received a packet with crc error */
  263. unsigned code:1; /* received a packet with code error */
  264. unsigned runt:1; /* received a packet less than 64 bytes
  265. * with good crc */
  266. unsigned frag:1; /* received a packet less than 64 bytes
  267. * with bad crc */
  268. unsigned trunc:1; /* current frame truncated due to rxram full */
  269. unsigned align:1; /* this packet is alignment error */
  270. unsigned vlan:1; /* this packet has vlan */
  271. unsigned:3; /* reserved */
  272. unsigned update:1;
  273. unsigned short vtag; /* vlan tag */
  274. unsigned:16;
  275. };
  276. /* FIXME: replace above bitfields with MASK/SHIFT defines below */
  277. #define RX_PKT_STATUS_SIZE_MASK 0x7FF
  278. #define RX_PKT_STATUS_SIZE_SHIFT 0
  279. #define RX_PKT_STATUS_OK_MASK 0x1
  280. #define RX_PKT_STATUS_OK_SHIFT 16
  281. #define RX_PKT_STATUS_BCAST_MASK 0x1
  282. #define RX_PKT_STATUS_BCAST_SHIFT 17
  283. #define RX_PKT_STATUS_MCAST_MASK 0x1
  284. #define RX_PKT_STATUS_MCAST_SHIFT 18
  285. #define RX_PKT_STATUS_PAUSE_MASK 0x1
  286. #define RX_PKT_STATUS_PAUSE_SHIFT 19
  287. #define RX_PKT_STATUS_CTRL_MASK 0x1
  288. #define RX_PKT_STATUS_CTRL_SHIFT 20
  289. #define RX_PKT_STATUS_CRC_MASK 0x1
  290. #define RX_PKT_STATUS_CRC_SHIFT 21
  291. #define RX_PKT_STATUS_CODE_MASK 0x1
  292. #define RX_PKT_STATUS_CODE_SHIFT 22
  293. #define RX_PKT_STATUS_RUNT_MASK 0x1
  294. #define RX_PKT_STATUS_RUNT_SHIFT 23
  295. #define RX_PKT_STATUS_FRAG_MASK 0x1
  296. #define RX_PKT_STATUS_FRAG_SHIFT 24
  297. #define RX_PKT_STATUS_TRUNK_MASK 0x1
  298. #define RX_PKT_STATUS_TRUNK_SHIFT 25
  299. #define RX_PKT_STATUS_ALIGN_MASK 0x1
  300. #define RX_PKT_STATUS_ALIGN_SHIFT 26
  301. #define RX_PKT_STATUS_VLAN_MASK 0x1
  302. #define RX_PKT_STATUS_VLAN_SHIFT 27
  303. #define RX_PKT_STATUS_UPDATE_MASK 0x1
  304. #define RX_PKT_STATUS_UPDATE_SHIFT 31
  305. #define RX_PKT_STATUS_VLAN_TAG_MASK 0xFFFF
  306. #define RX_PKT_STATUS_VLAN_TAG_SHIFT 32
  307. struct rx_desc {
  308. struct rx_pkt_status status;
  309. unsigned char packet[1536-sizeof(struct rx_pkt_status)];
  310. };
  311. enum atl2_speed_duplex {
  312. atl2_10_half = 0,
  313. atl2_10_full = 1,
  314. atl2_100_half = 2,
  315. atl2_100_full = 3
  316. };
  317. struct atl2_spi_flash_dev {
  318. const char *manu_name; /* manufacturer id */
  319. /* op-code */
  320. u8 cmdWRSR;
  321. u8 cmdREAD;
  322. u8 cmdPROGRAM;
  323. u8 cmdWREN;
  324. u8 cmdWRDI;
  325. u8 cmdRDSR;
  326. u8 cmdRDID;
  327. u8 cmdSECTOR_ERASE;
  328. u8 cmdCHIP_ERASE;
  329. };
  330. /* Structure containing variables used by the shared code (atl2_hw.c) */
  331. struct atl2_hw {
  332. u8 __iomem *hw_addr;
  333. void *back;
  334. u8 preamble_len;
  335. u8 max_retry; /* Retransmission maximum, afterwards the
  336. * packet will be discarded. */
  337. u8 jam_ipg; /* IPG to start JAM for collision based flow
  338. * control in half-duplex mode. In unit of
  339. * 8-bit time. */
  340. u8 ipgt; /* Desired back to back inter-packet gap. The
  341. * default is 96-bit time. */
  342. u8 min_ifg; /* Minimum number of IFG to enforce in between
  343. * RX frames. Frame gap below such IFP is
  344. * dropped. */
  345. u8 ipgr1; /* 64bit Carrier-Sense window */
  346. u8 ipgr2; /* 96-bit IPG window */
  347. u8 retry_buf; /* When half-duplex mode, should hold some
  348. * bytes for mac retry . (8*4bytes unit) */
  349. u16 fc_rxd_hi;
  350. u16 fc_rxd_lo;
  351. u16 lcol; /* Collision Window */
  352. u16 max_frame_size;
  353. u16 MediaType;
  354. u16 autoneg_advertised;
  355. u16 pci_cmd_word;
  356. u16 mii_autoneg_adv_reg;
  357. u32 mem_rang;
  358. u32 txcw;
  359. u32 mc_filter_type;
  360. u32 num_mc_addrs;
  361. u32 collision_delta;
  362. u32 tx_packet_delta;
  363. u16 phy_spd_default;
  364. u16 device_id;
  365. u16 vendor_id;
  366. u16 subsystem_id;
  367. u16 subsystem_vendor_id;
  368. u8 revision_id;
  369. /* spi flash */
  370. u8 flash_vendor;
  371. u8 dma_fairness;
  372. u8 mac_addr[ETH_ALEN];
  373. u8 perm_mac_addr[ETH_ALEN];
  374. /* FIXME */
  375. /* bool phy_preamble_sup; */
  376. bool phy_configured;
  377. };
  378. #endif /* _ATL2_HW_H_ */
  379. struct atl2_ring_header {
  380. /* pointer to the descriptor ring memory */
  381. void *desc;
  382. /* physical address of the descriptor ring */
  383. dma_addr_t dma;
  384. /* length of descriptor ring in bytes */
  385. unsigned int size;
  386. };
  387. /* board specific private data structure */
  388. struct atl2_adapter {
  389. /* OS defined structs */
  390. struct net_device *netdev;
  391. struct pci_dev *pdev;
  392. u32 wol;
  393. u16 link_speed;
  394. u16 link_duplex;
  395. spinlock_t stats_lock;
  396. struct work_struct reset_task;
  397. struct work_struct link_chg_task;
  398. struct timer_list watchdog_timer;
  399. struct timer_list phy_config_timer;
  400. unsigned long cfg_phy;
  401. bool mac_disabled;
  402. /* All Descriptor memory */
  403. dma_addr_t ring_dma;
  404. void *ring_vir_addr;
  405. int ring_size;
  406. struct tx_pkt_header *txd_ring;
  407. dma_addr_t txd_dma;
  408. struct tx_pkt_status *txs_ring;
  409. dma_addr_t txs_dma;
  410. struct rx_desc *rxd_ring;
  411. dma_addr_t rxd_dma;
  412. u32 txd_ring_size; /* bytes per unit */
  413. u32 txs_ring_size; /* dwords per unit */
  414. u32 rxd_ring_size; /* 1536 bytes per unit */
  415. /* read /write ptr: */
  416. /* host */
  417. u32 txd_write_ptr;
  418. u32 txs_next_clear;
  419. u32 rxd_read_ptr;
  420. /* nic */
  421. atomic_t txd_read_ptr;
  422. atomic_t txs_write_ptr;
  423. u32 rxd_write_ptr;
  424. /* Interrupt Moderator timer ( 2us resolution) */
  425. u16 imt;
  426. /* Interrupt Clear timer (2us resolution) */
  427. u16 ict;
  428. unsigned long flags;
  429. /* structs defined in atl2_hw.h */
  430. u32 bd_number; /* board number */
  431. bool pci_using_64;
  432. bool have_msi;
  433. struct atl2_hw hw;
  434. u32 usr_cmd;
  435. /* FIXME */
  436. /* u32 regs_buff[ATL2_REGS_LEN]; */
  437. u32 pci_state[16];
  438. u32 *config_space;
  439. };
  440. enum atl2_state_t {
  441. __ATL2_TESTING,
  442. __ATL2_RESETTING,
  443. __ATL2_DOWN
  444. };
  445. #endif /* _ATL2_H_ */