vserver 2.0 rc7
[linux-2.6.git] / drivers / net / ixgb / ixgb_ee.c
index 97b5b16..3aae110 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   
-  Copyright(c) 1999 - 2004 Intel Corporation. All rights reserved.
+  Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
   
   This program is free software; you can redistribute it and/or modify it 
   under the terms of the GNU General Public License as published by the Free 
@@ -372,11 +372,11 @@ ixgb_update_eeprom_checksum(struct ixgb_hw *hw)
  *
  *****************************************************************************/
 void
-ixgb_write_eeprom(struct ixgb_hw *hw,
-                  uint16_t offset,
-                  uint16_t data)
+ixgb_write_eeprom(struct ixgb_hw *hw, uint16_t offset, uint16_t data)
 {
-       /*  Prepare the EEPROM for writing  */
+       struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
+
+       /* Prepare the EEPROM for writing */
        ixgb_setup_eeprom(hw);
 
        /*  Send the 9-bit EWEN (write enable) command to the EEPROM (5-bit opcode
@@ -410,6 +410,9 @@ ixgb_write_eeprom(struct ixgb_hw *hw,
        /*  Done with writing  */
        ixgb_cleanup_eeprom(hw);
 
+       /* clear the init_ctrl_reg_1 to signify that the cache is invalidated */
+       ee_map->init_ctrl_reg_1 = le16_to_cpu(EEPROM_ICW1_SIGNATURE_CLEAR);
+
        return;
 }
 
@@ -478,6 +481,9 @@ ixgb_get_eeprom_data(struct ixgb_hw *hw)
 
        if (checksum != (uint16_t) EEPROM_SUM) {
                DEBUGOUT("ixgb_ee: Checksum invalid.\n");
+               /* clear the init_ctrl_reg_1 to signify that the cache is
+                * invalidated */
+               ee_map->init_ctrl_reg_1 = le16_to_cpu(EEPROM_ICW1_SIGNATURE_CLEAR);
                return (FALSE);
        }
 
@@ -573,7 +579,7 @@ ixgb_get_ee_compatibility(struct ixgb_hw *hw)
        struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
 
        if(ixgb_check_and_get_eeprom_data(hw) == TRUE)
-               return(ee_map->compatibility);
+               return (le16_to_cpu(ee_map->compatibility));
 
        return(0);
 }
@@ -610,7 +616,7 @@ ixgb_get_ee_init_ctrl_reg_1(struct ixgb_hw *hw)
        struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
 
        if(ixgb_check_and_get_eeprom_data(hw) == TRUE)
-               return(ee_map->init_ctrl_reg_1);
+               return (le16_to_cpu(ee_map->init_ctrl_reg_1));
 
        return(0);
 }
@@ -629,7 +635,7 @@ ixgb_get_ee_init_ctrl_reg_2(struct ixgb_hw *hw)
        struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
 
        if(ixgb_check_and_get_eeprom_data(hw) == TRUE)
-               return(ee_map->init_ctrl_reg_2);
+               return (le16_to_cpu(ee_map->init_ctrl_reg_2));
 
        return(0);
 }
@@ -648,7 +654,7 @@ ixgb_get_ee_subsystem_id(struct ixgb_hw *hw)
        struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
 
        if(ixgb_check_and_get_eeprom_data(hw) == TRUE)
-          return(ee_map->subsystem_id);
+               return (le16_to_cpu(ee_map->subsystem_id));
 
        return(0);
 }
@@ -667,7 +673,7 @@ ixgb_get_ee_subvendor_id(struct ixgb_hw *hw)
        struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
 
        if(ixgb_check_and_get_eeprom_data(hw) == TRUE)
-               return(ee_map->subvendor_id);
+               return (le16_to_cpu(ee_map->subvendor_id));
 
        return(0);
 }
@@ -686,7 +692,7 @@ ixgb_get_ee_device_id(struct ixgb_hw *hw)
        struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
 
        if(ixgb_check_and_get_eeprom_data(hw) == TRUE)
-               return(ee_map->device_id);
+               return (le16_to_cpu(ee_map->device_id));
 
        return(0);
 }
@@ -705,7 +711,7 @@ ixgb_get_ee_vendor_id(struct ixgb_hw *hw)
        struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
 
        if(ixgb_check_and_get_eeprom_data(hw) == TRUE)
-               return(ee_map->vendor_id);
+               return (le16_to_cpu(ee_map->vendor_id));
 
        return(0);
 }
@@ -724,7 +730,7 @@ ixgb_get_ee_swdpins_reg(struct ixgb_hw *hw)
        struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
 
        if(ixgb_check_and_get_eeprom_data(hw) == TRUE)
-               return(ee_map->swdpins_reg);
+               return (le16_to_cpu(ee_map->swdpins_reg));
 
        return(0);
 }
@@ -743,7 +749,7 @@ ixgb_get_ee_d3_power(struct ixgb_hw *hw)
        struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
 
        if(ixgb_check_and_get_eeprom_data(hw) == TRUE)
-               return(ee_map->d3_power);
+               return (le16_to_cpu(ee_map->d3_power));
 
        return(0);
 }
@@ -762,7 +768,7 @@ ixgb_get_ee_d0_power(struct ixgb_hw *hw)
        struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
 
        if(ixgb_check_and_get_eeprom_data(hw) == TRUE)
-               return(ee_map->d0_power);
+               return (le16_to_cpu(ee_map->d0_power));
 
        return(0);
 }