82571.c 47 KB

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