82571.c 47 KB

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