Commit 306ebc09 authored by Jeff Garzik's avatar Jeff Garzik

Merge pobox.com:/garz/repo/netdev-2.6/e1000

into pobox.com:/garz/repo/net-drivers-2.6
parents 8672a651 f4f57a52
...@@ -138,6 +138,7 @@ struct e1000_adapter; ...@@ -138,6 +138,7 @@ struct e1000_adapter;
#define E1000_RX_BUFFER_WRITE 16 /* Must be power of 2 */ #define E1000_RX_BUFFER_WRITE 16 /* Must be power of 2 */
#define AUTO_ALL_MODES 0 #define AUTO_ALL_MODES 0
#define E1000_EEPROM_82544_APM 0x0004
#define E1000_EEPROM_APME 0x0400 #define E1000_EEPROM_APME 0x0400
#ifndef E1000_MASTER_SLAVE #ifndef E1000_MASTER_SLAVE
...@@ -209,6 +210,7 @@ struct e1000_adapter { ...@@ -209,6 +210,7 @@ struct e1000_adapter {
/* TX */ /* TX */
struct e1000_desc_ring tx_ring; struct e1000_desc_ring tx_ring;
struct e1000_buffer previous_buffer_info;
spinlock_t tx_lock; spinlock_t tx_lock;
uint32_t txd_cmd; uint32_t txd_cmd;
uint32_t tx_int_delay; uint32_t tx_int_delay;
...@@ -222,6 +224,7 @@ struct e1000_adapter { ...@@ -222,6 +224,7 @@ struct e1000_adapter {
uint32_t tx_fifo_size; uint32_t tx_fifo_size;
atomic_t tx_fifo_stall; atomic_t tx_fifo_stall;
boolean_t pcix_82544; boolean_t pcix_82544;
boolean_t detect_tx_hung;
/* RX */ /* RX */
struct e1000_desc_ring rx_ring; struct e1000_desc_ring rx_ring;
......
...@@ -1310,7 +1310,7 @@ e1000_run_loopback_test(struct e1000_adapter *adapter) ...@@ -1310,7 +1310,7 @@ e1000_run_loopback_test(struct e1000_adapter *adapter)
struct e1000_desc_ring *txdr = &adapter->test_tx_ring; struct e1000_desc_ring *txdr = &adapter->test_tx_ring;
struct e1000_desc_ring *rxdr = &adapter->test_rx_ring; struct e1000_desc_ring *rxdr = &adapter->test_rx_ring;
struct pci_dev *pdev = adapter->pdev; struct pci_dev *pdev = adapter->pdev;
int i; int i, ret_val;
E1000_WRITE_REG(&adapter->hw, RDT, rxdr->count - 1); E1000_WRITE_REG(&adapter->hw, RDT, rxdr->count - 1);
...@@ -1330,11 +1330,12 @@ e1000_run_loopback_test(struct e1000_adapter *adapter) ...@@ -1330,11 +1330,12 @@ e1000_run_loopback_test(struct e1000_adapter *adapter)
rxdr->buffer_info[i].length, rxdr->buffer_info[i].length,
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
if (!e1000_check_lbtest_frame(rxdr->buffer_info[i++].skb, 1024)) ret_val = e1000_check_lbtest_frame(rxdr->buffer_info[i].skb,
return 0; 1024);
} while (i < 64); i++;
} while (ret_val != 0 && i < 64);
return 13; return ret_val;
} }
static int static int
......
...@@ -1572,7 +1572,8 @@ e1000_phy_force_speed_duplex(struct e1000_hw *hw) ...@@ -1572,7 +1572,8 @@ e1000_phy_force_speed_duplex(struct e1000_hw *hw)
if(mii_status_reg & MII_SR_LINK_STATUS) break; if(mii_status_reg & MII_SR_LINK_STATUS) break;
msec_delay(100); msec_delay(100);
} }
if((i == 0) && (hw->phy_type == e1000_phy_m88)) { if((i == 0) &&
(hw->phy_type == e1000_phy_m88)) {
/* We didn't get link. Reset the DSP and wait again for link. */ /* We didn't get link. Reset the DSP and wait again for link. */
ret_val = e1000_phy_reset_dsp(hw); ret_val = e1000_phy_reset_dsp(hw);
if(ret_val) { if(ret_val) {
...@@ -2503,7 +2504,7 @@ e1000_read_phy_reg(struct e1000_hw *hw, ...@@ -2503,7 +2504,7 @@ e1000_read_phy_reg(struct e1000_hw *hw,
} }
} }
ret_val = e1000_read_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT & reg_addr, ret_val = e1000_read_phy_reg_ex(hw, MAX_PHY_REG_ADDRESS & reg_addr,
phy_data); phy_data);
return ret_val; return ret_val;
...@@ -2609,7 +2610,7 @@ e1000_write_phy_reg(struct e1000_hw *hw, ...@@ -2609,7 +2610,7 @@ e1000_write_phy_reg(struct e1000_hw *hw,
} }
} }
ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT & reg_addr, ret_val = e1000_write_phy_reg_ex(hw, MAX_PHY_REG_ADDRESS & reg_addr,
phy_data); phy_data);
return ret_val; return ret_val;
...@@ -2955,8 +2956,7 @@ e1000_phy_m88_get_info(struct e1000_hw *hw, ...@@ -2955,8 +2956,7 @@ e1000_phy_m88_get_info(struct e1000_hw *hw,
/* Check polarity status */ /* Check polarity status */
ret_val = e1000_check_polarity(hw, &polarity); ret_val = e1000_check_polarity(hw, &polarity);
if(ret_val) if(ret_val)
return ret_val; return ret_val;
phy_info->cable_polarity = polarity; phy_info->cable_polarity = polarity;
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data);
...@@ -2966,9 +2966,9 @@ e1000_phy_m88_get_info(struct e1000_hw *hw, ...@@ -2966,9 +2966,9 @@ e1000_phy_m88_get_info(struct e1000_hw *hw,
phy_info->mdix_mode = (phy_data & M88E1000_PSSR_MDIX) >> phy_info->mdix_mode = (phy_data & M88E1000_PSSR_MDIX) >>
M88E1000_PSSR_MDIX_SHIFT; M88E1000_PSSR_MDIX_SHIFT;
if(phy_data & M88E1000_PSSR_1000MBS) { if ((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_1000MBS) {
/* Cable Length Estimation and Local/Remote Receiver Informatoion /* Cable Length Estimation and Local/Remote Receiver Information
* are only valid at 1000 Mbps * are only valid at 1000 Mbps.
*/ */
phy_info->cable_length = ((phy_data & M88E1000_PSSR_CABLE_LENGTH) >> phy_info->cable_length = ((phy_data & M88E1000_PSSR_CABLE_LENGTH) >>
M88E1000_PSSR_CABLE_LENGTH_SHIFT); M88E1000_PSSR_CABLE_LENGTH_SHIFT);
...@@ -4639,41 +4639,44 @@ e1000_get_bus_info(struct e1000_hw *hw) ...@@ -4639,41 +4639,44 @@ e1000_get_bus_info(struct e1000_hw *hw)
{ {
uint32_t status; uint32_t status;
if(hw->mac_type < e1000_82543) { switch (hw->mac_type) {
case e1000_82542_rev2_0:
case e1000_82542_rev2_1:
hw->bus_type = e1000_bus_type_unknown; hw->bus_type = e1000_bus_type_unknown;
hw->bus_speed = e1000_bus_speed_unknown; hw->bus_speed = e1000_bus_speed_unknown;
hw->bus_width = e1000_bus_width_unknown; hw->bus_width = e1000_bus_width_unknown;
return; break;
} default:
status = E1000_READ_REG(hw, STATUS);
status = E1000_READ_REG(hw, STATUS); hw->bus_type = (status & E1000_STATUS_PCIX_MODE) ?
hw->bus_type = (status & E1000_STATUS_PCIX_MODE) ? e1000_bus_type_pcix : e1000_bus_type_pci;
e1000_bus_type_pcix : e1000_bus_type_pci;
if(hw->device_id == E1000_DEV_ID_82546EB_QUAD_COPPER) {
if(hw->device_id == E1000_DEV_ID_82546EB_QUAD_COPPER) { hw->bus_speed = (hw->bus_type == e1000_bus_type_pci) ?
hw->bus_speed = (hw->bus_type == e1000_bus_type_pci) ? e1000_bus_speed_66 : e1000_bus_speed_120;
e1000_bus_speed_66 : e1000_bus_speed_120; } else if(hw->bus_type == e1000_bus_type_pci) {
} else if(hw->bus_type == e1000_bus_type_pci) { hw->bus_speed = (status & E1000_STATUS_PCI66) ?
hw->bus_speed = (status & E1000_STATUS_PCI66) ? e1000_bus_speed_66 : e1000_bus_speed_33;
e1000_bus_speed_66 : e1000_bus_speed_33; } else {
} else { switch (status & E1000_STATUS_PCIX_SPEED) {
switch (status & E1000_STATUS_PCIX_SPEED) { case E1000_STATUS_PCIX_SPEED_66:
case E1000_STATUS_PCIX_SPEED_66: hw->bus_speed = e1000_bus_speed_66;
hw->bus_speed = e1000_bus_speed_66; break;
break; case E1000_STATUS_PCIX_SPEED_100:
case E1000_STATUS_PCIX_SPEED_100: hw->bus_speed = e1000_bus_speed_100;
hw->bus_speed = e1000_bus_speed_100; break;
break; case E1000_STATUS_PCIX_SPEED_133:
case E1000_STATUS_PCIX_SPEED_133: hw->bus_speed = e1000_bus_speed_133;
hw->bus_speed = e1000_bus_speed_133; break;
break; default:
default: hw->bus_speed = e1000_bus_speed_reserved;
hw->bus_speed = e1000_bus_speed_reserved; break;
break; }
} }
hw->bus_width = (status & E1000_STATUS_BUS64) ?
e1000_bus_width_64 : e1000_bus_width_32;
break;
} }
hw->bus_width = (status & E1000_STATUS_BUS64) ?
e1000_bus_width_64 : e1000_bus_width_32;
} }
/****************************************************************************** /******************************************************************************
* Reads a value from one of the devices registers using port I/O (as opposed * Reads a value from one of the devices registers using port I/O (as opposed
...@@ -4738,6 +4741,7 @@ e1000_get_cable_length(struct e1000_hw *hw, ...@@ -4738,6 +4741,7 @@ e1000_get_cable_length(struct e1000_hw *hw,
uint16_t agc_value = 0; uint16_t agc_value = 0;
uint16_t cur_agc, min_agc = IGP01E1000_AGC_LENGTH_TABLE_SIZE; uint16_t cur_agc, min_agc = IGP01E1000_AGC_LENGTH_TABLE_SIZE;
uint16_t i, phy_data; uint16_t i, phy_data;
uint16_t cable_length;
DEBUGFUNC("e1000_get_cable_length"); DEBUGFUNC("e1000_get_cable_length");
...@@ -4749,10 +4753,11 @@ e1000_get_cable_length(struct e1000_hw *hw, ...@@ -4749,10 +4753,11 @@ e1000_get_cable_length(struct e1000_hw *hw,
&phy_data); &phy_data);
if(ret_val) if(ret_val)
return ret_val; return ret_val;
cable_length = (phy_data & M88E1000_PSSR_CABLE_LENGTH) >>
M88E1000_PSSR_CABLE_LENGTH_SHIFT;
/* Convert the enum value to ranged values */ /* Convert the enum value to ranged values */
switch((phy_data & M88E1000_PSSR_CABLE_LENGTH) >> switch (cable_length) {
M88E1000_PSSR_CABLE_LENGTH_SHIFT) {
case e1000_cable_length_50: case e1000_cable_length_50:
*min_length = 0; *min_length = 0;
*max_length = e1000_igp_cable_length_50; *max_length = e1000_igp_cable_length_50;
...@@ -4919,8 +4924,7 @@ e1000_check_downshift(struct e1000_hw *hw) ...@@ -4919,8 +4924,7 @@ e1000_check_downshift(struct e1000_hw *hw)
return ret_val; return ret_val;
hw->speed_downgraded = (phy_data & IGP01E1000_PLHR_SS_DOWNGRADE) ? 1 : 0; hw->speed_downgraded = (phy_data & IGP01E1000_PLHR_SS_DOWNGRADE) ? 1 : 0;
} } else if(hw->phy_type == e1000_phy_m88) {
else if(hw->phy_type == e1000_phy_m88) {
ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS,
&phy_data); &phy_data);
if(ret_val) if(ret_val)
......
...@@ -369,6 +369,7 @@ int32_t e1000_set_d3_lplu_state(struct e1000_hw *hw, boolean_t active); ...@@ -369,6 +369,7 @@ int32_t e1000_set_d3_lplu_state(struct e1000_hw *hw, boolean_t active);
#define E1000_DEV_ID_82546GB_SERDES 0x107B #define E1000_DEV_ID_82546GB_SERDES 0x107B
#define E1000_DEV_ID_82546GB_PCIE 0x108A #define E1000_DEV_ID_82546GB_PCIE 0x108A
#define E1000_DEV_ID_82547EI 0x1019 #define E1000_DEV_ID_82547EI 0x1019
#define NODE_ADDRESS_SIZE 6 #define NODE_ADDRESS_SIZE 6
#define ETH_LENGTH_OF_ADDRESS 6 #define ETH_LENGTH_OF_ADDRESS 6
...@@ -1734,6 +1735,9 @@ struct e1000_hw { ...@@ -1734,6 +1735,9 @@ struct e1000_hw {
#define PHY_1000T_STATUS 0x0A /* 1000Base-T Status Reg */ #define PHY_1000T_STATUS 0x0A /* 1000Base-T Status Reg */
#define PHY_EXT_STATUS 0x0F /* Extended Status Reg */ #define PHY_EXT_STATUS 0x0F /* Extended Status Reg */
#define MAX_PHY_REG_ADDRESS 0x1F /* 5 bit address bus (0-0x1F) */
#define MAX_PHY_MULTI_PAGE_REG 0xF /* Registers equal on all pages */
/* M88E1000 Specific Registers */ /* M88E1000 Specific Registers */
#define M88E1000_PHY_SPEC_CTRL 0x10 /* PHY Specific Control Register */ #define M88E1000_PHY_SPEC_CTRL 0x10 /* PHY Specific Control Register */
#define M88E1000_PHY_SPEC_STATUS 0x11 /* PHY Specific Status Register */ #define M88E1000_PHY_SPEC_STATUS 0x11 /* PHY Specific Status Register */
...@@ -1794,8 +1798,7 @@ struct e1000_hw { ...@@ -1794,8 +1798,7 @@ struct e1000_hw {
#define IGP01E1000_ANALOG_REGS_PAGE 0x20C0 #define IGP01E1000_ANALOG_REGS_PAGE 0x20C0
#define MAX_PHY_REG_ADDRESS 0x1F /* 5 bit address bus (0-0x1F) */
#define MAX_PHY_MULTI_PAGE_REG 0xF /*Registers that are equal on all pages*/
/* PHY Control Register */ /* PHY Control Register */
#define MII_CR_SPEED_SELECT_MSB 0x0040 /* bits 6,13: 10=1000, 01=100, 00=10 */ #define MII_CR_SPEED_SELECT_MSB 0x0040 /* bits 6,13: 10=1000, 01=100, 00=10 */
#define MII_CR_COLL_TEST_ENABLE 0x0080 /* Collision test enable */ #define MII_CR_COLL_TEST_ENABLE 0x0080 /* Collision test enable */
...@@ -2098,7 +2101,11 @@ struct e1000_hw { ...@@ -2098,7 +2101,11 @@ struct e1000_hw {
#define IGP01E1000_ANALOG_FUSE_FINE_1 0x0080 #define IGP01E1000_ANALOG_FUSE_FINE_1 0x0080
#define IGP01E1000_ANALOG_FUSE_FINE_10 0x0500 #define IGP01E1000_ANALOG_FUSE_FINE_10 0x0500
/* Bit definitions for valid PHY IDs. */ /* Bit definitions for valid PHY IDs. */
/* I = Integrated
* E = External
*/
#define M88E1000_E_PHY_ID 0x01410C50 #define M88E1000_E_PHY_ID 0x01410C50
#define M88E1000_I_PHY_ID 0x01410C30 #define M88E1000_I_PHY_ID 0x01410C30
#define M88E1011_I_PHY_ID 0x01410C20 #define M88E1011_I_PHY_ID 0x01410C20
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment