Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
e1000_phy.c File Reference
#include <linux/if_ether.h>
#include <linux/delay.h>
#include "e1000_mac.h"
#include "e1000_phy.h"

Go to the source code of this file.

Macros

#define M88E1000_CABLE_LENGTH_TABLE_SIZE
 
#define IGP02E1000_CABLE_LENGTH_TABLE_SIZE
 

Functions

s32 igb_check_reset_block (struct e1000_hw *hw)
 
s32 igb_get_phy_id (struct e1000_hw *hw)
 
s32 igb_read_phy_reg_mdic (struct e1000_hw *hw, u32 offset, u16 *data)
 
s32 igb_write_phy_reg_mdic (struct e1000_hw *hw, u32 offset, u16 data)
 
s32 igb_read_phy_reg_i2c (struct e1000_hw *hw, u32 offset, u16 *data)
 
s32 igb_write_phy_reg_i2c (struct e1000_hw *hw, u32 offset, u16 data)
 
s32 igb_read_phy_reg_igp (struct e1000_hw *hw, u32 offset, u16 *data)
 
s32 igb_write_phy_reg_igp (struct e1000_hw *hw, u32 offset, u16 data)
 
s32 igb_copper_link_setup_82580 (struct e1000_hw *hw)
 
s32 igb_copper_link_setup_m88 (struct e1000_hw *hw)
 
s32 igb_copper_link_setup_m88_gen2 (struct e1000_hw *hw)
 
s32 igb_copper_link_setup_igp (struct e1000_hw *hw)
 
s32 igb_setup_copper_link (struct e1000_hw *hw)
 
s32 igb_phy_force_speed_duplex_igp (struct e1000_hw *hw)
 
s32 igb_phy_force_speed_duplex_m88 (struct e1000_hw *hw)
 
s32 igb_set_d3_lplu_state (struct e1000_hw *hw, bool active)
 
s32 igb_check_downshift (struct e1000_hw *hw)
 
s32 igb_check_polarity_m88 (struct e1000_hw *hw)
 
s32 igb_phy_has_link (struct e1000_hw *hw, u32 iterations, u32 usec_interval, bool *success)
 
s32 igb_get_cable_length_m88 (struct e1000_hw *hw)
 
s32 igb_get_cable_length_m88_gen2 (struct e1000_hw *hw)
 
s32 igb_get_cable_length_igp_2 (struct e1000_hw *hw)
 
s32 igb_get_phy_info_m88 (struct e1000_hw *hw)
 
s32 igb_get_phy_info_igp (struct e1000_hw *hw)
 
s32 igb_phy_sw_reset (struct e1000_hw *hw)
 
s32 igb_phy_hw_reset (struct e1000_hw *hw)
 
s32 igb_phy_init_script_igp3 (struct e1000_hw *hw)
 
void igb_power_up_phy_copper (struct e1000_hw *hw)
 
void igb_power_down_phy_copper (struct e1000_hw *hw)
 
s32 igb_phy_force_speed_duplex_82580 (struct e1000_hw *hw)
 
s32 igb_get_phy_info_82580 (struct e1000_hw *hw)
 
s32 igb_get_cable_length_82580 (struct e1000_hw *hw)
 
s32 igb_write_phy_reg_gs40g (struct e1000_hw *hw, u32 offset, u16 data)
 
s32 igb_read_phy_reg_gs40g (struct e1000_hw *hw, u32 offset, u16 *data)
 

Macro Definition Documentation

#define IGP02E1000_CABLE_LENGTH_TABLE_SIZE
Value:
(sizeof(e1000_igp_2_cable_length_table) / \
sizeof(e1000_igp_2_cable_length_table[0]))

Definition at line 56 of file e1000_phy.c.

#define M88E1000_CABLE_LENGTH_TABLE_SIZE
Value:
(sizeof(e1000_m88_cable_length_table) / \
sizeof(e1000_m88_cable_length_table[0]))

Definition at line 43 of file e1000_phy.c.

Function Documentation

s32 igb_check_downshift ( struct e1000_hw hw)

igb_check_downshift - Checks whether a downshift in speed occurred : pointer to the HW structure

Success returns 0, Failure returns 1

A downshift is detected by querying the PHY link health.

Definition at line 1480 of file e1000_phy.c.

s32 igb_check_polarity_m88 ( struct e1000_hw hw)

igb_check_polarity_m88 - Checks the polarity. : pointer to the HW structure

Success returns 0, Failure returns -E1000_ERR_PHY (-2)

Polarity is determined based on the PHY specific status register.

Definition at line 1523 of file e1000_phy.c.

s32 igb_check_reset_block ( struct e1000_hw hw)

igb_check_reset_block - Check if PHY reset is blocked : pointer to the HW structure

Read the PHY management control register and check whether a PHY reset is blocked. If a reset is not blocked return 0, otherwise return E1000_BLK_PHY_RESET (12).

Definition at line 68 of file e1000_phy.c.

s32 igb_copper_link_setup_82580 ( struct e1000_hw hw)

igb_copper_link_setup_82580 - Setup 82580 PHY for copper link : pointer to the HW structure

Sets up Carrier-sense on Transmit and downshift values.

Definition at line 436 of file e1000_phy.c.

s32 igb_copper_link_setup_igp ( struct e1000_hw hw)

igb_copper_link_setup_igp - Setup igp PHY's for copper link : pointer to the HW structure

Sets up LPLU, MDI/MDI-X, polarity, Smartspeed and Master/Slave config for igp PHY's.

Definition at line 700 of file e1000_phy.c.

s32 igb_copper_link_setup_m88 ( struct e1000_hw hw)

igb_copper_link_setup_m88 - Setup m88 PHY's for copper link : pointer to the HW structure

Sets up MDI/MDI-X and polarity for m88 PHY's. If necessary, transmit clock and downshift values are set also.

Definition at line 505 of file e1000_phy.c.

s32 igb_copper_link_setup_m88_gen2 ( struct e1000_hw hw)

igb_copper_link_setup_m88_gen2 - Setup m88 PHY's for copper link : pointer to the HW structure

Sets up MDI/MDI-X and polarity for i347-AT4, m88e1322 and m88e1112 PHY's. Also enables and sets the downshift parameters.

Definition at line 617 of file e1000_phy.c.

s32 igb_get_cable_length_82580 ( struct e1000_hw hw)

igb_get_cable_length_82580 - Determine cable length for 82580 PHY : pointer to the HW structure

Reads the diagnostic status register and verifies result is valid before placing it in the phy_cable_length field.

Definition at line 2384 of file e1000_phy.c.

s32 igb_get_cable_length_igp_2 ( struct e1000_hw hw)

igb_get_cable_length_igp_2 - Determine cable length for igp2 PHY : pointer to the HW structure

The automatic gain control (agc) normalizes the amplitude of the received signal, adjusting for the attenuation produced by the cable. By reading the AGC registers, which represent the combination of coarse and fine gain value, the value can be put into a lookup table to obtain the approximate cable length for each channel.

Definition at line 1804 of file e1000_phy.c.

s32 igb_get_cable_length_m88 ( struct e1000_hw hw)

igb_get_cable_length_m88 - Determine cable length for m88 PHY : pointer to the HW structure

Reads the PHY specific status register to retrieve the cable length information. The cable length is determined by averaging the minimum and maximum values to get the "average" cable length. The m88 PHY has four possible cable length values, which are: Register Value Cable Length 0 < 50 meters 1 50 - 80 meters 2 80 - 110 meters 3 110 - 140 meters 4 > 140 meters

Definition at line 1679 of file e1000_phy.c.

s32 igb_get_cable_length_m88_gen2 ( struct e1000_hw hw)

Definition at line 1705 of file e1000_phy.c.

s32 igb_get_phy_id ( struct e1000_hw hw)

igb_get_phy_id - Retrieve the PHY ID and revision : pointer to the HW structure

Reads the PHY registers and stores the PHY ID and possibly the PHY revision in the hardware structure.

Definition at line 85 of file e1000_phy.c.

s32 igb_get_phy_info_82580 ( struct e1000_hw hw)

igb_get_phy_info_82580 - Retrieve I82580 PHY information : pointer to the HW structure

Read PHY status to determine if link is up. If link is up, then set/determine 10base-T extended distance and polarity correction. Read PHY port status to determine MDI/MDIx and speed. Based on the speed, determine on the cable length, local and remote receiver.

Definition at line 2320 of file e1000_phy.c.

s32 igb_get_phy_info_igp ( struct e1000_hw hw)

igb_get_phy_info_igp - Retrieve igp PHY information : pointer to the HW structure

Read PHY status to determine if link is up. If link is up, then set/determine 10base-T extended distance and polarity correction. Read PHY port status to determine MDI/MDIx and speed. Based on the speed, determine on the cable length, local and remote receiver.

Definition at line 1952 of file e1000_phy.c.

s32 igb_get_phy_info_m88 ( struct e1000_hw hw)

igb_get_phy_info_m88 - Retrieve PHY information : pointer to the HW structure

Valid for only copper links. Read the PHY status register (sticky read) to verify that link is up. Read the PHY special control register to determine the polarity and 10base-T extended distance. Read the PHY special status register to determine MDI/MDIx and current speed. If speed is 1000, then determine cable length, local and remote receiver.

Definition at line 1876 of file e1000_phy.c.

s32 igb_phy_force_speed_duplex_82580 ( struct e1000_hw hw)

igb_phy_force_speed_duplex_82580 - Force speed/duplex for I82580 PHY : pointer to the HW structure

Calls the PHY setup function to force speed and duplex. Clears the auto-crossover to force MDI manually. Waits for link and returns successful if link up is successful, else -E1000_ERR_PHY (-2).

Definition at line 2249 of file e1000_phy.c.

s32 igb_phy_force_speed_duplex_igp ( struct e1000_hw hw)

igb_phy_force_speed_duplex_igp - Force speed/duplex for igp PHY : pointer to the HW structure

Calls the PHY setup function to force speed and duplex. Clears the auto-crossover to force MDI manually. Waits for link and returns successful if link up is successful, else -E1000_ERR_PHY (-2).

Definition at line 1131 of file e1000_phy.c.

s32 igb_phy_force_speed_duplex_m88 ( struct e1000_hw hw)

igb_phy_force_speed_duplex_m88 - Force speed/duplex for m88 PHY : pointer to the HW structure

Calls the PHY setup function to force speed and duplex. Clears the auto-crossover to force MDI manually. Resets the PHY to commit the changes. If time expires while waiting for link up, we reset the DSP. After reset, TX_CLK and CRS on TX must be set. Return successful upon successful completion, else return corresponding error code.

Definition at line 1203 of file e1000_phy.c.

s32 igb_phy_has_link ( struct e1000_hw hw,
u32  iterations,
u32  usec_interval,
bool success 
)

igb_phy_has_link - Polls PHY for link : pointer to the HW structure : number of times to poll for link : delay between polling attempts : pointer to whether polling was successful or not

Polls the PHY status register for link, 'iterations' number of times.

Definition at line 1627 of file e1000_phy.c.

s32 igb_phy_hw_reset ( struct e1000_hw hw)

igb_phy_hw_reset - PHY hardware reset : pointer to the HW structure

Verify the reset block is not blocking us from resetting. Acquire semaphore (if necessary) and read/set/write the device control reset bit in the PHY. Wait the appropriate delay time for the device to reset and relase the semaphore (if necessary).

Definition at line 2047 of file e1000_phy.c.

s32 igb_phy_init_script_igp3 ( struct e1000_hw hw)

igb_phy_init_script_igp3 - Inits the IGP3 PHY : pointer to the HW structure

Initializes a Intel Gigabit PHY3 when an EEPROM is not present.

Definition at line 2088 of file e1000_phy.c.

s32 igb_phy_sw_reset ( struct e1000_hw hw)

igb_phy_sw_reset - PHY software reset : pointer to the HW structure

Does a software reset of the PHY by reading the PHY control register and setting/write the control register reset bit to the PHY.

Definition at line 2015 of file e1000_phy.c.

void igb_power_down_phy_copper ( struct e1000_hw hw)

igb_power_down_phy_copper - Power down copper PHY : pointer to the HW structure

Power down PHY to save power when interface is down and wake on lan is not enabled.

Definition at line 2197 of file e1000_phy.c.

void igb_power_up_phy_copper ( struct e1000_hw hw)

igb_power_up_phy_copper - Restore copper link in case of PHY power down : pointer to the HW structure

In the case of a PHY power down to save power, or to turn off link during a driver unload, restore the link to previous settings.

Definition at line 2174 of file e1000_phy.c.

s32 igb_read_phy_reg_gs40g ( struct e1000_hw hw,
u32  offset,
u16 data 
)

igb_read_phy_reg_gs40g - Read GS40G PHY register : pointer to the HW structure : lower half is register offset to read to upper half is page to use. : data to read at register offset

Acquires semaphore, if necessary, then reads the data in the PHY register at the offset. Release any acquired semaphores before exiting.

Definition at line 2447 of file e1000_phy.c.

s32 igb_read_phy_reg_i2c ( struct e1000_hw hw,
u32  offset,
u16 data 
)

igb_read_phy_reg_i2c - Read PHY register using i2c : pointer to the HW structure : register offset to be read : pointer to the read data

Reads the PHY register at offset using the i2c interface and stores the retrieved information in data.

Definition at line 257 of file e1000_phy.c.

s32 igb_read_phy_reg_igp ( struct e1000_hw hw,
u32  offset,
u16 data 
)

igb_read_phy_reg_igp - Read igp PHY register : pointer to the HW structure : register offset to be read : pointer to the read data

Acquires semaphore, if necessary, then reads the PHY register at offset and storing the retrieved information in data. Release any acquired semaphores before exiting.

Definition at line 361 of file e1000_phy.c.

s32 igb_read_phy_reg_mdic ( struct e1000_hw hw,
u32  offset,
u16 data 
)

igb_read_phy_reg_mdic - Read MDI control register : pointer to the HW structure : register offset to be read : pointer to the read data

Reads the MDI control regsiter in the PHY at offset and stores the information read to data.

Definition at line 140 of file e1000_phy.c.

s32 igb_set_d3_lplu_state ( struct e1000_hw hw,
bool  active 
)

igb_set_d3_lplu_state - Sets low power link up state for D3 : pointer to the HW structure : boolean used to enable/disable lplu

Success returns 0, Failure returns 1

The low power link up (lplu) state is set to the power management level D3 and SmartSpeed is disabled when active is true, else clear lplu for D3 and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU is used during Dx states where the power conservation is most important. During driver activity, SmartSpeed should be enabled so performance is maintained.

Definition at line 1396 of file e1000_phy.c.

s32 igb_setup_copper_link ( struct e1000_hw hw)

igb_setup_copper_link - Configure copper link settings : pointer to the HW structure

Calls the appropriate function to configure the link for auto-neg or forced speed and duplex. Then we check for link, once link is established calls to configure collision distance and flow control are called. If link is not established, we return -E1000_ERR_PHY (-2).

Definition at line 1073 of file e1000_phy.c.

s32 igb_write_phy_reg_gs40g ( struct e1000_hw hw,
u32  offset,
u16  data 
)

igb_write_phy_reg_gs40g - Write GS40G PHY register : pointer to the HW structure : lower half is register offset to write to upper half is page to use. : data to write at register offset

Acquires semaphore, if necessary, then writes the data to PHY register at the offset. Release any acquired semaphores before exiting.

Definition at line 2417 of file e1000_phy.c.

s32 igb_write_phy_reg_i2c ( struct e1000_hw hw,
u32  offset,
u16  data 
)

igb_write_phy_reg_i2c - Write PHY register using i2c : pointer to the HW structure : register offset to write to : data to write at register offset

Writes the data to PHY register at the offset using the i2c interface.

Definition at line 304 of file e1000_phy.c.

s32 igb_write_phy_reg_igp ( struct e1000_hw hw,
u32  offset,
u16  data 
)

igb_write_phy_reg_igp - Write igp PHY register : pointer to the HW structure : register offset to write to : data to write at register offset

Acquires semaphore, if necessary, then writes the data to PHY register at the offset. Release any acquired semaphores before exiting.

Definition at line 400 of file e1000_phy.c.

s32 igb_write_phy_reg_mdic ( struct e1000_hw hw,
u32  offset,
u16  data 
)

igb_write_phy_reg_mdic - Write MDI control register : pointer to the HW structure : register offset to write to : data to write to register at offset

Writes data to MDI control register in the PHY at offset.

Definition at line 198 of file e1000_phy.c.