igc: Expose the gPHY firmware version
Subsystems (2)
PATCH 1/1 igc: Expose the gPHY firmware version
Complete to commit 6093e11d357d ("igc: Expose the NVM version") and expose the gPHY (i225 PHY) firmware version
Signed-off-by Sasha Neftin <[email protected]>
--- drivers/net/ethernet/intel/igc/igc.h | 2 +- drivers/net/ethernet/intel/igc/igc_ethtool.c | 9 +++++++-- drivers/net/ethernet/intel/igc/igc_phy.c | 19 +++++++++++++++++++ drivers/net/ethernet/intel/igc/igc_phy.h | 1 + drivers/net/ethernet/intel/igc/igc_regs.h | 1 + 5 files changed, 29 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/igc/igc.h +1 -1
@@ -221,7 +221,7 @@ struct igc_adapter {ktime_t ptp_reset_start;/* Reset time in clock mono */ struct bpf_prog *xdp_prog; -char fw_version[16 ]; +char fw_version[32 ]; };void igc_up (struct igc_adapter *adapter);
drivers/net/ethernet/intel/igc/igc_ethtool.c +7 -2
@@ -131,16 +131,21 @@ static void igc_ethtool_get_drvinfo(struct net_device *netdev,struct igc_adapter *adapter =netdev_priv (netdev);struct igc_hw *hw = &adapter->hw;u16 nvm_version =0 ; +u16 gphy_version =0 ;strlcpy (drvinfo->driver, igc_driver_name,sizeof (drvinfo->driver));/* NVM image version is reported as firmware version for i225 device */ hw->nvm.ops.read (hw,IGC_NVM_DEV_STARTER ,1 , &nvm_version); +/* gPHY firmware version is reported as PHY FW version */ + gphy_version =igc_read_phy_fw_version (hw); +scnprintf (adapter->fw_version,sizeof (adapter->fw_version), -"%x" , - nvm_version); +"%x:%x" , + nvm_version, + gphy_version);strlcpy (drvinfo->fw_version, adapter->fw_version,sizeof (drvinfo->fw_version));
drivers/net/ethernet/intel/igc/igc_phy.c +19 -0
@@ -791,3 +791,22 @@ s32 igc_read_phy_reg_gpy(struct igc_hw *hw, u32 offset, u16 *data)return ret_val; } + +/** +* igc_read_phy_fw_version - Read gPHY 211 firmware version +* @hw: pointer to the HW structure +*/ +u16 igc_read_phy_fw_version (struct igc_hw *hw) +{ +struct igc_phy_info *phy = &hw->phy; +u16 gphy_version =0 ; +u16 ret_val =0 ; + +/* NVM image version is reported as firmware version for i225 device */ + ret_val = phy->ops.read_reg (hw,IGC_GPHY_VERSION , &gphy_version); + +if (ret_val) +hw_dbg ("igc_phy: read wrong gphy version\n" ); + +return gphy_version; +}
drivers/net/ethernet/intel/igc/igc_phy.h +1 -0
@@ -17,5 +17,6 @@ void igc_power_up_phy_copper(struct igc_hw *hw);void igc_power_down_phy_copper (struct igc_hw *hw);s32 igc_write_phy_reg_gpy (struct igc_hw *hw,u32 offset,u16 data);s32 igc_read_phy_reg_gpy (struct igc_hw *hw,u32 offset,u16 *data); +u16 igc_read_phy_fw_version (struct igc_hw *hw);#endif
drivers/net/ethernet/intel/igc/igc_regs.h +1 -0
@@ -13,6 +13,7 @@#define IGC_MDICNFG 0x00E04/* MDC/MDIO Configuration - RW */ #define IGC_CONNSW 0x00034/* Copper/Fiber switch control - RW */ #define IGC_I225_PHPM 0x00E14/* I225 PHY Power Management */ +#define IGC_GPHY_VERSION 0x0001E/* I225 gPHY Firmware Version */ /* Internal Packet Buffer Size Registers */ #define IGC_RXPBS 0x02404/* Rx Packet Buffer Size - RW */
Signature · 1 line
2.20.1