Merge branch 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[safe/jmp/linux-2.6] / drivers / net / ixgbe / ixgbe_phy.c
index 6d385ea..1c1efd3 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2009 Intel Corporation.
+  Copyright(c) 1999 - 2010 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
@@ -60,6 +60,7 @@ s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw)
 
        if (hw->phy.type == ixgbe_phy_unknown) {
                for (phy_addr = 0; phy_addr < IXGBE_MAX_PHY_ADDR; phy_addr++) {
+                       hw->phy.mdio.prtad = phy_addr;
                        if (mdio45_probe(&hw->phy.mdio, phy_addr) == 0) {
                                ixgbe_get_phy_id(hw);
                                hw->phy.type =
@@ -68,6 +69,8 @@ s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw)
                                break;
                        }
                }
+               /* clear value if nothing found */
+               hw->phy.mdio.prtad = 0;
        } else {
                status = 0;
        }
@@ -527,14 +530,25 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
        u8 comp_codes_1g = 0;
        u8 comp_codes_10g = 0;
        u8 oui_bytes[3] = {0, 0, 0};
-       u8 transmission_media = 0;
+       u8 cable_tech = 0;
        u16 enforce_sfp = 0;
 
+       if (hw->mac.ops.get_media_type(hw) != ixgbe_media_type_fiber) {
+               hw->phy.sfp_type = ixgbe_sfp_type_not_present;
+               status = IXGBE_ERR_SFP_NOT_PRESENT;
+               goto out;
+       }
+
        status = hw->phy.ops.read_i2c_eeprom(hw, IXGBE_SFF_IDENTIFIER,
                                             &identifier);
 
-       if (status == IXGBE_ERR_SFP_NOT_PRESENT) {
+       if (status == IXGBE_ERR_SFP_NOT_PRESENT || status == IXGBE_ERR_I2C) {
+               status = IXGBE_ERR_SFP_NOT_PRESENT;
                hw->phy.sfp_type = ixgbe_sfp_type_not_present;
+               if (hw->phy.type != ixgbe_phy_nl) {
+                       hw->phy.id = 0;
+                       hw->phy.type = ixgbe_phy_unknown;
+               }
                goto out;
        }
 
@@ -543,8 +557,8 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
                                            &comp_codes_1g);
                hw->phy.ops.read_i2c_eeprom(hw, IXGBE_SFF_10GBE_COMP_CODES,
                                            &comp_codes_10g);
-               hw->phy.ops.read_i2c_eeprom(hw, IXGBE_SFF_TRANSMISSION_MEDIA,
-                                           &transmission_media);
+               hw->phy.ops.read_i2c_eeprom(hw, IXGBE_SFF_CABLE_TECHNOLOGY,
+                                           &cable_tech);
 
                /* ID Module
                 * =========
@@ -557,7 +571,7 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
                 * 6    SFP_SR/LR_CORE1 - 82599-specific
                 */
                if (hw->mac.type == ixgbe_mac_82598EB) {
-                       if (transmission_media & IXGBE_SFF_TWIN_AX_CAPABLE)
+                       if (cable_tech & IXGBE_SFF_DA_PASSIVE_CABLE)
                                hw->phy.sfp_type = ixgbe_sfp_type_da_cu;
                        else if (comp_codes_10g & IXGBE_SFF_10GBASESR_CAPABLE)
                                hw->phy.sfp_type = ixgbe_sfp_type_sr;
@@ -566,7 +580,7 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
                        else
                                hw->phy.sfp_type = ixgbe_sfp_type_unknown;
                } else if (hw->mac.type == ixgbe_mac_82599EB) {
-                       if (transmission_media & IXGBE_SFF_TWIN_AX_CAPABLE)
+                       if (cable_tech & IXGBE_SFF_DA_PASSIVE_CABLE)
                                if (hw->bus.lan_id == 0)
                                        hw->phy.sfp_type =
                                                     ixgbe_sfp_type_da_cu_core0;
@@ -595,6 +609,7 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
                        hw->phy.sfp_setup_needed = true;
 
                /* Determine if the SFP+ PHY is dual speed or not. */
+               hw->phy.multispeed_fiber = false;
                if (((comp_codes_1g & IXGBE_SFF_1GBASESX_CAPABLE) &&
                   (comp_codes_10g & IXGBE_SFF_10GBASESR_CAPABLE)) ||
                   ((comp_codes_1g & IXGBE_SFF_1GBASELX_CAPABLE) &&
@@ -621,8 +636,7 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
 
                        switch (vendor_oui) {
                        case IXGBE_SFF_VENDOR_OUI_TYCO:
-                               if (transmission_media &
-                                   IXGBE_SFF_TWIN_AX_CAPABLE)
+                               if (cable_tech & IXGBE_SFF_DA_PASSIVE_CABLE)
                                        hw->phy.type = ixgbe_phy_tw_tyco;
                                break;
                        case IXGBE_SFF_VENDOR_OUI_FTL:
@@ -635,8 +649,7 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
                                hw->phy.type = ixgbe_phy_sfp_intel;
                                break;
                        default:
-                               if (transmission_media &
-                                   IXGBE_SFF_TWIN_AX_CAPABLE)
+                               if (cable_tech & IXGBE_SFF_DA_PASSIVE_CABLE)
                                        hw->phy.type = ixgbe_phy_tw_unknown;
                                else
                                        hw->phy.type = ixgbe_phy_sfp_unknown;
@@ -644,8 +657,8 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
                        }
                }
 
-               /* All DA cables are supported */
-               if (transmission_media & IXGBE_SFF_TWIN_AX_CAPABLE) {
+               /* All passive DA cables are supported */
+               if (cable_tech & IXGBE_SFF_DA_PASSIVE_CABLE) {
                        status = 0;
                        goto out;
                }