82571.c 49 KB

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