82571.c 48 KB

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