82571.c 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866
  1. /*******************************************************************************
  2. Intel PRO/1000 Linux driver
  3. Copyright(c) 1999 - 2009 Intel Corporation.
  4. This program is free software; you can redistribute it and/or modify it
  5. under the terms and conditions of the GNU General Public License,
  6. version 2, as published by the Free Software Foundation.
  7. This program is distributed in the hope it will be useful, but WITHOUT
  8. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  9. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  10. more details.
  11. You should have received a copy of the GNU General Public License along with
  12. this program; if not, write to the Free Software Foundation, Inc.,
  13. 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  14. The full GNU General Public License is included in this distribution in
  15. the file called "COPYING".
  16. Contact Information:
  17. Linux NICS <linux.nics@intel.com>
  18. e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
  19. Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  20. *******************************************************************************/
  21. /*
  22. * 82571EB Gigabit Ethernet Controller
  23. * 82571EB Gigabit Ethernet Controller (Copper)
  24. * 82571EB Gigabit Ethernet Controller (Fiber)
  25. * 82571EB Dual Port Gigabit Mezzanine Adapter
  26. * 82571EB Quad Port Gigabit Mezzanine Adapter
  27. * 82571PT Gigabit PT Quad Port Server ExpressModule
  28. * 82572EI Gigabit Ethernet Controller (Copper)
  29. * 82572EI Gigabit Ethernet Controller (Fiber)
  30. * 82572EI Gigabit Ethernet Controller
  31. * 82573V Gigabit Ethernet Controller (Copper)
  32. * 82573E Gigabit Ethernet Controller (Copper)
  33. * 82573L Gigabit Ethernet Controller
  34. * 82574L Gigabit Network Connection
  35. * 82583V Gigabit Network Connection
  36. */
  37. #include "e1000.h"
  38. #define ID_LED_RESERVED_F746 0xF746
  39. #define ID_LED_DEFAULT_82573 ((ID_LED_DEF1_DEF2 << 12) | \
  40. (ID_LED_OFF1_ON2 << 8) | \
  41. (ID_LED_DEF1_DEF2 << 4) | \
  42. (ID_LED_DEF1_DEF2))
  43. #define E1000_GCR_L1_ACT_WITHOUT_L0S_RX 0x08000000
  44. #define E1000_NVM_INIT_CTRL2_MNGM 0x6000 /* Manageability Operation Mode mask */
  45. static s32 e1000_get_phy_id_82571(struct e1000_hw *hw);
  46. static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw);
  47. static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw);
  48. static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw);
  49. static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset,
  50. u16 words, u16 *data);
  51. static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw);
  52. static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw);
  53. static s32 e1000_setup_link_82571(struct e1000_hw *hw);
  54. static void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw);
  55. static void e1000_clear_vfta_82571(struct e1000_hw *hw);
  56. static bool e1000_check_mng_mode_82574(struct e1000_hw *hw);
  57. static s32 e1000_led_on_82574(struct e1000_hw *hw);
  58. static void e1000_put_hw_semaphore_82571(struct e1000_hw *hw);
  59. static void e1000_power_down_phy_copper_82571(struct e1000_hw *hw);
  60. /**
  61. * e1000_init_phy_params_82571 - Init PHY func ptrs.
  62. * @hw: pointer to the HW structure
  63. **/
  64. static s32 e1000_init_phy_params_82571(struct e1000_hw *hw)
  65. {
  66. struct e1000_phy_info *phy = &hw->phy;
  67. s32 ret_val;
  68. if (hw->phy.media_type != e1000_media_type_copper) {
  69. phy->type = e1000_phy_none;
  70. return 0;
  71. }
  72. phy->addr = 1;
  73. phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
  74. phy->reset_delay_us = 100;
  75. phy->ops.power_up = e1000_power_up_phy_copper;
  76. phy->ops.power_down = e1000_power_down_phy_copper_82571;
  77. switch (hw->mac.type) {
  78. case e1000_82571:
  79. case e1000_82572:
  80. phy->type = e1000_phy_igp_2;
  81. break;
  82. case e1000_82573:
  83. phy->type = e1000_phy_m88;
  84. break;
  85. case e1000_82574:
  86. case e1000_82583:
  87. phy->type = e1000_phy_bm;
  88. break;
  89. default:
  90. return -E1000_ERR_PHY;
  91. break;
  92. }
  93. /* This can only be done after all function pointers are setup. */
  94. ret_val = e1000_get_phy_id_82571(hw);
  95. /* Verify phy id */
  96. switch (hw->mac.type) {
  97. case e1000_82571:
  98. case e1000_82572:
  99. if (phy->id != IGP01E1000_I_PHY_ID)
  100. return -E1000_ERR_PHY;
  101. break;
  102. case e1000_82573:
  103. if (phy->id != M88E1111_I_PHY_ID)
  104. return -E1000_ERR_PHY;
  105. break;
  106. case e1000_82574:
  107. case e1000_82583:
  108. if (phy->id != BME1000_E_PHY_ID_R2)
  109. return -E1000_ERR_PHY;
  110. break;
  111. default:
  112. return -E1000_ERR_PHY;
  113. break;
  114. }
  115. return 0;
  116. }
  117. /**
  118. * e1000_init_nvm_params_82571 - Init NVM func ptrs.
  119. * @hw: pointer to the HW structure
  120. **/
  121. static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw)
  122. {
  123. struct e1000_nvm_info *nvm = &hw->nvm;
  124. u32 eecd = er32(EECD);
  125. u16 size;
  126. nvm->opcode_bits = 8;
  127. nvm->delay_usec = 1;
  128. switch (nvm->override) {
  129. case e1000_nvm_override_spi_large:
  130. nvm->page_size = 32;
  131. nvm->address_bits = 16;
  132. break;
  133. case e1000_nvm_override_spi_small:
  134. nvm->page_size = 8;
  135. nvm->address_bits = 8;
  136. break;
  137. default:
  138. nvm->page_size = eecd & E1000_EECD_ADDR_BITS ? 32 : 8;
  139. nvm->address_bits = eecd & E1000_EECD_ADDR_BITS ? 16 : 8;
  140. break;
  141. }
  142. switch (hw->mac.type) {
  143. case e1000_82573:
  144. case e1000_82574:
  145. case e1000_82583:
  146. if (((eecd >> 15) & 0x3) == 0x3) {
  147. nvm->type = e1000_nvm_flash_hw;
  148. nvm->word_size = 2048;
  149. /*
  150. * Autonomous Flash update bit must be cleared due
  151. * to Flash update issue.
  152. */
  153. eecd &= ~E1000_EECD_AUPDEN;
  154. ew32(EECD, eecd);
  155. break;
  156. }
  157. /* Fall Through */
  158. default:
  159. nvm->type = e1000_nvm_eeprom_spi;
  160. size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >>
  161. E1000_EECD_SIZE_EX_SHIFT);
  162. /*
  163. * Added to a constant, "size" becomes the left-shift value
  164. * for setting word_size.
  165. */
  166. size += NVM_WORD_SIZE_BASE_SHIFT;
  167. /* EEPROM access above 16k is unsupported */
  168. if (size > 14)
  169. size = 14;
  170. nvm->word_size = 1 << size;
  171. break;
  172. }
  173. return 0;
  174. }
  175. /**
  176. * e1000_init_mac_params_82571 - Init MAC func ptrs.
  177. * @hw: pointer to the HW structure
  178. **/
  179. static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter)
  180. {
  181. struct e1000_hw *hw = &adapter->hw;
  182. struct e1000_mac_info *mac = &hw->mac;
  183. struct e1000_mac_operations *func = &mac->ops;
  184. u32 swsm = 0;
  185. u32 swsm2 = 0;
  186. bool force_clear_smbi = false;
  187. /* Set media type */
  188. switch (adapter->pdev->device) {
  189. case E1000_DEV_ID_82571EB_FIBER:
  190. case E1000_DEV_ID_82572EI_FIBER:
  191. case E1000_DEV_ID_82571EB_QUAD_FIBER:
  192. hw->phy.media_type = e1000_media_type_fiber;
  193. break;
  194. case E1000_DEV_ID_82571EB_SERDES:
  195. case E1000_DEV_ID_82572EI_SERDES:
  196. case E1000_DEV_ID_82571EB_SERDES_DUAL:
  197. case E1000_DEV_ID_82571EB_SERDES_QUAD:
  198. hw->phy.media_type = e1000_media_type_internal_serdes;
  199. break;
  200. default:
  201. hw->phy.media_type = e1000_media_type_copper;
  202. break;
  203. }
  204. /* Set mta register count */
  205. mac->mta_reg_count = 128;
  206. /* Set rar entry count */
  207. mac->rar_entry_count = E1000_RAR_ENTRIES;
  208. /* Set if manageability features are enabled. */
  209. mac->arc_subsystem_valid = (er32(FWSM) & E1000_FWSM_MODE_MASK)
  210. ? true : false;
  211. /* Adaptive IFS supported */
  212. mac->adaptive_ifs = true;
  213. /* check for link */
  214. switch (hw->phy.media_type) {
  215. case e1000_media_type_copper:
  216. func->setup_physical_interface = e1000_setup_copper_link_82571;
  217. func->check_for_link = e1000e_check_for_copper_link;
  218. func->get_link_up_info = e1000e_get_speed_and_duplex_copper;
  219. break;
  220. case e1000_media_type_fiber:
  221. func->setup_physical_interface =
  222. e1000_setup_fiber_serdes_link_82571;
  223. func->check_for_link = e1000e_check_for_fiber_link;
  224. func->get_link_up_info =
  225. e1000e_get_speed_and_duplex_fiber_serdes;
  226. break;
  227. case e1000_media_type_internal_serdes:
  228. func->setup_physical_interface =
  229. e1000_setup_fiber_serdes_link_82571;
  230. func->check_for_link = e1000_check_for_serdes_link_82571;
  231. func->get_link_up_info =
  232. e1000e_get_speed_and_duplex_fiber_serdes;
  233. break;
  234. default:
  235. return -E1000_ERR_CONFIG;
  236. break;
  237. }
  238. switch (hw->mac.type) {
  239. case e1000_82574:
  240. case e1000_82583:
  241. func->check_mng_mode = e1000_check_mng_mode_82574;
  242. func->led_on = e1000_led_on_82574;
  243. break;
  244. default:
  245. func->check_mng_mode = e1000e_check_mng_mode_generic;
  246. func->led_on = e1000e_led_on_generic;
  247. break;
  248. }
  249. /*
  250. * Ensure that the inter-port SWSM.SMBI lock bit is clear before
  251. * first NVM or PHY acess. This should be done for single-port
  252. * devices, and for one port only on dual-port devices so that
  253. * for those devices we can still use the SMBI lock to synchronize
  254. * inter-port accesses to the PHY & NVM.
  255. */
  256. switch (hw->mac.type) {
  257. case e1000_82571:
  258. case e1000_82572:
  259. swsm2 = er32(SWSM2);
  260. if (!(swsm2 & E1000_SWSM2_LOCK)) {
  261. /* Only do this for the first interface on this card */
  262. ew32(SWSM2,
  263. swsm2 | E1000_SWSM2_LOCK);
  264. force_clear_smbi = true;
  265. } else
  266. force_clear_smbi = false;
  267. break;
  268. default:
  269. force_clear_smbi = true;
  270. break;
  271. }
  272. if (force_clear_smbi) {
  273. /* Make sure SWSM.SMBI is clear */
  274. swsm = er32(SWSM);
  275. if (swsm & E1000_SWSM_SMBI) {
  276. /* This bit should not be set on a first interface, and
  277. * indicates that the bootagent or EFI code has
  278. * improperly left this bit enabled
  279. */
  280. e_dbg("Please update your 82571 Bootagent\n");
  281. }
  282. ew32(SWSM, swsm & ~E1000_SWSM_SMBI);
  283. }
  284. /*
  285. * Initialze device specific counter of SMBI acquisition
  286. * timeouts.
  287. */
  288. hw->dev_spec.e82571.smb_counter = 0;
  289. return 0;
  290. }
  291. static s32 e1000_get_variants_82571(struct e1000_adapter *adapter)
  292. {
  293. struct e1000_hw *hw = &adapter->hw;
  294. static int global_quad_port_a; /* global port a indication */
  295. struct pci_dev *pdev = adapter->pdev;
  296. u16 eeprom_data = 0;
  297. int is_port_b = er32(STATUS) & E1000_STATUS_FUNC_1;
  298. s32 rc;
  299. rc = e1000_init_mac_params_82571(adapter);
  300. if (rc)
  301. return rc;
  302. rc = e1000_init_nvm_params_82571(hw);
  303. if (rc)
  304. return rc;
  305. rc = e1000_init_phy_params_82571(hw);
  306. if (rc)
  307. return rc;
  308. /* tag quad port adapters first, it's used below */
  309. switch (pdev->device) {
  310. case E1000_DEV_ID_82571EB_QUAD_COPPER:
  311. case E1000_DEV_ID_82571EB_QUAD_FIBER:
  312. case E1000_DEV_ID_82571EB_QUAD_COPPER_LP:
  313. case E1000_DEV_ID_82571PT_QUAD_COPPER:
  314. adapter->flags |= FLAG_IS_QUAD_PORT;
  315. /* mark the first port */
  316. if (global_quad_port_a == 0)
  317. adapter->flags |= FLAG_IS_QUAD_PORT_A;
  318. /* Reset for multiple quad port adapters */
  319. global_quad_port_a++;
  320. if (global_quad_port_a == 4)
  321. global_quad_port_a = 0;
  322. break;
  323. default:
  324. break;
  325. }
  326. switch (adapter->hw.mac.type) {
  327. case e1000_82571:
  328. /* these dual ports don't have WoL on port B at all */
  329. if (((pdev->device == E1000_DEV_ID_82571EB_FIBER) ||
  330. (pdev->device == E1000_DEV_ID_82571EB_SERDES) ||
  331. (pdev->device == E1000_DEV_ID_82571EB_COPPER)) &&
  332. (is_port_b))
  333. adapter->flags &= ~FLAG_HAS_WOL;
  334. /* quad ports only support WoL on port A */
  335. if (adapter->flags & FLAG_IS_QUAD_PORT &&
  336. (!(adapter->flags & FLAG_IS_QUAD_PORT_A)))
  337. adapter->flags &= ~FLAG_HAS_WOL;
  338. /* Does not support WoL on any port */
  339. if (pdev->device == E1000_DEV_ID_82571EB_SERDES_QUAD)
  340. adapter->flags &= ~FLAG_HAS_WOL;
  341. break;
  342. case e1000_82573:
  343. if (pdev->device == E1000_DEV_ID_82573L) {
  344. if (e1000_read_nvm(&adapter->hw, NVM_INIT_3GIO_3, 1,
  345. &eeprom_data) < 0)
  346. break;
  347. if (!(eeprom_data & NVM_WORD1A_ASPM_MASK)) {
  348. adapter->flags |= FLAG_HAS_JUMBO_FRAMES;
  349. adapter->max_hw_frame_size = DEFAULT_JUMBO;
  350. }
  351. }
  352. break;
  353. default:
  354. break;
  355. }
  356. return 0;
  357. }
  358. /**
  359. * e1000_get_phy_id_82571 - Retrieve the PHY ID and revision
  360. * @hw: pointer to the HW structure
  361. *
  362. * Reads the PHY registers and stores the PHY ID and possibly the PHY
  363. * revision in the hardware structure.
  364. **/
  365. static s32 e1000_get_phy_id_82571(struct e1000_hw *hw)
  366. {
  367. struct e1000_phy_info *phy = &hw->phy;
  368. s32 ret_val;
  369. u16 phy_id = 0;
  370. switch (hw->mac.type) {
  371. case e1000_82571:
  372. case e1000_82572:
  373. /*
  374. * The 82571 firmware may still be configuring the PHY.
  375. * In this case, we cannot access the PHY until the
  376. * configuration is done. So we explicitly set the
  377. * PHY ID.
  378. */
  379. phy->id = IGP01E1000_I_PHY_ID;
  380. break;
  381. case e1000_82573:
  382. return e1000e_get_phy_id(hw);
  383. break;
  384. case e1000_82574:
  385. case e1000_82583:
  386. ret_val = e1e_rphy(hw, PHY_ID1, &phy_id);
  387. if (ret_val)
  388. return ret_val;
  389. phy->id = (u32)(phy_id << 16);
  390. udelay(20);
  391. ret_val = e1e_rphy(hw, PHY_ID2, &phy_id);
  392. if (ret_val)
  393. return ret_val;
  394. phy->id |= (u32)(phy_id);
  395. phy->revision = (u32)(phy_id & ~PHY_REVISION_MASK);
  396. break;
  397. default:
  398. return -E1000_ERR_PHY;
  399. break;
  400. }
  401. return 0;
  402. }
  403. /**
  404. * e1000_get_hw_semaphore_82571 - Acquire hardware semaphore
  405. * @hw: pointer to the HW structure
  406. *
  407. * Acquire the HW semaphore to access the PHY or NVM
  408. **/
  409. static s32 e1000_get_hw_semaphore_82571(struct e1000_hw *hw)
  410. {
  411. u32 swsm;
  412. s32 sw_timeout = hw->nvm.word_size + 1;
  413. s32 fw_timeout = hw->nvm.word_size + 1;
  414. s32 i = 0;
  415. /*
  416. * If we have timedout 3 times on trying to acquire
  417. * the inter-port SMBI semaphore, there is old code
  418. * operating on the other port, and it is not
  419. * releasing SMBI. Modify the number of times that
  420. * we try for the semaphore to interwork with this
  421. * older code.
  422. */
  423. if (hw->dev_spec.e82571.smb_counter > 2)
  424. sw_timeout = 1;
  425. /* Get the SW semaphore */
  426. while (i < sw_timeout) {
  427. swsm = er32(SWSM);
  428. if (!(swsm & E1000_SWSM_SMBI))
  429. break;
  430. udelay(50);
  431. i++;
  432. }
  433. if (i == sw_timeout) {
  434. e_dbg("Driver can't access device - SMBI bit is set.\n");
  435. hw->dev_spec.e82571.smb_counter++;
  436. }
  437. /* Get the FW semaphore. */
  438. for (i = 0; i < fw_timeout; i++) {
  439. swsm = er32(SWSM);
  440. ew32(SWSM, swsm | E1000_SWSM_SWESMBI);
  441. /* Semaphore acquired if bit latched */
  442. if (er32(SWSM) & E1000_SWSM_SWESMBI)
  443. break;
  444. udelay(50);
  445. }
  446. if (i == fw_timeout) {
  447. /* Release semaphores */
  448. e1000_put_hw_semaphore_82571(hw);
  449. e_dbg("Driver can't access the NVM\n");
  450. return -E1000_ERR_NVM;
  451. }
  452. return 0;
  453. }
  454. /**
  455. * e1000_put_hw_semaphore_82571 - Release hardware semaphore
  456. * @hw: pointer to the HW structure
  457. *
  458. * Release hardware semaphore used to access the PHY or NVM
  459. **/
  460. static void e1000_put_hw_semaphore_82571(struct e1000_hw *hw)
  461. {
  462. u32 swsm;
  463. swsm = er32(SWSM);
  464. swsm &= ~(E1000_SWSM_SMBI | E1000_SWSM_SWESMBI);
  465. ew32(SWSM, swsm);
  466. }
  467. /**
  468. * e1000_acquire_nvm_82571 - Request for access to the EEPROM
  469. * @hw: pointer to the HW structure
  470. *
  471. * To gain access to the EEPROM, first we must obtain a hardware semaphore.
  472. * Then for non-82573 hardware, set the EEPROM access request bit and wait
  473. * for EEPROM access grant bit. If the access grant bit is not set, release
  474. * hardware semaphore.
  475. **/
  476. static s32 e1000_acquire_nvm_82571(struct e1000_hw *hw)
  477. {
  478. s32 ret_val;
  479. ret_val = e1000_get_hw_semaphore_82571(hw);
  480. if (ret_val)
  481. return ret_val;
  482. switch (hw->mac.type) {
  483. case e1000_82573:
  484. case e1000_82574:
  485. case e1000_82583:
  486. break;
  487. default:
  488. ret_val = e1000e_acquire_nvm(hw);
  489. break;
  490. }
  491. if (ret_val)
  492. e1000_put_hw_semaphore_82571(hw);
  493. return ret_val;
  494. }
  495. /**
  496. * e1000_release_nvm_82571 - Release exclusive access to EEPROM
  497. * @hw: pointer to the HW structure
  498. *
  499. * Stop any current commands to the EEPROM and clear the EEPROM request bit.
  500. **/
  501. static void e1000_release_nvm_82571(struct e1000_hw *hw)
  502. {
  503. e1000e_release_nvm(hw);
  504. e1000_put_hw_semaphore_82571(hw);
  505. }
  506. /**
  507. * e1000_write_nvm_82571 - Write to EEPROM using appropriate interface
  508. * @hw: pointer to the HW structure
  509. * @offset: offset within the EEPROM to be written to
  510. * @words: number of words to write
  511. * @data: 16 bit word(s) to be written to the EEPROM
  512. *
  513. * For non-82573 silicon, write data to EEPROM at offset using SPI interface.
  514. *
  515. * If e1000e_update_nvm_checksum is not called after this function, the
  516. * EEPROM will most likely contain an invalid checksum.
  517. **/
  518. static s32 e1000_write_nvm_82571(struct e1000_hw *hw, u16 offset, u16 words,
  519. u16 *data)
  520. {
  521. s32 ret_val;
  522. switch (hw->mac.type) {
  523. case e1000_82573:
  524. case e1000_82574:
  525. case e1000_82583:
  526. ret_val = e1000_write_nvm_eewr_82571(hw, offset, words, data);
  527. break;
  528. case e1000_82571:
  529. case e1000_82572:
  530. ret_val = e1000e_write_nvm_spi(hw, offset, words, data);
  531. break;
  532. default:
  533. ret_val = -E1000_ERR_NVM;
  534. break;
  535. }
  536. return ret_val;
  537. }
  538. /**
  539. * e1000_update_nvm_checksum_82571 - Update EEPROM checksum
  540. * @hw: pointer to the HW structure
  541. *
  542. * Updates the EEPROM checksum by reading/adding each word of the EEPROM
  543. * up to the checksum. Then calculates the EEPROM checksum and writes the
  544. * value to the EEPROM.
  545. **/
  546. static s32 e1000_update_nvm_checksum_82571(struct e1000_hw *hw)
  547. {
  548. u32 eecd;
  549. s32 ret_val;
  550. u16 i;
  551. ret_val = e1000e_update_nvm_checksum_generic(hw);
  552. if (ret_val)
  553. return ret_val;
  554. /*
  555. * If our nvm is an EEPROM, then we're done
  556. * otherwise, commit the checksum to the flash NVM.
  557. */
  558. if (hw->nvm.type != e1000_nvm_flash_hw)
  559. return ret_val;
  560. /* Check for pending operations. */
  561. for (i = 0; i < E1000_FLASH_UPDATES; i++) {
  562. msleep(1);
  563. if ((er32(EECD) & E1000_EECD_FLUPD) == 0)
  564. break;
  565. }
  566. if (i == E1000_FLASH_UPDATES)
  567. return -E1000_ERR_NVM;
  568. /* Reset the firmware if using STM opcode. */
  569. if ((er32(FLOP) & 0xFF00) == E1000_STM_OPCODE) {
  570. /*
  571. * The enabling of and the actual reset must be done
  572. * in two write cycles.
  573. */
  574. ew32(HICR, E1000_HICR_FW_RESET_ENABLE);
  575. e1e_flush();
  576. ew32(HICR, E1000_HICR_FW_RESET);
  577. }
  578. /* Commit the write to flash */
  579. eecd = er32(EECD) | E1000_EECD_FLUPD;
  580. ew32(EECD, eecd);
  581. for (i = 0; i < E1000_FLASH_UPDATES; i++) {
  582. msleep(1);
  583. if ((er32(EECD) & E1000_EECD_FLUPD) == 0)
  584. break;
  585. }
  586. if (i == E1000_FLASH_UPDATES)
  587. return -E1000_ERR_NVM;
  588. return 0;
  589. }
  590. /**
  591. * e1000_validate_nvm_checksum_82571 - Validate EEPROM checksum
  592. * @hw: pointer to the HW structure
  593. *
  594. * Calculates the EEPROM checksum by reading/adding each word of the EEPROM
  595. * and then verifies that the sum of the EEPROM is equal to 0xBABA.
  596. **/
  597. static s32 e1000_validate_nvm_checksum_82571(struct e1000_hw *hw)
  598. {
  599. if (hw->nvm.type == e1000_nvm_flash_hw)
  600. e1000_fix_nvm_checksum_82571(hw);
  601. return e1000e_validate_nvm_checksum_generic(hw);
  602. }
  603. /**
  604. * e1000_write_nvm_eewr_82571 - Write to EEPROM for 82573 silicon
  605. * @hw: pointer to the HW structure
  606. * @offset: offset within the EEPROM to be written to
  607. * @words: number of words to write
  608. * @data: 16 bit word(s) to be written to the EEPROM
  609. *
  610. * After checking for invalid values, poll the EEPROM to ensure the previous
  611. * command has completed before trying to write the next word. After write
  612. * poll for completion.
  613. *
  614. * If e1000e_update_nvm_checksum is not called after this function, the
  615. * EEPROM will most likely contain an invalid checksum.
  616. **/
  617. static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset,
  618. u16 words, u16 *data)
  619. {
  620. struct e1000_nvm_info *nvm = &hw->nvm;
  621. u32 i, eewr = 0;
  622. s32 ret_val = 0;
  623. /*
  624. * A check for invalid values: offset too large, too many words,
  625. * and not enough words.
  626. */
  627. if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) ||
  628. (words == 0)) {
  629. e_dbg("nvm parameter(s) out of bounds\n");
  630. return -E1000_ERR_NVM;
  631. }
  632. for (i = 0; i < words; i++) {
  633. eewr = (data[i] << E1000_NVM_RW_REG_DATA) |
  634. ((offset+i) << E1000_NVM_RW_ADDR_SHIFT) |
  635. E1000_NVM_RW_REG_START;
  636. ret_val = e1000e_poll_eerd_eewr_done(hw, E1000_NVM_POLL_WRITE);
  637. if (ret_val)
  638. break;
  639. ew32(EEWR, eewr);
  640. ret_val = e1000e_poll_eerd_eewr_done(hw, E1000_NVM_POLL_WRITE);
  641. if (ret_val)
  642. break;
  643. }
  644. return ret_val;
  645. }
  646. /**
  647. * e1000_get_cfg_done_82571 - Poll for configuration done
  648. * @hw: pointer to the HW structure
  649. *
  650. * Reads the management control register for the config done bit to be set.
  651. **/
  652. static s32 e1000_get_cfg_done_82571(struct e1000_hw *hw)
  653. {
  654. s32 timeout = PHY_CFG_TIMEOUT;
  655. while (timeout) {
  656. if (er32(EEMNGCTL) &
  657. E1000_NVM_CFG_DONE_PORT_0)
  658. break;
  659. msleep(1);
  660. timeout--;
  661. }
  662. if (!timeout) {
  663. e_dbg("MNG configuration cycle has not completed.\n");
  664. return -E1000_ERR_RESET;
  665. }
  666. return 0;
  667. }
  668. /**
  669. * e1000_set_d0_lplu_state_82571 - Set Low Power Linkup D0 state
  670. * @hw: pointer to the HW structure
  671. * @active: true to enable LPLU, false to disable
  672. *
  673. * Sets the LPLU D0 state according to the active flag. When activating LPLU
  674. * this function also disables smart speed and vice versa. LPLU will not be
  675. * activated unless the device autonegotiation advertisement meets standards
  676. * of either 10 or 10/100 or 10/100/1000 at all duplexes. This is a function
  677. * pointer entry point only called by PHY setup routines.
  678. **/
  679. static s32 e1000_set_d0_lplu_state_82571(struct e1000_hw *hw, bool active)
  680. {
  681. struct e1000_phy_info *phy = &hw->phy;
  682. s32 ret_val;
  683. u16 data;
  684. ret_val = e1e_rphy(hw, IGP02E1000_PHY_POWER_MGMT, &data);
  685. if (ret_val)
  686. return ret_val;
  687. if (active) {
  688. data |= IGP02E1000_PM_D0_LPLU;
  689. ret_val = e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, data);
  690. if (ret_val)
  691. return ret_val;
  692. /* When LPLU is enabled, we should disable SmartSpeed */
  693. ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG, &data);
  694. data &= ~IGP01E1000_PSCFR_SMART_SPEED;
  695. ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG, data);
  696. if (ret_val)
  697. return ret_val;
  698. } else {
  699. data &= ~IGP02E1000_PM_D0_LPLU;
  700. ret_val = e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, data);
  701. /*
  702. * LPLU and SmartSpeed are mutually exclusive. LPLU is used
  703. * during Dx states where the power conservation is most
  704. * important. During driver activity we should enable
  705. * SmartSpeed, so performance is maintained.
  706. */
  707. if (phy->smart_speed == e1000_smart_speed_on) {
  708. ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG,
  709. &data);
  710. if (ret_val)
  711. return ret_val;
  712. data |= IGP01E1000_PSCFR_SMART_SPEED;
  713. ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG,
  714. data);
  715. if (ret_val)
  716. return ret_val;
  717. } else if (phy->smart_speed == e1000_smart_speed_off) {
  718. ret_val = e1e_rphy(hw, IGP01E1000_PHY_PORT_CONFIG,
  719. &data);
  720. if (ret_val)
  721. return ret_val;
  722. data &= ~IGP01E1000_PSCFR_SMART_SPEED;
  723. ret_val = e1e_wphy(hw, IGP01E1000_PHY_PORT_CONFIG,
  724. data);
  725. if (ret_val)
  726. return ret_val;
  727. }
  728. }
  729. return 0;
  730. }
  731. /**
  732. * e1000_reset_hw_82571 - Reset hardware
  733. * @hw: pointer to the HW structure
  734. *
  735. * This resets the hardware into a known state.
  736. **/
  737. static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
  738. {
  739. u32 ctrl, extcnf_ctrl, ctrl_ext, icr;
  740. s32 ret_val;
  741. u16 i = 0;
  742. /*
  743. * Prevent the PCI-E bus from sticking if there is no TLP connection
  744. * on the last TLP read/write transaction when MAC is reset.
  745. */
  746. ret_val = e1000e_disable_pcie_master(hw);
  747. if (ret_val)
  748. e_dbg("PCI-E Master disable polling has failed.\n");
  749. e_dbg("Masking off all interrupts\n");
  750. ew32(IMC, 0xffffffff);
  751. ew32(RCTL, 0);
  752. ew32(TCTL, E1000_TCTL_PSP);
  753. e1e_flush();
  754. msleep(10);
  755. /*
  756. * Must acquire the MDIO ownership before MAC reset.
  757. * Ownership defaults to firmware after a reset.
  758. */
  759. switch (hw->mac.type) {
  760. case e1000_82573:
  761. case e1000_82574:
  762. case e1000_82583:
  763. extcnf_ctrl = er32(EXTCNF_CTRL);
  764. extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP;
  765. do {
  766. ew32(EXTCNF_CTRL, extcnf_ctrl);
  767. extcnf_ctrl = er32(EXTCNF_CTRL);
  768. if (extcnf_ctrl & E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP)
  769. break;
  770. extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP;
  771. msleep(2);
  772. i++;
  773. } while (i < MDIO_OWNERSHIP_TIMEOUT);
  774. break;
  775. default:
  776. break;
  777. }
  778. ctrl = er32(CTRL);
  779. e_dbg("Issuing a global reset to MAC\n");
  780. ew32(CTRL, ctrl | E1000_CTRL_RST);
  781. if (hw->nvm.type == e1000_nvm_flash_hw) {
  782. udelay(10);
  783. ctrl_ext = er32(CTRL_EXT);
  784. ctrl_ext |= E1000_CTRL_EXT_EE_RST;
  785. ew32(CTRL_EXT, ctrl_ext);
  786. e1e_flush();
  787. }
  788. ret_val = e1000e_get_auto_rd_done(hw);
  789. if (ret_val)
  790. /* We don't want to continue accessing MAC registers. */
  791. return ret_val;
  792. /*
  793. * Phy configuration from NVM just starts after EECD_AUTO_RD is set.
  794. * Need to wait for Phy configuration completion before accessing
  795. * NVM and Phy.
  796. */
  797. switch (hw->mac.type) {
  798. case e1000_82573:
  799. case e1000_82574:
  800. case e1000_82583:
  801. msleep(25);
  802. break;
  803. default:
  804. break;
  805. }
  806. /* Clear any pending interrupt events. */
  807. ew32(IMC, 0xffffffff);
  808. icr = er32(ICR);
  809. if (hw->mac.type == e1000_82571 &&
  810. hw->dev_spec.e82571.alt_mac_addr_is_present)
  811. e1000e_set_laa_state_82571(hw, true);
  812. /* Reinitialize the 82571 serdes link state machine */
  813. if (hw->phy.media_type == e1000_media_type_internal_serdes)
  814. hw->mac.serdes_link_state = e1000_serdes_link_down;
  815. return 0;
  816. }
  817. /**
  818. * e1000_init_hw_82571 - Initialize hardware
  819. * @hw: pointer to the HW structure
  820. *
  821. * This inits the hardware readying it for operation.
  822. **/
  823. static s32 e1000_init_hw_82571(struct e1000_hw *hw)
  824. {
  825. struct e1000_mac_info *mac = &hw->mac;
  826. u32 reg_data;
  827. s32 ret_val;
  828. u16 i, rar_count = mac->rar_entry_count;
  829. e1000_initialize_hw_bits_82571(hw);
  830. /* Initialize identification LED */
  831. ret_val = e1000e_id_led_init(hw);
  832. if (ret_val)
  833. e_dbg("Error initializing identification LED\n");
  834. /* This is not fatal and we should not stop init due to this */
  835. /* Disabling VLAN filtering */
  836. e_dbg("Initializing the IEEE VLAN\n");
  837. mac->ops.clear_vfta(hw);
  838. /* Setup the receive address. */
  839. /*
  840. * If, however, a locally administered address was assigned to the
  841. * 82571, we must reserve a RAR for it to work around an issue where
  842. * resetting one port will reload the MAC on the other port.
  843. */
  844. if (e1000e_get_laa_state_82571(hw))
  845. rar_count--;
  846. e1000e_init_rx_addrs(hw, rar_count);
  847. /* Zero out the Multicast HASH table */
  848. e_dbg("Zeroing the MTA\n");
  849. for (i = 0; i < mac->mta_reg_count; i++)
  850. E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0);
  851. /* Setup link and flow control */
  852. ret_val = e1000_setup_link_82571(hw);
  853. /* Set the transmit descriptor write-back policy */
  854. reg_data = er32(TXDCTL(0));
  855. reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH) |
  856. E1000_TXDCTL_FULL_TX_DESC_WB |
  857. E1000_TXDCTL_COUNT_DESC;
  858. ew32(TXDCTL(0), reg_data);
  859. /* ...for both queues. */
  860. switch (mac->type) {
  861. case e1000_82573:
  862. case e1000_82574:
  863. case e1000_82583:
  864. e1000e_enable_tx_pkt_filtering(hw);
  865. reg_data = er32(GCR);
  866. reg_data |= E1000_GCR_L1_ACT_WITHOUT_L0S_RX;
  867. ew32(GCR, reg_data);
  868. break;
  869. default:
  870. reg_data = er32(TXDCTL(1));
  871. reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH) |
  872. E1000_TXDCTL_FULL_TX_DESC_WB |
  873. E1000_TXDCTL_COUNT_DESC;
  874. ew32(TXDCTL(1), reg_data);
  875. break;
  876. }
  877. /*
  878. * Clear all of the statistics registers (clear on read). It is
  879. * important that we do this after we have tried to establish link
  880. * because the symbol error count will increment wildly if there
  881. * is no link.
  882. */
  883. e1000_clear_hw_cntrs_82571(hw);
  884. return ret_val;
  885. }
  886. /**
  887. * e1000_initialize_hw_bits_82571 - Initialize hardware-dependent bits
  888. * @hw: pointer to the HW structure
  889. *
  890. * Initializes required hardware-dependent bits needed for normal operation.
  891. **/
  892. static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw)
  893. {
  894. u32 reg;
  895. /* Transmit Descriptor Control 0 */
  896. reg = er32(TXDCTL(0));
  897. reg |= (1 << 22);
  898. ew32(TXDCTL(0), reg);
  899. /* Transmit Descriptor Control 1 */
  900. reg = er32(TXDCTL(1));
  901. reg |= (1 << 22);
  902. ew32(TXDCTL(1), reg);
  903. /* Transmit Arbitration Control 0 */
  904. reg = er32(TARC(0));
  905. reg &= ~(0xF << 27); /* 30:27 */
  906. switch (hw->mac.type) {
  907. case e1000_82571:
  908. case e1000_82572:
  909. reg |= (1 << 23) | (1 << 24) | (1 << 25) | (1 << 26);
  910. break;
  911. default:
  912. break;
  913. }
  914. ew32(TARC(0), reg);
  915. /* Transmit Arbitration Control 1 */
  916. reg = er32(TARC(1));
  917. switch (hw->mac.type) {
  918. case e1000_82571:
  919. case e1000_82572:
  920. reg &= ~((1 << 29) | (1 << 30));
  921. reg |= (1 << 22) | (1 << 24) | (1 << 25) | (1 << 26);
  922. if (er32(TCTL) & E1000_TCTL_MULR)
  923. reg &= ~(1 << 28);
  924. else
  925. reg |= (1 << 28);
  926. ew32(TARC(1), reg);
  927. break;
  928. default:
  929. break;
  930. }
  931. /* Device Control */
  932. switch (hw->mac.type) {
  933. case e1000_82573:
  934. case e1000_82574:
  935. case e1000_82583:
  936. reg = er32(CTRL);
  937. reg &= ~(1 << 29);
  938. ew32(CTRL, reg);
  939. break;
  940. default:
  941. break;
  942. }
  943. /* Extended Device Control */
  944. switch (hw->mac.type) {
  945. case e1000_82573:
  946. case e1000_82574:
  947. case e1000_82583:
  948. reg = er32(CTRL_EXT);
  949. reg &= ~(1 << 23);
  950. reg |= (1 << 22);
  951. ew32(CTRL_EXT, reg);
  952. break;
  953. default:
  954. break;
  955. }
  956. if (hw->mac.type == e1000_82571) {
  957. reg = er32(PBA_ECC);
  958. reg |= E1000_PBA_ECC_CORR_EN;
  959. ew32(PBA_ECC, reg);
  960. }
  961. /*
  962. * Workaround for hardware errata.
  963. * Ensure that DMA Dynamic Clock gating is disabled on 82571 and 82572
  964. */
  965. if ((hw->mac.type == e1000_82571) ||
  966. (hw->mac.type == e1000_82572)) {
  967. reg = er32(CTRL_EXT);
  968. reg &= ~E1000_CTRL_EXT_DMA_DYN_CLK_EN;
  969. ew32(CTRL_EXT, reg);
  970. }
  971. /* PCI-Ex Control Registers */
  972. switch (hw->mac.type) {
  973. case e1000_82574:
  974. case e1000_82583:
  975. reg = er32(GCR);
  976. reg |= (1 << 22);
  977. ew32(GCR, reg);
  978. /*
  979. * Workaround for hardware errata.
  980. * apply workaround for hardware errata documented in errata
  981. * docs Fixes issue where some error prone or unreliable PCIe
  982. * completions are occurring, particularly with ASPM enabled.
  983. * Without fix, issue can cause tx timeouts.
  984. */
  985. reg = er32(GCR2);
  986. reg |= 1;
  987. ew32(GCR2, reg);
  988. break;
  989. default:
  990. break;
  991. }
  992. return;
  993. }
  994. /**
  995. * e1000_clear_vfta_82571 - Clear VLAN filter table
  996. * @hw: pointer to the HW structure
  997. *
  998. * Clears the register array which contains the VLAN filter table by
  999. * setting all the values to 0.
  1000. **/
  1001. static void e1000_clear_vfta_82571(struct e1000_hw *hw)
  1002. {
  1003. u32 offset;
  1004. u32 vfta_value = 0;
  1005. u32 vfta_offset = 0;
  1006. u32 vfta_bit_in_reg = 0;
  1007. switch (hw->mac.type) {
  1008. case e1000_82573:
  1009. case e1000_82574:
  1010. case e1000_82583:
  1011. if (hw->mng_cookie.vlan_id != 0) {
  1012. /*
  1013. * The VFTA is a 4096b bit-field, each identifying
  1014. * a single VLAN ID. The following operations
  1015. * determine which 32b entry (i.e. offset) into the
  1016. * array we want to set the VLAN ID (i.e. bit) of
  1017. * the manageability unit.
  1018. */
  1019. vfta_offset = (hw->mng_cookie.vlan_id >>
  1020. E1000_VFTA_ENTRY_SHIFT) &
  1021. E1000_VFTA_ENTRY_MASK;
  1022. vfta_bit_in_reg = 1 << (hw->mng_cookie.vlan_id &
  1023. E1000_VFTA_ENTRY_BIT_SHIFT_MASK);
  1024. }
  1025. break;
  1026. default:
  1027. break;
  1028. }
  1029. for (offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) {
  1030. /*
  1031. * If the offset we want to clear is the same offset of the
  1032. * manageability VLAN ID, then clear all bits except that of
  1033. * the manageability unit.
  1034. */
  1035. vfta_value = (offset == vfta_offset) ? vfta_bit_in_reg : 0;
  1036. E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, offset, vfta_value);
  1037. e1e_flush();
  1038. }
  1039. }
  1040. /**
  1041. * e1000_check_mng_mode_82574 - Check manageability is enabled
  1042. * @hw: pointer to the HW structure
  1043. *
  1044. * Reads the NVM Initialization Control Word 2 and returns true
  1045. * (>0) if any manageability is enabled, else false (0).
  1046. **/
  1047. static bool e1000_check_mng_mode_82574(struct e1000_hw *hw)
  1048. {
  1049. u16 data;
  1050. e1000_read_nvm(hw, NVM_INIT_CONTROL2_REG, 1, &data);
  1051. return (data & E1000_NVM_INIT_CTRL2_MNGM) != 0;
  1052. }
  1053. /**
  1054. * e1000_led_on_82574 - Turn LED on
  1055. * @hw: pointer to the HW structure
  1056. *
  1057. * Turn LED on.
  1058. **/
  1059. static s32 e1000_led_on_82574(struct e1000_hw *hw)
  1060. {
  1061. u32 ctrl;
  1062. u32 i;
  1063. ctrl = hw->mac.ledctl_mode2;
  1064. if (!(E1000_STATUS_LU & er32(STATUS))) {
  1065. /*
  1066. * If no link, then turn LED on by setting the invert bit
  1067. * for each LED that's "on" (0x0E) in ledctl_mode2.
  1068. */
  1069. for (i = 0; i < 4; i++)
  1070. if (((hw->mac.ledctl_mode2 >> (i * 8)) & 0xFF) ==
  1071. E1000_LEDCTL_MODE_LED_ON)
  1072. ctrl |= (E1000_LEDCTL_LED0_IVRT << (i * 8));
  1073. }
  1074. ew32(LEDCTL, ctrl);
  1075. return 0;
  1076. }
  1077. /**
  1078. * e1000_update_mc_addr_list_82571 - Update Multicast addresses
  1079. * @hw: pointer to the HW structure
  1080. * @mc_addr_list: array of multicast addresses to program
  1081. * @mc_addr_count: number of multicast addresses to program
  1082. * @rar_used_count: the first RAR register free to program
  1083. * @rar_count: total number of supported Receive Address Registers
  1084. *
  1085. * Updates the Receive Address Registers and Multicast Table Array.
  1086. * The caller must have a packed mc_addr_list of multicast addresses.
  1087. * The parameter rar_count will usually be hw->mac.rar_entry_count
  1088. * unless there are workarounds that change this.
  1089. **/
  1090. static void e1000_update_mc_addr_list_82571(struct e1000_hw *hw,
  1091. u8 *mc_addr_list,
  1092. u32 mc_addr_count,
  1093. u32 rar_used_count,
  1094. u32 rar_count)
  1095. {
  1096. if (e1000e_get_laa_state_82571(hw))
  1097. rar_count--;
  1098. e1000e_update_mc_addr_list_generic(hw, mc_addr_list, mc_addr_count,
  1099. rar_used_count, rar_count);
  1100. }
  1101. /**
  1102. * e1000_setup_link_82571 - Setup flow control and link settings
  1103. * @hw: pointer to the HW structure
  1104. *
  1105. * Determines which flow control settings to use, then configures flow
  1106. * control. Calls the appropriate media-specific link configuration
  1107. * function. Assuming the adapter has a valid link partner, a valid link
  1108. * should be established. Assumes the hardware has previously been reset
  1109. * and the transmitter and receiver are not enabled.
  1110. **/
  1111. static s32 e1000_setup_link_82571(struct e1000_hw *hw)
  1112. {
  1113. /*
  1114. * 82573 does not have a word in the NVM to determine
  1115. * the default flow control setting, so we explicitly
  1116. * set it to full.
  1117. */
  1118. switch (hw->mac.type) {
  1119. case e1000_82573:
  1120. case e1000_82574:
  1121. case e1000_82583:
  1122. if (hw->fc.requested_mode == e1000_fc_default)
  1123. hw->fc.requested_mode = e1000_fc_full;
  1124. break;
  1125. default:
  1126. break;
  1127. }
  1128. return e1000e_setup_link(hw);
  1129. }
  1130. /**
  1131. * e1000_setup_copper_link_82571 - Configure copper link settings
  1132. * @hw: pointer to the HW structure
  1133. *
  1134. * Configures the link for auto-neg or forced speed and duplex. Then we check
  1135. * for link, once link is established calls to configure collision distance
  1136. * and flow control are called.
  1137. **/
  1138. static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw)
  1139. {
  1140. u32 ctrl;
  1141. s32 ret_val;
  1142. ctrl = er32(CTRL);
  1143. ctrl |= E1000_CTRL_SLU;
  1144. ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX);
  1145. ew32(CTRL, ctrl);
  1146. switch (hw->phy.type) {
  1147. case e1000_phy_m88:
  1148. case e1000_phy_bm:
  1149. ret_val = e1000e_copper_link_setup_m88(hw);
  1150. break;
  1151. case e1000_phy_igp_2:
  1152. ret_val = e1000e_copper_link_setup_igp(hw);
  1153. break;
  1154. default:
  1155. return -E1000_ERR_PHY;
  1156. break;
  1157. }
  1158. if (ret_val)
  1159. return ret_val;
  1160. ret_val = e1000e_setup_copper_link(hw);
  1161. return ret_val;
  1162. }
  1163. /**
  1164. * e1000_setup_fiber_serdes_link_82571 - Setup link for fiber/serdes
  1165. * @hw: pointer to the HW structure
  1166. *
  1167. * Configures collision distance and flow control for fiber and serdes links.
  1168. * Upon successful setup, poll for link.
  1169. **/
  1170. static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw)
  1171. {
  1172. switch (hw->mac.type) {
  1173. case e1000_82571:
  1174. case e1000_82572:
  1175. /*
  1176. * If SerDes loopback mode is entered, there is no form
  1177. * of reset to take the adapter out of that mode. So we
  1178. * have to explicitly take the adapter out of loopback
  1179. * mode. This prevents drivers from twiddling their thumbs
  1180. * if another tool failed to take it out of loopback mode.
  1181. */
  1182. ew32(SCTL, E1000_SCTL_DISABLE_SERDES_LOOPBACK);
  1183. break;
  1184. default:
  1185. break;
  1186. }
  1187. return e1000e_setup_fiber_serdes_link(hw);
  1188. }
  1189. /**
  1190. * e1000_check_for_serdes_link_82571 - Check for link (Serdes)
  1191. * @hw: pointer to the HW structure
  1192. *
  1193. * Reports the link state as up or down.
  1194. *
  1195. * If autonegotiation is supported by the link partner, the link state is
  1196. * determined by the result of autonegotiation. This is the most likely case.
  1197. * If autonegotiation is not supported by the link partner, and the link
  1198. * has a valid signal, force the link up.
  1199. *
  1200. * The link state is represented internally here by 4 states:
  1201. *
  1202. * 1) down
  1203. * 2) autoneg_progress
  1204. * 3) autoneg_complete (the link sucessfully autonegotiated)
  1205. * 4) forced_up (the link has been forced up, it did not autonegotiate)
  1206. *
  1207. **/
  1208. static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)
  1209. {
  1210. struct e1000_mac_info *mac = &hw->mac;
  1211. u32 rxcw;
  1212. u32 ctrl;
  1213. u32 status;
  1214. s32 ret_val = 0;
  1215. ctrl = er32(CTRL);
  1216. status = er32(STATUS);
  1217. rxcw = er32(RXCW);
  1218. if ((rxcw & E1000_RXCW_SYNCH) && !(rxcw & E1000_RXCW_IV)) {
  1219. /* Receiver is synchronized with no invalid bits. */
  1220. switch (mac->serdes_link_state) {
  1221. case e1000_serdes_link_autoneg_complete:
  1222. if (!(status & E1000_STATUS_LU)) {
  1223. /*
  1224. * We have lost link, retry autoneg before
  1225. * reporting link failure
  1226. */
  1227. mac->serdes_link_state =
  1228. e1000_serdes_link_autoneg_progress;
  1229. mac->serdes_has_link = false;
  1230. e_dbg("AN_UP -> AN_PROG\n");
  1231. }
  1232. break;
  1233. case e1000_serdes_link_forced_up:
  1234. /*
  1235. * If we are receiving /C/ ordered sets, re-enable
  1236. * auto-negotiation in the TXCW register and disable
  1237. * forced link in the Device Control register in an
  1238. * attempt to auto-negotiate with our link partner.
  1239. */
  1240. if (rxcw & E1000_RXCW_C) {
  1241. /* Enable autoneg, and unforce link up */
  1242. ew32(TXCW, mac->txcw);
  1243. ew32(CTRL, (ctrl & ~E1000_CTRL_SLU));
  1244. mac->serdes_link_state =
  1245. e1000_serdes_link_autoneg_progress;
  1246. mac->serdes_has_link = false;
  1247. e_dbg("FORCED_UP -> AN_PROG\n");
  1248. }
  1249. break;
  1250. case e1000_serdes_link_autoneg_progress:
  1251. if (rxcw & E1000_RXCW_C) {
  1252. /*
  1253. * We received /C/ ordered sets, meaning the
  1254. * link partner has autonegotiated, and we can
  1255. * trust the Link Up (LU) status bit.
  1256. */
  1257. if (status & E1000_STATUS_LU) {
  1258. mac->serdes_link_state =
  1259. e1000_serdes_link_autoneg_complete;
  1260. e_dbg("AN_PROG -> AN_UP\n");
  1261. mac->serdes_has_link = true;
  1262. } else {
  1263. /* Autoneg completed, but failed. */
  1264. mac->serdes_link_state =
  1265. e1000_serdes_link_down;
  1266. e_dbg("AN_PROG -> DOWN\n");
  1267. }
  1268. } else {
  1269. /*
  1270. * The link partner did not autoneg.
  1271. * Force link up and full duplex, and change
  1272. * state to forced.
  1273. */
  1274. ew32(TXCW, (mac->txcw & ~E1000_TXCW_ANE));
  1275. ctrl |= (E1000_CTRL_SLU | E1000_CTRL_FD);
  1276. ew32(CTRL, ctrl);
  1277. /* Configure Flow Control after link up. */
  1278. ret_val = e1000e_config_fc_after_link_up(hw);
  1279. if (ret_val) {
  1280. e_dbg("Error config flow control\n");
  1281. break;
  1282. }
  1283. mac->serdes_link_state =
  1284. e1000_serdes_link_forced_up;
  1285. mac->serdes_has_link = true;
  1286. e_dbg("AN_PROG -> FORCED_UP\n");
  1287. }
  1288. break;
  1289. case e1000_serdes_link_down:
  1290. default:
  1291. /*
  1292. * The link was down but the receiver has now gained
  1293. * valid sync, so lets see if we can bring the link
  1294. * up.
  1295. */
  1296. ew32(TXCW, mac->txcw);
  1297. ew32(CTRL, (ctrl & ~E1000_CTRL_SLU));
  1298. mac->serdes_link_state =
  1299. e1000_serdes_link_autoneg_progress;
  1300. e_dbg("DOWN -> AN_PROG\n");
  1301. break;
  1302. }
  1303. } else {
  1304. if (!(rxcw & E1000_RXCW_SYNCH)) {
  1305. mac->serdes_has_link = false;
  1306. mac->serdes_link_state = e1000_serdes_link_down;
  1307. e_dbg("ANYSTATE -> DOWN\n");
  1308. } else {
  1309. /*
  1310. * We have sync, and can tolerate one invalid (IV)
  1311. * codeword before declaring link down, so reread
  1312. * to look again.
  1313. */
  1314. udelay(10);
  1315. rxcw = er32(RXCW);
  1316. if (rxcw & E1000_RXCW_IV) {
  1317. mac->serdes_link_state = e1000_serdes_link_down;
  1318. mac->serdes_has_link = false;
  1319. e_dbg("ANYSTATE -> DOWN\n");
  1320. }
  1321. }
  1322. }
  1323. return ret_val;
  1324. }
  1325. /**
  1326. * e1000_valid_led_default_82571 - Verify a valid default LED config
  1327. * @hw: pointer to the HW structure
  1328. * @data: pointer to the NVM (EEPROM)
  1329. *
  1330. * Read the EEPROM for the current default LED configuration. If the
  1331. * LED configuration is not valid, set to a valid LED configuration.
  1332. **/
  1333. static s32 e1000_valid_led_default_82571(struct e1000_hw *hw, u16 *data)
  1334. {
  1335. s32 ret_val;
  1336. ret_val = e1000_read_nvm(hw, NVM_ID_LED_SETTINGS, 1, data);
  1337. if (ret_val) {
  1338. e_dbg("NVM Read Error\n");
  1339. return ret_val;
  1340. }
  1341. switch (hw->mac.type) {
  1342. case e1000_82573:
  1343. case e1000_82574:
  1344. case e1000_82583:
  1345. if (*data == ID_LED_RESERVED_F746)
  1346. *data = ID_LED_DEFAULT_82573;
  1347. break;
  1348. default:
  1349. if (*data == ID_LED_RESERVED_0000 ||
  1350. *data == ID_LED_RESERVED_FFFF)
  1351. *data = ID_LED_DEFAULT;
  1352. break;
  1353. }
  1354. return 0;
  1355. }
  1356. /**
  1357. * e1000e_get_laa_state_82571 - Get locally administered address state
  1358. * @hw: pointer to the HW structure
  1359. *
  1360. * Retrieve and return the current locally administered address state.
  1361. **/
  1362. bool e1000e_get_laa_state_82571(struct e1000_hw *hw)
  1363. {
  1364. if (hw->mac.type != e1000_82571)
  1365. return false;
  1366. return hw->dev_spec.e82571.laa_is_present;
  1367. }
  1368. /**
  1369. * e1000e_set_laa_state_82571 - Set locally administered address state
  1370. * @hw: pointer to the HW structure
  1371. * @state: enable/disable locally administered address
  1372. *
  1373. * Enable/Disable the current locally administered address state.
  1374. **/
  1375. void e1000e_set_laa_state_82571(struct e1000_hw *hw, bool state)
  1376. {
  1377. if (hw->mac.type != e1000_82571)
  1378. return;
  1379. hw->dev_spec.e82571.laa_is_present = state;
  1380. /* If workaround is activated... */
  1381. if (state)
  1382. /*
  1383. * Hold a copy of the LAA in RAR[14] This is done so that
  1384. * between the time RAR[0] gets clobbered and the time it
  1385. * gets fixed, the actual LAA is in one of the RARs and no
  1386. * incoming packets directed to this port are dropped.
  1387. * Eventually the LAA will be in RAR[0] and RAR[14].
  1388. */
  1389. e1000e_rar_set(hw, hw->mac.addr, hw->mac.rar_entry_count - 1);
  1390. }
  1391. /**
  1392. * e1000_fix_nvm_checksum_82571 - Fix EEPROM checksum
  1393. * @hw: pointer to the HW structure
  1394. *
  1395. * Verifies that the EEPROM has completed the update. After updating the
  1396. * EEPROM, we need to check bit 15 in work 0x23 for the checksum fix. If
  1397. * the checksum fix is not implemented, we need to set the bit and update
  1398. * the checksum. Otherwise, if bit 15 is set and the checksum is incorrect,
  1399. * we need to return bad checksum.
  1400. **/
  1401. static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw)
  1402. {
  1403. struct e1000_nvm_info *nvm = &hw->nvm;
  1404. s32 ret_val;
  1405. u16 data;
  1406. if (nvm->type != e1000_nvm_flash_hw)
  1407. return 0;
  1408. /*
  1409. * Check bit 4 of word 10h. If it is 0, firmware is done updating
  1410. * 10h-12h. Checksum may need to be fixed.
  1411. */
  1412. ret_val = e1000_read_nvm(hw, 0x10, 1, &data);
  1413. if (ret_val)
  1414. return ret_val;
  1415. if (!(data & 0x10)) {
  1416. /*
  1417. * Read 0x23 and check bit 15. This bit is a 1
  1418. * when the checksum has already been fixed. If
  1419. * the checksum is still wrong and this bit is a
  1420. * 1, we need to return bad checksum. Otherwise,
  1421. * we need to set this bit to a 1 and update the
  1422. * checksum.
  1423. */
  1424. ret_val = e1000_read_nvm(hw, 0x23, 1, &data);
  1425. if (ret_val)
  1426. return ret_val;
  1427. if (!(data & 0x8000)) {
  1428. data |= 0x8000;
  1429. ret_val = e1000_write_nvm(hw, 0x23, 1, &data);
  1430. if (ret_val)
  1431. return ret_val;
  1432. ret_val = e1000e_update_nvm_checksum(hw);
  1433. }
  1434. }
  1435. return 0;
  1436. }
  1437. /**
  1438. * e1000_power_down_phy_copper_82571 - Remove link during PHY power down
  1439. * @hw: pointer to the HW structure
  1440. *
  1441. * In the case of a PHY power down to save power, or to turn off link during a
  1442. * driver unload, or wake on lan is not enabled, remove the link.
  1443. **/
  1444. static void e1000_power_down_phy_copper_82571(struct e1000_hw *hw)
  1445. {
  1446. struct e1000_phy_info *phy = &hw->phy;
  1447. struct e1000_mac_info *mac = &hw->mac;
  1448. if (!(phy->ops.check_reset_block))
  1449. return;
  1450. /* If the management interface is not enabled, then power down */
  1451. if (!(mac->ops.check_mng_mode(hw) || phy->ops.check_reset_block(hw)))
  1452. e1000_power_down_phy_copper(hw);
  1453. return;
  1454. }
  1455. /**
  1456. * e1000_clear_hw_cntrs_82571 - Clear device specific hardware counters
  1457. * @hw: pointer to the HW structure
  1458. *
  1459. * Clears the hardware counters by reading the counter registers.
  1460. **/
  1461. static void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw)
  1462. {
  1463. e1000e_clear_hw_cntrs_base(hw);
  1464. er32(PRC64);
  1465. er32(PRC127);
  1466. er32(PRC255);
  1467. er32(PRC511);
  1468. er32(PRC1023);
  1469. er32(PRC1522);
  1470. er32(PTC64);
  1471. er32(PTC127);
  1472. er32(PTC255);
  1473. er32(PTC511);
  1474. er32(PTC1023);
  1475. er32(PTC1522);
  1476. er32(ALGNERRC);
  1477. er32(RXERRC);
  1478. er32(TNCRS);
  1479. er32(CEXTERR);
  1480. er32(TSCTC);
  1481. er32(TSCTFC);
  1482. er32(MGTPRC);
  1483. er32(MGTPDC);
  1484. er32(MGTPTC);
  1485. er32(IAC);
  1486. er32(ICRXOC);
  1487. er32(ICRXPTC);
  1488. er32(ICRXATC);
  1489. er32(ICTXPTC);
  1490. er32(ICTXATC);
  1491. er32(ICTXQEC);
  1492. er32(ICTXQMTC);
  1493. er32(ICRXDMTC);
  1494. }
  1495. static struct e1000_mac_operations e82571_mac_ops = {
  1496. /* .check_mng_mode: mac type dependent */
  1497. /* .check_for_link: media type dependent */
  1498. .id_led_init = e1000e_id_led_init,
  1499. .cleanup_led = e1000e_cleanup_led_generic,
  1500. .clear_hw_cntrs = e1000_clear_hw_cntrs_82571,
  1501. .get_bus_info = e1000e_get_bus_info_pcie,
  1502. /* .get_link_up_info: media type dependent */
  1503. /* .led_on: mac type dependent */
  1504. .led_off = e1000e_led_off_generic,
  1505. .update_mc_addr_list = e1000_update_mc_addr_list_82571,
  1506. .write_vfta = e1000_write_vfta_generic,
  1507. .clear_vfta = e1000_clear_vfta_82571,
  1508. .reset_hw = e1000_reset_hw_82571,
  1509. .init_hw = e1000_init_hw_82571,
  1510. .setup_link = e1000_setup_link_82571,
  1511. /* .setup_physical_interface: media type dependent */
  1512. .setup_led = e1000e_setup_led_generic,
  1513. };
  1514. static struct e1000_phy_operations e82_phy_ops_igp = {
  1515. .acquire = e1000_get_hw_semaphore_82571,
  1516. .check_polarity = e1000_check_polarity_igp,
  1517. .check_reset_block = e1000e_check_reset_block_generic,
  1518. .commit = NULL,
  1519. .force_speed_duplex = e1000e_phy_force_speed_duplex_igp,
  1520. .get_cfg_done = e1000_get_cfg_done_82571,
  1521. .get_cable_length = e1000e_get_cable_length_igp_2,
  1522. .get_info = e1000e_get_phy_info_igp,
  1523. .read_reg = e1000e_read_phy_reg_igp,
  1524. .release = e1000_put_hw_semaphore_82571,
  1525. .reset = e1000e_phy_hw_reset_generic,
  1526. .set_d0_lplu_state = e1000_set_d0_lplu_state_82571,
  1527. .set_d3_lplu_state = e1000e_set_d3_lplu_state,
  1528. .write_reg = e1000e_write_phy_reg_igp,
  1529. .cfg_on_link_up = NULL,
  1530. };
  1531. static struct e1000_phy_operations e82_phy_ops_m88 = {
  1532. .acquire = e1000_get_hw_semaphore_82571,
  1533. .check_polarity = e1000_check_polarity_m88,
  1534. .check_reset_block = e1000e_check_reset_block_generic,
  1535. .commit = e1000e_phy_sw_reset,
  1536. .force_speed_duplex = e1000e_phy_force_speed_duplex_m88,
  1537. .get_cfg_done = e1000e_get_cfg_done,
  1538. .get_cable_length = e1000e_get_cable_length_m88,
  1539. .get_info = e1000e_get_phy_info_m88,
  1540. .read_reg = e1000e_read_phy_reg_m88,
  1541. .release = e1000_put_hw_semaphore_82571,
  1542. .reset = e1000e_phy_hw_reset_generic,
  1543. .set_d0_lplu_state = e1000_set_d0_lplu_state_82571,
  1544. .set_d3_lplu_state = e1000e_set_d3_lplu_state,
  1545. .write_reg = e1000e_write_phy_reg_m88,
  1546. .cfg_on_link_up = NULL,
  1547. };
  1548. static struct e1000_phy_operations e82_phy_ops_bm = {
  1549. .acquire = e1000_get_hw_semaphore_82571,
  1550. .check_polarity = e1000_check_polarity_m88,
  1551. .check_reset_block = e1000e_check_reset_block_generic,
  1552. .commit = e1000e_phy_sw_reset,
  1553. .force_speed_duplex = e1000e_phy_force_speed_duplex_m88,
  1554. .get_cfg_done = e1000e_get_cfg_done,
  1555. .get_cable_length = e1000e_get_cable_length_m88,
  1556. .get_info = e1000e_get_phy_info_m88,
  1557. .read_reg = e1000e_read_phy_reg_bm2,
  1558. .release = e1000_put_hw_semaphore_82571,
  1559. .reset = e1000e_phy_hw_reset_generic,
  1560. .set_d0_lplu_state = e1000_set_d0_lplu_state_82571,
  1561. .set_d3_lplu_state = e1000e_set_d3_lplu_state,
  1562. .write_reg = e1000e_write_phy_reg_bm2,
  1563. .cfg_on_link_up = NULL,
  1564. };
  1565. static struct e1000_nvm_operations e82571_nvm_ops = {
  1566. .acquire = e1000_acquire_nvm_82571,
  1567. .read = e1000e_read_nvm_eerd,
  1568. .release = e1000_release_nvm_82571,
  1569. .update = e1000_update_nvm_checksum_82571,
  1570. .valid_led_default = e1000_valid_led_default_82571,
  1571. .validate = e1000_validate_nvm_checksum_82571,
  1572. .write = e1000_write_nvm_82571,
  1573. };
  1574. struct e1000_info e1000_82571_info = {
  1575. .mac = e1000_82571,
  1576. .flags = FLAG_HAS_HW_VLAN_FILTER
  1577. | FLAG_HAS_JUMBO_FRAMES
  1578. | FLAG_HAS_WOL
  1579. | FLAG_APME_IN_CTRL3
  1580. | FLAG_RX_CSUM_ENABLED
  1581. | FLAG_HAS_CTRLEXT_ON_LOAD
  1582. | FLAG_HAS_SMART_POWER_DOWN
  1583. | FLAG_RESET_OVERWRITES_LAA /* errata */
  1584. | FLAG_TARC_SPEED_MODE_BIT /* errata */
  1585. | FLAG_APME_CHECK_PORT_B,
  1586. .pba = 38,
  1587. .max_hw_frame_size = DEFAULT_JUMBO,
  1588. .get_variants = e1000_get_variants_82571,
  1589. .mac_ops = &e82571_mac_ops,
  1590. .phy_ops = &e82_phy_ops_igp,
  1591. .nvm_ops = &e82571_nvm_ops,
  1592. };
  1593. struct e1000_info e1000_82572_info = {
  1594. .mac = e1000_82572,
  1595. .flags = FLAG_HAS_HW_VLAN_FILTER
  1596. | FLAG_HAS_JUMBO_FRAMES
  1597. | FLAG_HAS_WOL
  1598. | FLAG_APME_IN_CTRL3
  1599. | FLAG_RX_CSUM_ENABLED
  1600. | FLAG_HAS_CTRLEXT_ON_LOAD
  1601. | FLAG_TARC_SPEED_MODE_BIT, /* errata */
  1602. .pba = 38,
  1603. .max_hw_frame_size = DEFAULT_JUMBO,
  1604. .get_variants = e1000_get_variants_82571,
  1605. .mac_ops = &e82571_mac_ops,
  1606. .phy_ops = &e82_phy_ops_igp,
  1607. .nvm_ops = &e82571_nvm_ops,
  1608. };
  1609. struct e1000_info e1000_82573_info = {
  1610. .mac = e1000_82573,
  1611. .flags = FLAG_HAS_HW_VLAN_FILTER
  1612. | FLAG_HAS_JUMBO_FRAMES
  1613. | FLAG_HAS_WOL
  1614. | FLAG_APME_IN_CTRL3
  1615. | FLAG_RX_CSUM_ENABLED
  1616. | FLAG_HAS_SMART_POWER_DOWN
  1617. | FLAG_HAS_AMT
  1618. | FLAG_HAS_ERT
  1619. | FLAG_HAS_SWSM_ON_LOAD,
  1620. .pba = 20,
  1621. .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN,
  1622. .get_variants = e1000_get_variants_82571,
  1623. .mac_ops = &e82571_mac_ops,
  1624. .phy_ops = &e82_phy_ops_m88,
  1625. .nvm_ops = &e82571_nvm_ops,
  1626. };
  1627. struct e1000_info e1000_82574_info = {
  1628. .mac = e1000_82574,
  1629. .flags = FLAG_HAS_HW_VLAN_FILTER
  1630. | FLAG_HAS_MSIX
  1631. | FLAG_HAS_JUMBO_FRAMES
  1632. | FLAG_HAS_WOL
  1633. | FLAG_APME_IN_CTRL3
  1634. | FLAG_RX_CSUM_ENABLED
  1635. | FLAG_HAS_SMART_POWER_DOWN
  1636. | FLAG_HAS_AMT
  1637. | FLAG_HAS_CTRLEXT_ON_LOAD,
  1638. .pba = 20,
  1639. .max_hw_frame_size = DEFAULT_JUMBO,
  1640. .get_variants = e1000_get_variants_82571,
  1641. .mac_ops = &e82571_mac_ops,
  1642. .phy_ops = &e82_phy_ops_bm,
  1643. .nvm_ops = &e82571_nvm_ops,
  1644. };
  1645. struct e1000_info e1000_82583_info = {
  1646. .mac = e1000_82583,
  1647. .flags = FLAG_HAS_HW_VLAN_FILTER
  1648. | FLAG_HAS_WOL
  1649. | FLAG_APME_IN_CTRL3
  1650. | FLAG_RX_CSUM_ENABLED
  1651. | FLAG_HAS_SMART_POWER_DOWN
  1652. | FLAG_HAS_AMT
  1653. | FLAG_HAS_CTRLEXT_ON_LOAD,
  1654. .pba = 20,
  1655. .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN,
  1656. .get_variants = e1000_get_variants_82571,
  1657. .mac_ops = &e82571_mac_ops,
  1658. .phy_ops = &e82_phy_ops_bm,
  1659. .nvm_ops = &e82571_nvm_ops,
  1660. };