1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2001-2020 Intel Corporation
8 * igc_get_i2c_data - Reads the I2C SDA data bit
9 * @i2cctl: Current value of I2CCTL register
11 * Returns the I2C data bit value
13 static bool igc_get_i2c_data(u32 *i2cctl)
17 DEBUGFUNC("igc_get_i2c_data");
19 if (*i2cctl & IGC_I2C_DATA_IN)
28 * igc_set_i2c_data - Sets the I2C data bit
29 * @hw: pointer to hardware structure
30 * @i2cctl: Current value of I2CCTL register
31 * @data: I2C data value (0 or 1) to set
33 * Sets the I2C data bit
35 static s32 igc_set_i2c_data(struct igc_hw *hw, u32 *i2cctl, bool data)
37 s32 status = IGC_SUCCESS;
39 DEBUGFUNC("igc_set_i2c_data");
42 *i2cctl |= IGC_I2C_DATA_OUT;
44 *i2cctl &= ~IGC_I2C_DATA_OUT;
46 *i2cctl &= ~IGC_I2C_DATA_OE_N;
47 *i2cctl |= IGC_I2C_CLK_OE_N;
48 IGC_WRITE_REG(hw, IGC_I2CPARAMS, *i2cctl);
51 /* Data rise/fall (1000ns/300ns) and set-up time (250ns) */
52 usec_delay(IGC_I2C_T_RISE + IGC_I2C_T_FALL + IGC_I2C_T_SU_DATA);
54 *i2cctl = IGC_READ_REG(hw, IGC_I2CPARAMS);
55 if (data != igc_get_i2c_data(i2cctl)) {
57 DEBUGOUT1("Error - I2C data was not set to %X.\n", data);
64 * igc_raise_i2c_clk - Raises the I2C SCL clock
65 * @hw: pointer to hardware structure
66 * @i2cctl: Current value of I2CCTL register
68 * Raises the I2C clock line '0'->'1'
70 static void igc_raise_i2c_clk(struct igc_hw *hw, u32 *i2cctl)
72 DEBUGFUNC("igc_raise_i2c_clk");
74 *i2cctl |= IGC_I2C_CLK_OUT;
75 *i2cctl &= ~IGC_I2C_CLK_OE_N;
76 IGC_WRITE_REG(hw, IGC_I2CPARAMS, *i2cctl);
79 /* SCL rise time (1000ns) */
80 usec_delay(IGC_I2C_T_RISE);
84 * igc_lower_i2c_clk - Lowers the I2C SCL clock
85 * @hw: pointer to hardware structure
86 * @i2cctl: Current value of I2CCTL register
88 * Lowers the I2C clock line '1'->'0'
90 static void igc_lower_i2c_clk(struct igc_hw *hw, u32 *i2cctl)
92 DEBUGFUNC("igc_lower_i2c_clk");
94 *i2cctl &= ~IGC_I2C_CLK_OUT;
95 *i2cctl &= ~IGC_I2C_CLK_OE_N;
96 IGC_WRITE_REG(hw, IGC_I2CPARAMS, *i2cctl);
99 /* SCL fall time (300ns) */
100 usec_delay(IGC_I2C_T_FALL);
104 * igc_i2c_start - Sets I2C start condition
105 * @hw: pointer to hardware structure
107 * Sets I2C start condition (High -> Low on SDA while SCL is High)
109 static void igc_i2c_start(struct igc_hw *hw)
111 u32 i2cctl = IGC_READ_REG(hw, IGC_I2CPARAMS);
113 DEBUGFUNC("igc_i2c_start");
115 /* Start condition must begin with data and clock high */
116 igc_set_i2c_data(hw, &i2cctl, 1);
117 igc_raise_i2c_clk(hw, &i2cctl);
119 /* Setup time for start condition (4.7us) */
120 usec_delay(IGC_I2C_T_SU_STA);
122 igc_set_i2c_data(hw, &i2cctl, 0);
124 /* Hold time for start condition (4us) */
125 usec_delay(IGC_I2C_T_HD_STA);
127 igc_lower_i2c_clk(hw, &i2cctl);
129 /* Minimum low period of clock is 4.7 us */
130 usec_delay(IGC_I2C_T_LOW);
134 * igc_i2c_stop - Sets I2C stop condition
135 * @hw: pointer to hardware structure
137 * Sets I2C stop condition (Low -> High on SDA while SCL is High)
139 static void igc_i2c_stop(struct igc_hw *hw)
141 u32 i2cctl = IGC_READ_REG(hw, IGC_I2CPARAMS);
143 DEBUGFUNC("igc_i2c_stop");
145 /* Stop condition must begin with data low and clock high */
146 igc_set_i2c_data(hw, &i2cctl, 0);
147 igc_raise_i2c_clk(hw, &i2cctl);
149 /* Setup time for stop condition (4us) */
150 usec_delay(IGC_I2C_T_SU_STO);
152 igc_set_i2c_data(hw, &i2cctl, 1);
154 /* bus free time between stop and start (4.7us)*/
155 usec_delay(IGC_I2C_T_BUF);
159 * igc_clock_in_i2c_bit - Clocks in one bit via I2C data/clock
160 * @hw: pointer to hardware structure
161 * @data: read data value
163 * Clocks in one bit via I2C data/clock
165 static void igc_clock_in_i2c_bit(struct igc_hw *hw, bool *data)
167 u32 i2cctl = IGC_READ_REG(hw, IGC_I2CPARAMS);
169 DEBUGFUNC("igc_clock_in_i2c_bit");
171 igc_raise_i2c_clk(hw, &i2cctl);
173 /* Minimum high period of clock is 4us */
174 usec_delay(IGC_I2C_T_HIGH);
176 i2cctl = IGC_READ_REG(hw, IGC_I2CPARAMS);
177 *data = igc_get_i2c_data(&i2cctl);
179 igc_lower_i2c_clk(hw, &i2cctl);
181 /* Minimum low period of clock is 4.7 us */
182 usec_delay(IGC_I2C_T_LOW);
186 * igc_clock_in_i2c_byte - Clocks in one byte via I2C
187 * @hw: pointer to hardware structure
188 * @data: data byte to clock in
190 * Clocks in one byte data via I2C data/clock
192 static void igc_clock_in_i2c_byte(struct igc_hw *hw, u8 *data)
197 DEBUGFUNC("igc_clock_in_i2c_byte");
200 for (i = 7; i >= 0; i--) {
201 igc_clock_in_i2c_bit(hw, &bit);
207 * igc_clock_out_i2c_bit - Clocks in/out one bit via I2C data/clock
208 * @hw: pointer to hardware structure
209 * @data: data value to write
211 * Clocks out one bit via I2C data/clock
213 static s32 igc_clock_out_i2c_bit(struct igc_hw *hw, bool data)
216 u32 i2cctl = IGC_READ_REG(hw, IGC_I2CPARAMS);
218 DEBUGFUNC("igc_clock_out_i2c_bit");
220 status = igc_set_i2c_data(hw, &i2cctl, data);
221 if (status == IGC_SUCCESS) {
222 igc_raise_i2c_clk(hw, &i2cctl);
224 /* Minimum high period of clock is 4us */
225 usec_delay(IGC_I2C_T_HIGH);
227 igc_lower_i2c_clk(hw, &i2cctl);
229 /* Minimum low period of clock is 4.7 us.
230 * This also takes care of the data hold time.
232 usec_delay(IGC_I2C_T_LOW);
234 status = IGC_ERR_I2C;
235 DEBUGOUT1("I2C data was not set to %X\n", data);
242 * igc_clock_out_i2c_byte - Clocks out one byte via I2C
243 * @hw: pointer to hardware structure
244 * @data: data byte clocked out
246 * Clocks out one byte data via I2C data/clock
248 static s32 igc_clock_out_i2c_byte(struct igc_hw *hw, u8 data)
250 s32 status = IGC_SUCCESS;
255 DEBUGFUNC("igc_clock_out_i2c_byte");
257 for (i = 7; i >= 0; i--) {
258 bit = (data >> i) & 0x1;
259 status = igc_clock_out_i2c_bit(hw, bit);
261 if (status != IGC_SUCCESS)
265 /* Release SDA line (set high) */
266 i2cctl = IGC_READ_REG(hw, IGC_I2CPARAMS);
268 i2cctl |= IGC_I2C_DATA_OE_N;
269 IGC_WRITE_REG(hw, IGC_I2CPARAMS, i2cctl);
276 * igc_get_i2c_ack - Polls for I2C ACK
277 * @hw: pointer to hardware structure
279 * Clocks in/out one bit via I2C data/clock
281 static s32 igc_get_i2c_ack(struct igc_hw *hw)
283 s32 status = IGC_SUCCESS;
285 u32 i2cctl = IGC_READ_REG(hw, IGC_I2CPARAMS);
289 DEBUGFUNC("igc_get_i2c_ack");
291 igc_raise_i2c_clk(hw, &i2cctl);
293 /* Minimum high period of clock is 4us */
294 usec_delay(IGC_I2C_T_HIGH);
296 /* Wait until SCL returns high */
297 for (i = 0; i < timeout; i++) {
299 i2cctl = IGC_READ_REG(hw, IGC_I2CPARAMS);
300 if (i2cctl & IGC_I2C_CLK_IN)
303 if (!(i2cctl & IGC_I2C_CLK_IN))
306 ack = igc_get_i2c_data(&i2cctl);
308 DEBUGOUT("I2C ack was not received.\n");
309 status = IGC_ERR_I2C;
312 igc_lower_i2c_clk(hw, &i2cctl);
314 /* Minimum low period of clock is 4.7 us */
315 usec_delay(IGC_I2C_T_LOW);
321 * igc_set_i2c_bb - Enable I2C bit-bang
322 * @hw: pointer to the HW structure
324 * Enable I2C bit-bang interface
327 s32 igc_set_i2c_bb(struct igc_hw *hw)
329 s32 ret_val = IGC_SUCCESS;
330 u32 ctrl_ext, i2cparams;
332 DEBUGFUNC("igc_set_i2c_bb");
334 ctrl_ext = IGC_READ_REG(hw, IGC_CTRL_EXT);
335 ctrl_ext |= IGC_CTRL_I2C_ENA;
336 IGC_WRITE_REG(hw, IGC_CTRL_EXT, ctrl_ext);
339 i2cparams = IGC_READ_REG(hw, IGC_I2CPARAMS);
340 i2cparams |= IGC_I2CBB_EN;
341 i2cparams |= IGC_I2C_DATA_OE_N;
342 i2cparams |= IGC_I2C_CLK_OE_N;
343 IGC_WRITE_REG(hw, IGC_I2CPARAMS, i2cparams);
350 * igc_read_i2c_byte_generic - Reads 8 bit word over I2C
351 * @hw: pointer to hardware structure
352 * @byte_offset: byte offset to read
353 * @dev_addr: device address
356 * Performs byte read operation over I2C interface at
357 * a specified device address.
359 s32 igc_read_i2c_byte_generic(struct igc_hw *hw, u8 byte_offset,
360 u8 dev_addr, u8 *data)
362 s32 status = IGC_SUCCESS;
369 DEBUGFUNC("igc_read_i2c_byte_generic");
371 swfw_mask = IGC_SWFW_PHY0_SM;
374 if (hw->mac.ops.acquire_swfw_sync(hw, swfw_mask)
376 status = IGC_ERR_SWFW_SYNC;
382 /* Device Address and write indication */
383 status = igc_clock_out_i2c_byte(hw, dev_addr);
384 if (status != IGC_SUCCESS)
387 status = igc_get_i2c_ack(hw);
388 if (status != IGC_SUCCESS)
391 status = igc_clock_out_i2c_byte(hw, byte_offset);
392 if (status != IGC_SUCCESS)
395 status = igc_get_i2c_ack(hw);
396 if (status != IGC_SUCCESS)
401 /* Device Address and read indication */
402 status = igc_clock_out_i2c_byte(hw, (dev_addr | 0x1));
403 if (status != IGC_SUCCESS)
406 status = igc_get_i2c_ack(hw);
407 if (status != IGC_SUCCESS)
410 igc_clock_in_i2c_byte(hw, data);
412 status = igc_clock_out_i2c_bit(hw, nack);
413 if (status != IGC_SUCCESS)
420 hw->mac.ops.release_swfw_sync(hw, swfw_mask);
422 igc_i2c_bus_clear(hw);
424 if (retry < max_retry)
425 DEBUGOUT("I2C byte read error - Retrying.\n");
427 DEBUGOUT("I2C byte read error.\n");
429 } while (retry < max_retry);
431 hw->mac.ops.release_swfw_sync(hw, swfw_mask);
439 * igc_write_i2c_byte_generic - Writes 8 bit word over I2C
440 * @hw: pointer to hardware structure
441 * @byte_offset: byte offset to write
442 * @dev_addr: device address
443 * @data: value to write
445 * Performs byte write operation over I2C interface at
446 * a specified device address.
448 s32 igc_write_i2c_byte_generic(struct igc_hw *hw, u8 byte_offset,
449 u8 dev_addr, u8 data)
451 s32 status = IGC_SUCCESS;
456 DEBUGFUNC("igc_write_i2c_byte_generic");
458 swfw_mask = IGC_SWFW_PHY0_SM;
460 if (hw->mac.ops.acquire_swfw_sync(hw, swfw_mask) != IGC_SUCCESS) {
461 status = IGC_ERR_SWFW_SYNC;
468 status = igc_clock_out_i2c_byte(hw, dev_addr);
469 if (status != IGC_SUCCESS)
472 status = igc_get_i2c_ack(hw);
473 if (status != IGC_SUCCESS)
476 status = igc_clock_out_i2c_byte(hw, byte_offset);
477 if (status != IGC_SUCCESS)
480 status = igc_get_i2c_ack(hw);
481 if (status != IGC_SUCCESS)
484 status = igc_clock_out_i2c_byte(hw, data);
485 if (status != IGC_SUCCESS)
488 status = igc_get_i2c_ack(hw);
489 if (status != IGC_SUCCESS)
496 igc_i2c_bus_clear(hw);
498 if (retry < max_retry)
499 DEBUGOUT("I2C byte write error - Retrying.\n");
501 DEBUGOUT("I2C byte write error.\n");
502 } while (retry < max_retry);
504 hw->mac.ops.release_swfw_sync(hw, swfw_mask);
512 * igc_i2c_bus_clear - Clears the I2C bus
513 * @hw: pointer to hardware structure
515 * Clears the I2C bus by sending nine clock pulses.
516 * Used when data line is stuck low.
518 void igc_i2c_bus_clear(struct igc_hw *hw)
520 u32 i2cctl = IGC_READ_REG(hw, IGC_I2CPARAMS);
523 DEBUGFUNC("igc_i2c_bus_clear");
527 igc_set_i2c_data(hw, &i2cctl, 1);
529 for (i = 0; i < 9; i++) {
530 igc_raise_i2c_clk(hw, &i2cctl);
532 /* Min high period of clock is 4us */
533 usec_delay(IGC_I2C_T_HIGH);
535 igc_lower_i2c_clk(hw, &i2cctl);
537 /* Min low period of clock is 4.7us*/
538 usec_delay(IGC_I2C_T_LOW);
543 /* Put the i2c bus back to default state */
548 * igc_init_mac_params - Initialize MAC function pointers
549 * @hw: pointer to the HW structure
551 * This function initializes the function pointers for the MAC
552 * set of functions. Called by drivers or by igc_setup_init_funcs.
554 s32 igc_init_mac_params(struct igc_hw *hw)
556 s32 ret_val = IGC_SUCCESS;
558 if (hw->mac.ops.init_params) {
559 ret_val = hw->mac.ops.init_params(hw);
561 DEBUGOUT("MAC Initialization Error\n");
565 DEBUGOUT("mac.init_mac_params was NULL\n");
566 ret_val = -IGC_ERR_CONFIG;
574 * igc_init_nvm_params - Initialize NVM function pointers
575 * @hw: pointer to the HW structure
577 * This function initializes the function pointers for the NVM
578 * set of functions. Called by drivers or by igc_setup_init_funcs.
580 s32 igc_init_nvm_params(struct igc_hw *hw)
582 s32 ret_val = IGC_SUCCESS;
584 if (hw->nvm.ops.init_params) {
585 ret_val = hw->nvm.ops.init_params(hw);
587 DEBUGOUT("NVM Initialization Error\n");
591 DEBUGOUT("nvm.init_nvm_params was NULL\n");
592 ret_val = -IGC_ERR_CONFIG;
600 * igc_init_phy_params - Initialize PHY function pointers
601 * @hw: pointer to the HW structure
603 * This function initializes the function pointers for the PHY
604 * set of functions. Called by drivers or by igc_setup_init_funcs.
606 s32 igc_init_phy_params(struct igc_hw *hw)
608 s32 ret_val = IGC_SUCCESS;
610 if (hw->phy.ops.init_params) {
611 ret_val = hw->phy.ops.init_params(hw);
613 DEBUGOUT("PHY Initialization Error\n");
617 DEBUGOUT("phy.init_phy_params was NULL\n");
618 ret_val = -IGC_ERR_CONFIG;
626 * igc_init_mbx_params - Initialize mailbox function pointers
627 * @hw: pointer to the HW structure
629 * This function initializes the function pointers for the PHY
630 * set of functions. Called by drivers or by igc_setup_init_funcs.
632 s32 igc_init_mbx_params(struct igc_hw *hw)
634 s32 ret_val = IGC_SUCCESS;
636 if (hw->mbx.ops.init_params) {
637 ret_val = hw->mbx.ops.init_params(hw);
639 DEBUGOUT("Mailbox Initialization Error\n");
643 DEBUGOUT("mbx.init_mbx_params was NULL\n");
644 ret_val = -IGC_ERR_CONFIG;
652 * igc_set_mac_type - Sets MAC type
653 * @hw: pointer to the HW structure
655 * This function sets the mac type of the adapter based on the
656 * device ID stored in the hw structure.
657 * MUST BE FIRST FUNCTION CALLED (explicitly or through
658 * igc_setup_init_funcs()).
660 s32 igc_set_mac_type(struct igc_hw *hw)
662 struct igc_mac_info *mac = &hw->mac;
663 s32 ret_val = IGC_SUCCESS;
665 DEBUGFUNC("igc_set_mac_type");
667 switch (hw->device_id) {
668 case IGC_DEV_ID_82542:
669 mac->type = igc_82542;
671 case IGC_DEV_ID_82543GC_FIBER:
672 case IGC_DEV_ID_82543GC_COPPER:
673 mac->type = igc_82543;
675 case IGC_DEV_ID_82544EI_COPPER:
676 case IGC_DEV_ID_82544EI_FIBER:
677 case IGC_DEV_ID_82544GC_COPPER:
678 case IGC_DEV_ID_82544GC_LOM:
679 mac->type = igc_82544;
681 case IGC_DEV_ID_82540EM:
682 case IGC_DEV_ID_82540EM_LOM:
683 case IGC_DEV_ID_82540EP:
684 case IGC_DEV_ID_82540EP_LOM:
685 case IGC_DEV_ID_82540EP_LP:
686 mac->type = igc_82540;
688 case IGC_DEV_ID_82545EM_COPPER:
689 case IGC_DEV_ID_82545EM_FIBER:
690 mac->type = igc_82545;
692 case IGC_DEV_ID_82545GM_COPPER:
693 case IGC_DEV_ID_82545GM_FIBER:
694 case IGC_DEV_ID_82545GM_SERDES:
695 mac->type = igc_82545_rev_3;
697 case IGC_DEV_ID_82546EB_COPPER:
698 case IGC_DEV_ID_82546EB_FIBER:
699 case IGC_DEV_ID_82546EB_QUAD_COPPER:
700 mac->type = igc_82546;
702 case IGC_DEV_ID_82546GB_COPPER:
703 case IGC_DEV_ID_82546GB_FIBER:
704 case IGC_DEV_ID_82546GB_SERDES:
705 case IGC_DEV_ID_82546GB_PCIE:
706 case IGC_DEV_ID_82546GB_QUAD_COPPER:
707 case IGC_DEV_ID_82546GB_QUAD_COPPER_KSP3:
708 mac->type = igc_82546_rev_3;
710 case IGC_DEV_ID_82541EI:
711 case IGC_DEV_ID_82541EI_MOBILE:
712 case IGC_DEV_ID_82541ER_LOM:
713 mac->type = igc_82541;
715 case IGC_DEV_ID_82541ER:
716 case IGC_DEV_ID_82541GI:
717 case IGC_DEV_ID_82541GI_LF:
718 case IGC_DEV_ID_82541GI_MOBILE:
719 mac->type = igc_82541_rev_2;
721 case IGC_DEV_ID_82547EI:
722 case IGC_DEV_ID_82547EI_MOBILE:
723 mac->type = igc_82547;
725 case IGC_DEV_ID_82547GI:
726 mac->type = igc_82547_rev_2;
728 case IGC_DEV_ID_82571EB_COPPER:
729 case IGC_DEV_ID_82571EB_FIBER:
730 case IGC_DEV_ID_82571EB_SERDES:
731 case IGC_DEV_ID_82571EB_SERDES_DUAL:
732 case IGC_DEV_ID_82571EB_SERDES_QUAD:
733 case IGC_DEV_ID_82571EB_QUAD_COPPER:
734 case IGC_DEV_ID_82571PT_QUAD_COPPER:
735 case IGC_DEV_ID_82571EB_QUAD_FIBER:
736 case IGC_DEV_ID_82571EB_QUAD_COPPER_LP:
737 mac->type = igc_82571;
739 case IGC_DEV_ID_82572EI:
740 case IGC_DEV_ID_82572EI_COPPER:
741 case IGC_DEV_ID_82572EI_FIBER:
742 case IGC_DEV_ID_82572EI_SERDES:
743 mac->type = igc_82572;
745 case IGC_DEV_ID_82573E:
746 case IGC_DEV_ID_82573E_IAMT:
747 case IGC_DEV_ID_82573L:
748 mac->type = igc_82573;
750 case IGC_DEV_ID_82574L:
751 case IGC_DEV_ID_82574LA:
752 mac->type = igc_82574;
754 case IGC_DEV_ID_82583V:
755 mac->type = igc_82583;
757 case IGC_DEV_ID_80003ES2LAN_COPPER_DPT:
758 case IGC_DEV_ID_80003ES2LAN_SERDES_DPT:
759 case IGC_DEV_ID_80003ES2LAN_COPPER_SPT:
760 case IGC_DEV_ID_80003ES2LAN_SERDES_SPT:
761 mac->type = igc_80003es2lan;
763 case IGC_DEV_ID_ICH8_IFE:
764 case IGC_DEV_ID_ICH8_IFE_GT:
765 case IGC_DEV_ID_ICH8_IFE_G:
766 case IGC_DEV_ID_ICH8_IGP_M:
767 case IGC_DEV_ID_ICH8_IGP_M_AMT:
768 case IGC_DEV_ID_ICH8_IGP_AMT:
769 case IGC_DEV_ID_ICH8_IGP_C:
770 case IGC_DEV_ID_ICH8_82567V_3:
771 mac->type = igc_ich8lan;
773 case IGC_DEV_ID_ICH9_IFE:
774 case IGC_DEV_ID_ICH9_IFE_GT:
775 case IGC_DEV_ID_ICH9_IFE_G:
776 case IGC_DEV_ID_ICH9_IGP_M:
777 case IGC_DEV_ID_ICH9_IGP_M_AMT:
778 case IGC_DEV_ID_ICH9_IGP_M_V:
779 case IGC_DEV_ID_ICH9_IGP_AMT:
780 case IGC_DEV_ID_ICH9_BM:
781 case IGC_DEV_ID_ICH9_IGP_C:
782 case IGC_DEV_ID_ICH10_R_BM_LM:
783 case IGC_DEV_ID_ICH10_R_BM_LF:
784 case IGC_DEV_ID_ICH10_R_BM_V:
785 mac->type = igc_ich9lan;
787 case IGC_DEV_ID_ICH10_D_BM_LM:
788 case IGC_DEV_ID_ICH10_D_BM_LF:
789 case IGC_DEV_ID_ICH10_D_BM_V:
790 mac->type = igc_ich10lan;
792 case IGC_DEV_ID_PCH_D_HV_DM:
793 case IGC_DEV_ID_PCH_D_HV_DC:
794 case IGC_DEV_ID_PCH_M_HV_LM:
795 case IGC_DEV_ID_PCH_M_HV_LC:
796 mac->type = igc_pchlan;
798 case IGC_DEV_ID_PCH2_LV_LM:
799 case IGC_DEV_ID_PCH2_LV_V:
800 mac->type = igc_pch2lan;
802 case IGC_DEV_ID_PCH_LPT_I217_LM:
803 case IGC_DEV_ID_PCH_LPT_I217_V:
804 case IGC_DEV_ID_PCH_LPTLP_I218_LM:
805 case IGC_DEV_ID_PCH_LPTLP_I218_V:
806 case IGC_DEV_ID_PCH_I218_LM2:
807 case IGC_DEV_ID_PCH_I218_V2:
808 case IGC_DEV_ID_PCH_I218_LM3:
809 case IGC_DEV_ID_PCH_I218_V3:
810 mac->type = igc_pch_lpt;
812 case IGC_DEV_ID_PCH_SPT_I219_LM:
813 case IGC_DEV_ID_PCH_SPT_I219_V:
814 case IGC_DEV_ID_PCH_SPT_I219_LM2:
815 case IGC_DEV_ID_PCH_SPT_I219_V2:
816 case IGC_DEV_ID_PCH_LBG_I219_LM3:
817 case IGC_DEV_ID_PCH_SPT_I219_LM4:
818 case IGC_DEV_ID_PCH_SPT_I219_V4:
819 case IGC_DEV_ID_PCH_SPT_I219_LM5:
820 case IGC_DEV_ID_PCH_SPT_I219_V5:
821 mac->type = igc_pch_spt;
823 case IGC_DEV_ID_PCH_CNP_I219_LM6:
824 case IGC_DEV_ID_PCH_CNP_I219_V6:
825 case IGC_DEV_ID_PCH_CNP_I219_LM7:
826 case IGC_DEV_ID_PCH_CNP_I219_V7:
827 case IGC_DEV_ID_PCH_ICP_I219_LM8:
828 case IGC_DEV_ID_PCH_ICP_I219_V8:
829 case IGC_DEV_ID_PCH_ICP_I219_LM9:
830 case IGC_DEV_ID_PCH_ICP_I219_V9:
831 mac->type = igc_pch_cnp;
833 case IGC_DEV_ID_82575EB_COPPER:
834 case IGC_DEV_ID_82575EB_FIBER_SERDES:
835 case IGC_DEV_ID_82575GB_QUAD_COPPER:
836 mac->type = igc_82575;
838 case IGC_DEV_ID_82576:
839 case IGC_DEV_ID_82576_FIBER:
840 case IGC_DEV_ID_82576_SERDES:
841 case IGC_DEV_ID_82576_QUAD_COPPER:
842 case IGC_DEV_ID_82576_QUAD_COPPER_ET2:
843 case IGC_DEV_ID_82576_NS:
844 case IGC_DEV_ID_82576_NS_SERDES:
845 case IGC_DEV_ID_82576_SERDES_QUAD:
846 mac->type = igc_82576;
848 case IGC_DEV_ID_82576_VF:
849 case IGC_DEV_ID_82576_VF_HV:
850 mac->type = igc_vfadapt;
852 case IGC_DEV_ID_82580_COPPER:
853 case IGC_DEV_ID_82580_FIBER:
854 case IGC_DEV_ID_82580_SERDES:
855 case IGC_DEV_ID_82580_SGMII:
856 case IGC_DEV_ID_82580_COPPER_DUAL:
857 case IGC_DEV_ID_82580_QUAD_FIBER:
858 case IGC_DEV_ID_DH89XXCC_SGMII:
859 case IGC_DEV_ID_DH89XXCC_SERDES:
860 case IGC_DEV_ID_DH89XXCC_BACKPLANE:
861 case IGC_DEV_ID_DH89XXCC_SFP:
862 mac->type = igc_82580;
864 case IGC_DEV_ID_I350_COPPER:
865 case IGC_DEV_ID_I350_FIBER:
866 case IGC_DEV_ID_I350_SERDES:
867 case IGC_DEV_ID_I350_SGMII:
868 case IGC_DEV_ID_I350_DA4:
869 mac->type = igc_i350;
871 case IGC_DEV_ID_I210_COPPER_FLASHLESS:
872 case IGC_DEV_ID_I210_SERDES_FLASHLESS:
873 case IGC_DEV_ID_I210_SGMII_FLASHLESS:
874 case IGC_DEV_ID_I210_COPPER:
875 case IGC_DEV_ID_I210_COPPER_OEM1:
876 case IGC_DEV_ID_I210_COPPER_IT:
877 case IGC_DEV_ID_I210_FIBER:
878 case IGC_DEV_ID_I210_SERDES:
879 case IGC_DEV_ID_I210_SGMII:
880 mac->type = igc_i210;
882 case IGC_DEV_ID_I211_COPPER:
883 mac->type = igc_i211;
885 case IGC_DEV_ID_I225_LM:
886 case IGC_DEV_ID_I225_V:
887 case IGC_DEV_ID_I225_K:
888 case IGC_DEV_ID_I225_I:
889 case IGC_DEV_ID_I220_V:
890 case IGC_DEV_ID_I225_BLANK_NVM:
891 mac->type = igc_i225;
893 case IGC_DEV_ID_I350_VF:
894 case IGC_DEV_ID_I350_VF_HV:
895 mac->type = igc_vfadapt_i350;
897 case IGC_DEV_ID_I354_BACKPLANE_1GBPS:
898 case IGC_DEV_ID_I354_SGMII:
899 case IGC_DEV_ID_I354_BACKPLANE_2_5GBPS:
900 mac->type = igc_i354;
903 /* Should never have loaded on this device */
904 ret_val = -IGC_ERR_MAC_INIT;
912 * igc_setup_init_funcs - Initializes function pointers
913 * @hw: pointer to the HW structure
914 * @init_device: true will initialize the rest of the function pointers
915 * getting the device ready for use. false will only set
916 * MAC type and the function pointers for the other init
917 * functions. Passing false will not generate any hardware
920 * This function must be called by a driver in order to use the rest
921 * of the 'shared' code files. Called by drivers only.
923 s32 igc_setup_init_funcs(struct igc_hw *hw, bool init_device)
927 /* Can't do much good without knowing the MAC type. */
928 ret_val = igc_set_mac_type(hw);
930 DEBUGOUT("ERROR: MAC type could not be set properly.\n");
935 DEBUGOUT("ERROR: Registers not mapped\n");
936 ret_val = -IGC_ERR_CONFIG;
941 * Init function pointers to generic implementations. We do this first
942 * allowing a driver module to override it afterward.
944 igc_init_mac_ops_generic(hw);
945 igc_init_phy_ops_generic(hw);
946 igc_init_nvm_ops_generic(hw);
949 * Set up the init function pointers. These are functions within the
950 * adapter family file that sets up function pointers for the rest of
951 * the functions in that family.
953 switch (hw->mac.type) {
955 igc_init_function_pointers_i225(hw);
958 DEBUGOUT("Hardware not supported\n");
959 ret_val = -IGC_ERR_CONFIG;
964 * Initialize the rest of the function pointers. These require some
965 * register reads/writes in some cases.
967 if (!(ret_val) && init_device) {
968 ret_val = igc_init_mac_params(hw);
972 ret_val = igc_init_nvm_params(hw);
976 ret_val = igc_init_phy_params(hw);
986 * igc_get_bus_info - Obtain bus information for adapter
987 * @hw: pointer to the HW structure
989 * This will obtain information about the HW bus for which the
990 * adapter is attached and stores it in the hw structure. This is a
991 * function pointer entry point called by drivers.
993 s32 igc_get_bus_info(struct igc_hw *hw)
995 if (hw->mac.ops.get_bus_info)
996 return hw->mac.ops.get_bus_info(hw);
1002 * igc_clear_vfta - Clear VLAN filter table
1003 * @hw: pointer to the HW structure
1005 * This clears the VLAN filter table on the adapter. This is a function
1006 * pointer entry point called by drivers.
1008 void igc_clear_vfta(struct igc_hw *hw)
1010 if (hw->mac.ops.clear_vfta)
1011 hw->mac.ops.clear_vfta(hw);
1015 * igc_write_vfta - Write value to VLAN filter table
1016 * @hw: pointer to the HW structure
1017 * @offset: the 32-bit offset in which to write the value to.
1018 * @value: the 32-bit value to write at location offset.
1020 * This writes a 32-bit value to a 32-bit offset in the VLAN filter
1021 * table. This is a function pointer entry point called by drivers.
1023 void igc_write_vfta(struct igc_hw *hw, u32 offset, u32 value)
1025 if (hw->mac.ops.write_vfta)
1026 hw->mac.ops.write_vfta(hw, offset, value);
1030 * igc_update_mc_addr_list - Update Multicast addresses
1031 * @hw: pointer to the HW structure
1032 * @mc_addr_list: array of multicast addresses to program
1033 * @mc_addr_count: number of multicast addresses to program
1035 * Updates the Multicast Table Array.
1036 * The caller must have a packed mc_addr_list of multicast addresses.
1038 void igc_update_mc_addr_list(struct igc_hw *hw, u8 *mc_addr_list,
1041 if (hw->mac.ops.update_mc_addr_list)
1042 hw->mac.ops.update_mc_addr_list(hw, mc_addr_list,
1047 * igc_force_mac_fc - Force MAC flow control
1048 * @hw: pointer to the HW structure
1050 * Force the MAC's flow control settings. Currently no func pointer exists
1051 * and all implementations are handled in the generic version of this
1054 s32 igc_force_mac_fc(struct igc_hw *hw)
1056 return igc_force_mac_fc_generic(hw);
1060 * igc_check_for_link - Check/Store link connection
1061 * @hw: pointer to the HW structure
1063 * This checks the link condition of the adapter and stores the
1064 * results in the hw->mac structure. This is a function pointer entry
1065 * point called by drivers.
1067 s32 igc_check_for_link(struct igc_hw *hw)
1069 if (hw->mac.ops.check_for_link)
1070 return hw->mac.ops.check_for_link(hw);
1072 return -IGC_ERR_CONFIG;
1076 * igc_check_mng_mode - Check management mode
1077 * @hw: pointer to the HW structure
1079 * This checks if the adapter has manageability enabled.
1080 * This is a function pointer entry point called by drivers.
1082 bool igc_check_mng_mode(struct igc_hw *hw)
1084 if (hw->mac.ops.check_mng_mode)
1085 return hw->mac.ops.check_mng_mode(hw);
1091 * igc_mng_write_dhcp_info - Writes DHCP info to host interface
1092 * @hw: pointer to the HW structure
1093 * @buffer: pointer to the host interface
1094 * @length: size of the buffer
1096 * Writes the DHCP information to the host interface.
1098 s32 igc_mng_write_dhcp_info(struct igc_hw *hw, u8 *buffer, u16 length)
1100 return igc_mng_write_dhcp_info_generic(hw, buffer, length);
1104 * igc_reset_hw - Reset hardware
1105 * @hw: pointer to the HW structure
1107 * This resets the hardware into a known state. This is a function pointer
1108 * entry point called by drivers.
1110 s32 igc_reset_hw(struct igc_hw *hw)
1112 if (hw->mac.ops.reset_hw)
1113 return hw->mac.ops.reset_hw(hw);
1115 return -IGC_ERR_CONFIG;
1119 * igc_init_hw - Initialize hardware
1120 * @hw: pointer to the HW structure
1122 * This inits the hardware readying it for operation. This is a function
1123 * pointer entry point called by drivers.
1125 s32 igc_init_hw(struct igc_hw *hw)
1127 if (hw->mac.ops.init_hw)
1128 return hw->mac.ops.init_hw(hw);
1130 return -IGC_ERR_CONFIG;
1134 * igc_setup_link - Configures link and flow control
1135 * @hw: pointer to the HW structure
1137 * This configures link and flow control settings for the adapter. This
1138 * is a function pointer entry point called by drivers. While modules can
1139 * also call this, they probably call their own version of this function.
1141 s32 igc_setup_link(struct igc_hw *hw)
1143 if (hw->mac.ops.setup_link)
1144 return hw->mac.ops.setup_link(hw);
1146 return -IGC_ERR_CONFIG;
1150 * igc_get_speed_and_duplex - Returns current speed and duplex
1151 * @hw: pointer to the HW structure
1152 * @speed: pointer to a 16-bit value to store the speed
1153 * @duplex: pointer to a 16-bit value to store the duplex.
1155 * This returns the speed and duplex of the adapter in the two 'out'
1156 * variables passed in. This is a function pointer entry point called
1159 s32 igc_get_speed_and_duplex(struct igc_hw *hw, u16 *speed, u16 *duplex)
1161 if (hw->mac.ops.get_link_up_info)
1162 return hw->mac.ops.get_link_up_info(hw, speed, duplex);
1164 return -IGC_ERR_CONFIG;
1168 * igc_setup_led - Configures SW controllable LED
1169 * @hw: pointer to the HW structure
1171 * This prepares the SW controllable LED for use and saves the current state
1172 * of the LED so it can be later restored. This is a function pointer entry
1173 * point called by drivers.
1175 s32 igc_setup_led(struct igc_hw *hw)
1177 if (hw->mac.ops.setup_led)
1178 return hw->mac.ops.setup_led(hw);
1184 * igc_cleanup_led - Restores SW controllable LED
1185 * @hw: pointer to the HW structure
1187 * This restores the SW controllable LED to the value saved off by
1188 * igc_setup_led. This is a function pointer entry point called by drivers.
1190 s32 igc_cleanup_led(struct igc_hw *hw)
1192 if (hw->mac.ops.cleanup_led)
1193 return hw->mac.ops.cleanup_led(hw);
1199 * igc_blink_led - Blink SW controllable LED
1200 * @hw: pointer to the HW structure
1202 * This starts the adapter LED blinking. Request the LED to be setup first
1203 * and cleaned up after. This is a function pointer entry point called by
1206 s32 igc_blink_led(struct igc_hw *hw)
1208 if (hw->mac.ops.blink_led)
1209 return hw->mac.ops.blink_led(hw);
1215 * igc_id_led_init - store LED configurations in SW
1216 * @hw: pointer to the HW structure
1218 * Initializes the LED config in SW. This is a function pointer entry point
1219 * called by drivers.
1221 s32 igc_id_led_init(struct igc_hw *hw)
1223 if (hw->mac.ops.id_led_init)
1224 return hw->mac.ops.id_led_init(hw);
1230 * igc_led_on - Turn on SW controllable LED
1231 * @hw: pointer to the HW structure
1233 * Turns the SW defined LED on. This is a function pointer entry point
1234 * called by drivers.
1236 s32 igc_led_on(struct igc_hw *hw)
1238 if (hw->mac.ops.led_on)
1239 return hw->mac.ops.led_on(hw);
1245 * igc_led_off - Turn off SW controllable LED
1246 * @hw: pointer to the HW structure
1248 * Turns the SW defined LED off. This is a function pointer entry point
1249 * called by drivers.
1251 s32 igc_led_off(struct igc_hw *hw)
1253 if (hw->mac.ops.led_off)
1254 return hw->mac.ops.led_off(hw);
1260 * igc_reset_adaptive - Reset adaptive IFS
1261 * @hw: pointer to the HW structure
1263 * Resets the adaptive IFS. Currently no func pointer exists and all
1264 * implementations are handled in the generic version of this function.
1266 void igc_reset_adaptive(struct igc_hw *hw)
1268 igc_reset_adaptive_generic(hw);
1272 * igc_update_adaptive - Update adaptive IFS
1273 * @hw: pointer to the HW structure
1275 * Updates adapter IFS. Currently no func pointer exists and all
1276 * implementations are handled in the generic version of this function.
1278 void igc_update_adaptive(struct igc_hw *hw)
1280 igc_update_adaptive_generic(hw);
1284 * igc_disable_pcie_master - Disable PCI-Express master access
1285 * @hw: pointer to the HW structure
1287 * Disables PCI-Express master access and verifies there are no pending
1288 * requests. Currently no func pointer exists and all implementations are
1289 * handled in the generic version of this function.
1291 s32 igc_disable_pcie_master(struct igc_hw *hw)
1293 return igc_disable_pcie_master_generic(hw);
1297 * igc_config_collision_dist - Configure collision distance
1298 * @hw: pointer to the HW structure
1300 * Configures the collision distance to the default value and is used
1301 * during link setup.
1303 void igc_config_collision_dist(struct igc_hw *hw)
1305 if (hw->mac.ops.config_collision_dist)
1306 hw->mac.ops.config_collision_dist(hw);
1310 * igc_rar_set - Sets a receive address register
1311 * @hw: pointer to the HW structure
1312 * @addr: address to set the RAR to
1313 * @index: the RAR to set
1315 * Sets a Receive Address Register (RAR) to the specified address.
1317 int igc_rar_set(struct igc_hw *hw, u8 *addr, u32 index)
1319 if (hw->mac.ops.rar_set)
1320 return hw->mac.ops.rar_set(hw, addr, index);
1326 * igc_validate_mdi_setting - Ensures valid MDI/MDIX SW state
1327 * @hw: pointer to the HW structure
1329 * Ensures that the MDI/MDIX SW state is valid.
1331 s32 igc_validate_mdi_setting(struct igc_hw *hw)
1333 if (hw->mac.ops.validate_mdi_setting)
1334 return hw->mac.ops.validate_mdi_setting(hw);
1340 * igc_hash_mc_addr - Determines address location in multicast table
1341 * @hw: pointer to the HW structure
1342 * @mc_addr: Multicast address to hash.
1344 * This hashes an address to determine its location in the multicast
1345 * table. Currently no func pointer exists and all implementations
1346 * are handled in the generic version of this function.
1348 u32 igc_hash_mc_addr(struct igc_hw *hw, u8 *mc_addr)
1350 return igc_hash_mc_addr_generic(hw, mc_addr);
1354 * igc_enable_tx_pkt_filtering - Enable packet filtering on TX
1355 * @hw: pointer to the HW structure
1357 * Enables packet filtering on transmit packets if manageability is enabled
1358 * and host interface is enabled.
1359 * Currently no func pointer exists and all implementations are handled in the
1360 * generic version of this function.
1362 bool igc_enable_tx_pkt_filtering(struct igc_hw *hw)
1364 return igc_enable_tx_pkt_filtering_generic(hw);
1368 * igc_mng_host_if_write - Writes to the manageability host interface
1369 * @hw: pointer to the HW structure
1370 * @buffer: pointer to the host interface buffer
1371 * @length: size of the buffer
1372 * @offset: location in the buffer to write to
1373 * @sum: sum of the data (not checksum)
1375 * This function writes the buffer content at the offset given on the host if.
1376 * It also does alignment considerations to do the writes in most efficient
1377 * way. Also fills up the sum of the buffer in *buffer parameter.
1379 s32 igc_mng_host_if_write(struct igc_hw *hw, u8 *buffer, u16 length,
1380 u16 offset, u8 *sum)
1382 return igc_mng_host_if_write_generic(hw, buffer, length, offset, sum);
1386 * igc_mng_write_cmd_header - Writes manageability command header
1387 * @hw: pointer to the HW structure
1388 * @hdr: pointer to the host interface command header
1390 * Writes the command header after does the checksum calculation.
1392 s32 igc_mng_write_cmd_header(struct igc_hw *hw,
1393 struct igc_host_mng_command_header *hdr)
1395 return igc_mng_write_cmd_header_generic(hw, hdr);
1399 * igc_mng_enable_host_if - Checks host interface is enabled
1400 * @hw: pointer to the HW structure
1402 * Returns IGC_success upon success, else IGC_ERR_HOST_INTERFACE_COMMAND
1404 * This function checks whether the HOST IF is enabled for command operation
1405 * and also checks whether the previous command is completed. It busy waits
1406 * in case of previous command is not completed.
1408 s32 igc_mng_enable_host_if(struct igc_hw *hw)
1410 return igc_mng_enable_host_if_generic(hw);
1414 * igc_check_reset_block - Verifies PHY can be reset
1415 * @hw: pointer to the HW structure
1417 * Checks if the PHY is in a state that can be reset or if manageability
1418 * has it tied up. This is a function pointer entry point called by drivers.
1420 s32 igc_check_reset_block(struct igc_hw *hw)
1422 if (hw->phy.ops.check_reset_block)
1423 return hw->phy.ops.check_reset_block(hw);
1429 * igc_read_phy_reg - Reads PHY register
1430 * @hw: pointer to the HW structure
1431 * @offset: the register to read
1432 * @data: the buffer to store the 16-bit read.
1434 * Reads the PHY register and returns the value in data.
1435 * This is a function pointer entry point called by drivers.
1437 s32 igc_read_phy_reg(struct igc_hw *hw, u32 offset, u16 *data)
1439 if (hw->phy.ops.read_reg)
1440 return hw->phy.ops.read_reg(hw, offset, data);
1446 * igc_write_phy_reg - Writes PHY register
1447 * @hw: pointer to the HW structure
1448 * @offset: the register to write
1449 * @data: the value to write.
1451 * Writes the PHY register at offset with the value in data.
1452 * This is a function pointer entry point called by drivers.
1454 s32 igc_write_phy_reg(struct igc_hw *hw, u32 offset, u16 data)
1456 if (hw->phy.ops.write_reg)
1457 return hw->phy.ops.write_reg(hw, offset, data);
1463 * igc_release_phy - Generic release PHY
1464 * @hw: pointer to the HW structure
1466 * Return if silicon family does not require a semaphore when accessing the
1469 void igc_release_phy(struct igc_hw *hw)
1471 if (hw->phy.ops.release)
1472 hw->phy.ops.release(hw);
1476 * igc_acquire_phy - Generic acquire PHY
1477 * @hw: pointer to the HW structure
1479 * Return success if silicon family does not require a semaphore when
1480 * accessing the PHY.
1482 s32 igc_acquire_phy(struct igc_hw *hw)
1484 if (hw->phy.ops.acquire)
1485 return hw->phy.ops.acquire(hw);
1491 * igc_cfg_on_link_up - Configure PHY upon link up
1492 * @hw: pointer to the HW structure
1494 s32 igc_cfg_on_link_up(struct igc_hw *hw)
1496 if (hw->phy.ops.cfg_on_link_up)
1497 return hw->phy.ops.cfg_on_link_up(hw);
1503 * igc_read_kmrn_reg - Reads register using Kumeran interface
1504 * @hw: pointer to the HW structure
1505 * @offset: the register to read
1506 * @data: the location to store the 16-bit value read.
1508 * Reads a register out of the Kumeran interface. Currently no func pointer
1509 * exists and all implementations are handled in the generic version of
1512 s32 igc_read_kmrn_reg(struct igc_hw *hw, u32 offset, u16 *data)
1514 return igc_read_kmrn_reg_generic(hw, offset, data);
1518 * igc_write_kmrn_reg - Writes register using Kumeran interface
1519 * @hw: pointer to the HW structure
1520 * @offset: the register to write
1521 * @data: the value to write.
1523 * Writes a register to the Kumeran interface. Currently no func pointer
1524 * exists and all implementations are handled in the generic version of
1527 s32 igc_write_kmrn_reg(struct igc_hw *hw, u32 offset, u16 data)
1529 return igc_write_kmrn_reg_generic(hw, offset, data);
1533 * igc_get_cable_length - Retrieves cable length estimation
1534 * @hw: pointer to the HW structure
1536 * This function estimates the cable length and stores them in
1537 * hw->phy.min_length and hw->phy.max_length. This is a function pointer
1538 * entry point called by drivers.
1540 s32 igc_get_cable_length(struct igc_hw *hw)
1542 if (hw->phy.ops.get_cable_length)
1543 return hw->phy.ops.get_cable_length(hw);
1549 * igc_get_phy_info - Retrieves PHY information from registers
1550 * @hw: pointer to the HW structure
1552 * This function gets some information from various PHY registers and
1553 * populates hw->phy values with it. This is a function pointer entry
1554 * point called by drivers.
1556 s32 igc_get_phy_info(struct igc_hw *hw)
1558 if (hw->phy.ops.get_info)
1559 return hw->phy.ops.get_info(hw);
1565 * igc_phy_hw_reset - Hard PHY reset
1566 * @hw: pointer to the HW structure
1568 * Performs a hard PHY reset. This is a function pointer entry point called
1571 s32 igc_phy_hw_reset(struct igc_hw *hw)
1573 if (hw->phy.ops.reset)
1574 return hw->phy.ops.reset(hw);
1580 * igc_phy_commit - Soft PHY reset
1581 * @hw: pointer to the HW structure
1583 * Performs a soft PHY reset on those that apply. This is a function pointer
1584 * entry point called by drivers.
1586 s32 igc_phy_commit(struct igc_hw *hw)
1588 if (hw->phy.ops.commit)
1589 return hw->phy.ops.commit(hw);
1595 * igc_set_d0_lplu_state - Sets low power link up state for D0
1596 * @hw: pointer to the HW structure
1597 * @active: boolean used to enable/disable lplu
1599 * Success returns 0, Failure returns 1
1601 * The low power link up (lplu) state is set to the power management level D0
1602 * and SmartSpeed is disabled when active is true, else clear lplu for D0
1603 * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU
1604 * is used during Dx states where the power conservation is most important.
1605 * During driver activity, SmartSpeed should be enabled so performance is
1606 * maintained. This is a function pointer entry point called by drivers.
1608 s32 igc_set_d0_lplu_state(struct igc_hw *hw, bool active)
1610 if (hw->phy.ops.set_d0_lplu_state)
1611 return hw->phy.ops.set_d0_lplu_state(hw, active);
1617 * igc_set_d3_lplu_state - Sets low power link up state for D3
1618 * @hw: pointer to the HW structure
1619 * @active: boolean used to enable/disable lplu
1621 * Success returns 0, Failure returns 1
1623 * The low power link up (lplu) state is set to the power management level D3
1624 * and SmartSpeed is disabled when active is true, else clear lplu for D3
1625 * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU
1626 * is used during Dx states where the power conservation is most important.
1627 * During driver activity, SmartSpeed should be enabled so performance is
1628 * maintained. This is a function pointer entry point called by drivers.
1630 s32 igc_set_d3_lplu_state(struct igc_hw *hw, bool active)
1632 if (hw->phy.ops.set_d3_lplu_state)
1633 return hw->phy.ops.set_d3_lplu_state(hw, active);
1639 * igc_read_mac_addr - Reads MAC address
1640 * @hw: pointer to the HW structure
1642 * Reads the MAC address out of the adapter and stores it in the HW structure.
1643 * Currently no func pointer exists and all implementations are handled in the
1644 * generic version of this function.
1646 s32 igc_read_mac_addr(struct igc_hw *hw)
1648 if (hw->mac.ops.read_mac_addr)
1649 return hw->mac.ops.read_mac_addr(hw);
1651 return igc_read_mac_addr_generic(hw);
1655 * igc_read_pba_string - Read device part number string
1656 * @hw: pointer to the HW structure
1657 * @pba_num: pointer to device part number
1658 * @pba_num_size: size of part number buffer
1660 * Reads the product board assembly (PBA) number from the EEPROM and stores
1661 * the value in pba_num.
1662 * Currently no func pointer exists and all implementations are handled in the
1663 * generic version of this function.
1665 s32 igc_read_pba_string(struct igc_hw *hw, u8 *pba_num, u32 pba_num_size)
1667 return igc_read_pba_string_generic(hw, pba_num, pba_num_size);
1671 * igc_read_pba_length - Read device part number string length
1672 * @hw: pointer to the HW structure
1673 * @pba_num_size: size of part number buffer
1675 * Reads the product board assembly (PBA) number length from the EEPROM and
1676 * stores the value in pba_num.
1677 * Currently no func pointer exists and all implementations are handled in the
1678 * generic version of this function.
1680 s32 igc_read_pba_length(struct igc_hw *hw, u32 *pba_num_size)
1682 return igc_read_pba_length_generic(hw, pba_num_size);
1686 * igc_read_pba_num - Read device part number
1687 * @hw: pointer to the HW structure
1688 * @pba_num: pointer to device part number
1690 * Reads the product board assembly (PBA) number from the EEPROM and stores
1691 * the value in pba_num.
1692 * Currently no func pointer exists and all implementations are handled in the
1693 * generic version of this function.
1695 s32 igc_read_pba_num(struct igc_hw *hw, u32 *pba_num)
1697 return igc_read_pba_num_generic(hw, pba_num);
1701 * igc_validate_nvm_checksum - Verifies NVM (EEPROM) checksum
1702 * @hw: pointer to the HW structure
1704 * Validates the NVM checksum is correct. This is a function pointer entry
1705 * point called by drivers.
1707 s32 igc_validate_nvm_checksum(struct igc_hw *hw)
1709 if (hw->nvm.ops.validate)
1710 return hw->nvm.ops.validate(hw);
1712 return -IGC_ERR_CONFIG;
1716 * igc_update_nvm_checksum - Updates NVM (EEPROM) checksum
1717 * @hw: pointer to the HW structure
1719 * Updates the NVM checksum. Currently no func pointer exists and all
1720 * implementations are handled in the generic version of this function.
1722 s32 igc_update_nvm_checksum(struct igc_hw *hw)
1724 if (hw->nvm.ops.update)
1725 return hw->nvm.ops.update(hw);
1727 return -IGC_ERR_CONFIG;
1731 * igc_reload_nvm - Reloads EEPROM
1732 * @hw: pointer to the HW structure
1734 * Reloads the EEPROM by setting the "Reinitialize from EEPROM" bit in the
1735 * extended control register.
1737 void igc_reload_nvm(struct igc_hw *hw)
1739 if (hw->nvm.ops.reload)
1740 hw->nvm.ops.reload(hw);
1744 * igc_read_nvm - Reads NVM (EEPROM)
1745 * @hw: pointer to the HW structure
1746 * @offset: the word offset to read
1747 * @words: number of 16-bit words to read
1748 * @data: pointer to the properly sized buffer for the data.
1750 * Reads 16-bit chunks of data from the NVM (EEPROM). This is a function
1751 * pointer entry point called by drivers.
1753 s32 igc_read_nvm(struct igc_hw *hw, u16 offset, u16 words, u16 *data)
1755 if (hw->nvm.ops.read)
1756 return hw->nvm.ops.read(hw, offset, words, data);
1758 return -IGC_ERR_CONFIG;
1762 * igc_write_nvm - Writes to NVM (EEPROM)
1763 * @hw: pointer to the HW structure
1764 * @offset: the word offset to read
1765 * @words: number of 16-bit words to write
1766 * @data: pointer to the properly sized buffer for the data.
1768 * Writes 16-bit chunks of data to the NVM (EEPROM). This is a function
1769 * pointer entry point called by drivers.
1771 s32 igc_write_nvm(struct igc_hw *hw, u16 offset, u16 words, u16 *data)
1773 if (hw->nvm.ops.write)
1774 return hw->nvm.ops.write(hw, offset, words, data);
1780 * igc_write_8bit_ctrl_reg - Writes 8bit Control register
1781 * @hw: pointer to the HW structure
1782 * @reg: 32bit register offset
1783 * @offset: the register to write
1784 * @data: the value to write.
1786 * Writes the PHY register at offset with the value in data.
1787 * This is a function pointer entry point called by drivers.
1789 s32 igc_write_8bit_ctrl_reg(struct igc_hw *hw, u32 reg, u32 offset,
1792 return igc_write_8bit_ctrl_reg_generic(hw, reg, offset, data);
1796 * igc_power_up_phy - Restores link in case of PHY power down
1797 * @hw: pointer to the HW structure
1799 * The phy may be powered down to save power, to turn off link when the
1800 * driver is unloaded, or wake on lan is not enabled (among others).
1802 void igc_power_up_phy(struct igc_hw *hw)
1804 if (hw->phy.ops.power_up)
1805 hw->phy.ops.power_up(hw);
1811 * igc_power_down_phy - Power down PHY
1812 * @hw: pointer to the HW structure
1814 * The phy may be powered down to save power, to turn off link when the
1815 * driver is unloaded, or wake on lan is not enabled (among others).
1817 void igc_power_down_phy(struct igc_hw *hw)
1819 if (hw->phy.ops.power_down)
1820 hw->phy.ops.power_down(hw);
1824 * igc_power_up_fiber_serdes_link - Power up serdes link
1825 * @hw: pointer to the HW structure
1827 * Power on the optics and PCS.
1829 void igc_power_up_fiber_serdes_link(struct igc_hw *hw)
1831 if (hw->mac.ops.power_up_serdes)
1832 hw->mac.ops.power_up_serdes(hw);
1836 * igc_shutdown_fiber_serdes_link - Remove link during power down
1837 * @hw: pointer to the HW structure
1839 * Shutdown the optics and PCS on driver unload.
1841 void igc_shutdown_fiber_serdes_link(struct igc_hw *hw)
1843 if (hw->mac.ops.shutdown_serdes)
1844 hw->mac.ops.shutdown_serdes(hw);