Print this page
Import some changes from FreeBSD (details later, this is quick-n-dirty for now).
        
@@ -1,8 +1,8 @@
 /******************************************************************************
 
-  Copyright (c) 2001-2012, Intel Corporation 
+  Copyright (c) 2001-2013, Intel Corporation 
   All rights reserved.
   
   Redistribution and use in source and binary forms, with or without 
   modification, are permitted provided that the following conditions are met:
   
@@ -47,22 +47,21 @@
 static s32 ixgbe_check_mac_link_82598(struct ixgbe_hw *hw,
                                       ixgbe_link_speed *speed, bool *link_up,
                                       bool link_up_wait_to_complete);
 static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw,
                                       ixgbe_link_speed speed,
-                                      bool autoneg,
                                       bool autoneg_wait_to_complete);
 static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw,
                                          ixgbe_link_speed speed,
-                                         bool autoneg,
                                          bool autoneg_wait_to_complete);
 static s32 ixgbe_reset_hw_82598(struct ixgbe_hw *hw);
 static s32 ixgbe_clear_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq);
 static s32 ixgbe_clear_vfta_82598(struct ixgbe_hw *hw);
 static void ixgbe_set_rxpba_82598(struct ixgbe_hw *hw, int num_pb,
                                   u32 headroom, int strategy);
-
+static s32 ixgbe_read_i2c_sff8472_82598(struct ixgbe_hw *hw, u8 byte_offset,
+                                        u8 *sff8472_data);
 /**
  *  ixgbe_set_pcie_completion_timeout - set pci-e completion timeout
  *  @hw: pointer to the HW structure
  *
  *  The defaults for 82598 should be in the range of 50us to 50ms,
@@ -153,10 +152,11 @@
         mac->max_rx_queues      = 64;
         mac->max_msix_vectors   = ixgbe_get_pcie_msix_count_generic(hw);
 
         /* SFP+ Module */
         phy->ops.read_i2c_eeprom = &ixgbe_read_i2c_eeprom_82598;
+        phy->ops.read_i2c_sff8472 = &ixgbe_read_i2c_sff8472_82598;
 
         /* Link */
         mac->ops.check_link = &ixgbe_check_mac_link_82598;
         mac->ops.setup_link = &ixgbe_setup_mac_link_82598;
         mac->ops.flap_tx_laser = NULL;
@@ -715,13 +715,14 @@
  *  @autoneg_wait_to_complete: TRUE when waiting for completion is needed
  *
  *  Set the link speed in the AUTOC register and restarts link.
  **/
 static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw,
-                                      ixgbe_link_speed speed, bool autoneg,
+                                      ixgbe_link_speed speed,
                                       bool autoneg_wait_to_complete)
 {
+        bool autoneg = FALSE;
         s32 status;
         ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN;
         u32 curr_autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
         u32 autoc = curr_autoc;
         u32 link_mode = autoc & IXGBE_AUTOC_LMS_MASK;
@@ -765,26 +766,24 @@
 
 /**
  *  ixgbe_setup_copper_link_82598 - Set the PHY autoneg advertised field
  *  @hw: pointer to hardware structure
  *  @speed: new link speed
- *  @autoneg: TRUE if autonegotiation enabled
  *  @autoneg_wait_to_complete: TRUE if waiting is needed to complete
  *
  *  Sets the link speed in the AUTOC register in the MAC and restarts link.
  **/
 static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw,
                                          ixgbe_link_speed speed,
-                                         bool autoneg,
                                          bool autoneg_wait_to_complete)
 {
         s32 status;
 
         DEBUGFUNC("ixgbe_setup_copper_link_82598");
 
         /* Setup the PHY according to input speed */
-        status = hw->phy.ops.setup_link_speed(hw, speed, autoneg,
+        status = hw->phy.ops.setup_link_speed(hw, speed,
                                               autoneg_wait_to_complete);
         if (status == IXGBE_SUCCESS) {
                 /* Set up MAC */
                 status =
                     ixgbe_start_mac_link_82598(hw, autoneg_wait_to_complete);
@@ -1104,35 +1103,36 @@
 
         return IXGBE_SUCCESS;
 }
 
 /**
- *  ixgbe_read_i2c_eeprom_82598 - Reads 8 bit word over I2C interface.
+ *  ixgbe_read_i2c_phy_82598 - Reads 8 bit word over I2C interface.
  *  @hw: pointer to hardware structure
- *  @byte_offset: EEPROM byte offset to read
+ *  @dev_addr: address to read from
+ *  @byte_offset: byte offset to read from dev_addr
  *  @eeprom_data: value read
  *
  *  Performs 8 byte read operation to SFP module's EEPROM over I2C interface.
  **/
-s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u8 byte_offset,
-                                u8 *eeprom_data)
+static s32 ixgbe_read_i2c_phy_82598(struct ixgbe_hw *hw, u8 dev_addr,
+                                    u8 byte_offset, u8 *eeprom_data)
 {
         s32 status = IXGBE_SUCCESS;
         u16 sfp_addr = 0;
         u16 sfp_data = 0;
         u16 sfp_stat = 0;
         u32 i;
 
-        DEBUGFUNC("ixgbe_read_i2c_eeprom_82598");
+        DEBUGFUNC("ixgbe_read_i2c_phy_82598");
 
         if (hw->phy.type == ixgbe_phy_nl) {
                 /*
                  * NetLogic phy SDA/SCL registers are at addresses 0xC30A to
                  * 0xC30D. These registers are used to talk to the SFP+
                  * module's EEPROM through the SDA/SCL (I2C) interface.
                  */
-                sfp_addr = (IXGBE_I2C_EEPROM_DEV_ADDR << 8) + byte_offset;
+                sfp_addr = (dev_addr << 8) + byte_offset;
                 sfp_addr = (sfp_addr | IXGBE_I2C_EEPROM_READ_MASK);
                 hw->phy.ops.write_reg(hw,
                                       IXGBE_MDIO_PMA_PMD_SDA_SCL_ADDR,
                                       IXGBE_MDIO_PMA_PMD_DEV_TYPE,
                                       sfp_addr);
@@ -1160,17 +1160,46 @@
                                      IXGBE_MDIO_PMA_PMD_DEV_TYPE, &sfp_data);
 
                 *eeprom_data = (u8)(sfp_data >> 8);
         } else {
                 status = IXGBE_ERR_PHY;
-                goto out;
         }
 
 out:
         return status;
 }
 
+/**
+ *  ixgbe_read_i2c_eeprom_82598 - Reads 8 bit word over I2C interface.
+ *  @hw: pointer to hardware structure
+ *  @byte_offset: EEPROM byte offset to read
+ *  @eeprom_data: value read
+ *
+ *  Performs 8 byte read operation to SFP module's EEPROM over I2C interface.
+ **/
+s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u8 byte_offset,
+                                u8 *eeprom_data)
+{
+        return ixgbe_read_i2c_phy_82598(hw, IXGBE_I2C_EEPROM_DEV_ADDR,
+                                        byte_offset, eeprom_data);
+}
+
+/**
+ *  ixgbe_read_i2c_sff8472_82598 - Reads 8 bit word over I2C interface.
+ *  @hw: pointer to hardware structure
+ *  @byte_offset: byte offset at address 0xA2
+ *  @eeprom_data: value read
+ *
+ *  Performs 8 byte read operation to SFP module's SFF-8472 data over I2C
+ **/
+static s32 ixgbe_read_i2c_sff8472_82598(struct ixgbe_hw *hw, u8 byte_offset,
+                                        u8 *sff8472_data)
+{
+        return ixgbe_read_i2c_phy_82598(hw, IXGBE_I2C_EEPROM_DEV_ADDR2,
+                                        byte_offset, sff8472_data);
+}
+
 /**
  *  ixgbe_get_supported_physical_layer_82598 - Returns physical layer type
  *  @hw: pointer to hardware structure
  *
  *  Determines physical layer capabilities of the current configuration.