82571.c 47 KB

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