82571.c 49 KB

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