igc: Add code for PHY support
Subsystems (2)
PATCH v6 9/11 igc: Add code for PHY support
Sasha Neftin (v2):
minor cosmetic changes
Alexander Duyck (v3.5):
Made non-gpy versions of phy functions static
Move xmdio functions to avoid need for prototype function Move reset, read_reg, and write_reg ops into e1000_phy_ops_base Drop code implying more than one function
Fix merge conflict with v3.5 of NVM code.
Sasha Neftin (v3):
Introduce temporary workaround for PHY power down.
Sasha Neftin (v4):
address comments
remove space
fix minor grammar typo
replace e1000_ prefix with igc_ prefix
Sasha Neftin (v5):
update IGC_GEN_POLL_TIMEOUT value to 1920
fix code indentation
Sasha Neftin (v6):
remove double defines from igc_defines.h
remove unused defines from igc_defines.h
remove unused code from igc_phy.c
fix enum igc_bus_type definition
minor cosmetic changes
--- drivers/net/ethernet/intel/igc/Makefile | 2 +- drivers/net/ethernet/intel/igc/igc.h | 16 + drivers/net/ethernet/intel/igc/igc_base.c | 125 +++++ drivers/net/ethernet/intel/igc/igc_base.h | 1 + drivers/net/ethernet/intel/igc/igc_defines.h | 79 ++++ drivers/net/ethernet/intel/igc/igc_hw.h | 54 +++ drivers/net/ethernet/intel/igc/igc_mac.c | 45 ++ drivers/net/ethernet/intel/igc/igc_mac.h | 11 + drivers/net/ethernet/intel/igc/igc_main.c | 11 + drivers/net/ethernet/intel/igc/igc_phy.c | 456 +++++++++++++++++++ drivers/net/ethernet/intel/igc/igc_phy.h | 20 + drivers/net/ethernet/intel/igc/igc_regs.h | 3 + 12 files changed, 822 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/intel/igc/igc_phy.c create mode 100644 drivers/net/ethernet/intel/igc/igc_phy.h
drivers/net/ethernet/intel/igc/Makefile +1 -1
@@ -7,4 +7,4 @@ obj-$(CONFIG_IGC) += igc.o -igc-objs := igc_main.o igc_mac.o igc_i225.o igc_base.o igc_nvm.o +igc-objs := igc_main.o igc_mac.o igc_i225.o igc_base.o igc_nvm.o igc_phy.o
drivers/net/ethernet/intel/igc/igc.h +16 -0
@@ -365,6 +365,22 @@ static inline u16 igc_desc_unused(const struct igc_ring *ring)return ((ntc > ntu) ?0 : ring->count) + ntc - ntu -1 ; } +static inline s32 igc_get_phy_info (struct igc_hw *hw) +{ +if (hw->phy.ops.get_phy_info) +return hw->phy.ops.get_phy_info (hw); + +return 0 ; +} + +static inline s32 igc_reset_phy (struct igc_hw *hw) +{ +if (hw->phy.ops.reset) +return hw->phy.ops.reset (hw); + +return 0 ; +} +static inline struct netdev_queue *txring_txq (const struct igc_ring *tx_ring) {return netdev_get_tx_queue (tx_ring->netdev, tx_ring->queue_index);
drivers/net/ethernet/intel/igc/igc_base.c +125 -0
169 lines not on this page · raw message
drivers/net/ethernet/intel/igc/igc_base.h +1 -0
@@ -6,6 +6,7 @@/* forward declaration */ void igc_rx_fifo_flush_base (struct igc_hw *hw); +void igc_power_down_phy_copper_base (struct igc_hw *hw);/* Transmit Descriptor - Advanced */ union igc_adv_tx_desc {
drivers/net/ethernet/intel/igc/igc_defines.h +79 -0
108 lines not on this page · raw message
drivers/net/ethernet/intel/igc/igc_hw.h +54 -0
96 lines not on this page · raw message
drivers/net/ethernet/intel/igc/igc_mac.c +45 -0
60 lines not on this page · raw message
drivers/net/ethernet/intel/igc/igc_mac.h +11 -0
@@ -5,6 +5,7 @@#define _IGC_MAC_H_#include "igc_hw.h" +#include "igc_phy.h" #include "igc_defines.h" #ifndef IGC_REMOVED
@@ -26,4 +27,14 @@ s32 igc_get_bus_info_pcie(struct igc_hw *hw);s32 igc_get_speed_and_duplex_copper (struct igc_hw *hw,u16 *speed,u16 *duplex); +bool igc_enable_mng_pass_thru (struct igc_hw *hw); + +enum igc_mng_mode { + igc_mng_mode_none =0 , + igc_mng_mode_asf, + igc_mng_mode_pt, + igc_mng_mode_ipmi, + igc_mng_mode_host_if_only +}; +#endif
drivers/net/ethernet/intel/igc/igc_main.c +11 -0
@@ -100,6 +100,8 @@ static void igc_reset(struct igc_adapter *adapter)if (!netif_running (adapter->netdev))igc_power_down_link (adapter); + +igc_get_phy_info (hw); }/**
@@ -108,6 +110,12 @@ static void igc_reset(struct igc_adapter *adapter)**/ static void igc_power_up_link (struct igc_adapter *adapter) { +igc_reset_phy (&adapter->hw); + +if (adapter->hw.phy.media_type == igc_media_type_copper) +igc_power_up_phy_copper (&adapter->hw); + +igc_setup_link (&adapter->hw); }/**
@@ -116,6 +124,8 @@ static void igc_power_up_link(struct igc_adapter *adapter)**/ static void igc_power_down_link (struct igc_adapter *adapter) { +if (adapter->hw.phy.media_type == igc_media_type_copper) +igc_power_down_phy_copper_base (&adapter->hw); }/**
@@ -3399,6 +3409,7 @@ static int igc_probe(struct pci_dev *pdev,/* Copy the default MAC and PHY function pointers */ memcpy (&hw->mac.ops, ei->mac_ops,sizeof (hw->mac.ops)); +memcpy (&hw->phy.ops, ei->phy_ops,sizeof (hw->phy.ops));/* Initialize skew-specific constants */ err = ei->get_invariants (hw);
drivers/net/ethernet/intel/igc/igc_phy.c new file +456 -0
456 lines not on this page · raw message
drivers/net/ethernet/intel/igc/igc_phy.h new file +20 -0
@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (c) 2018 Intel Corporation */ + +#ifndef _IGC_PHY_H_ +#define _IGC_PHY_H_ + +#include "igc_mac.h" + +s32 igc_check_reset_block (struct igc_hw *hw); +s32 igc_phy_hw_reset (struct igc_hw *hw); +s32 igc_get_phy_id (struct igc_hw *hw); +s32 igc_phy_has_link (struct igc_hw *hw,u32 iterations, +u32 usec_interval,bool *success); +s32 igc_check_downshift (struct igc_hw *hw); +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); + +#endif
drivers/net/ethernet/intel/igc/igc_regs.h +3 -0
@@ -39,6 +39,9 @@#define IGC_SWSM 0x05B50/* SW Semaphore */ #define IGC_FWSM 0x05B54/* FW Semaphore */ +/* Function Active and Power State to MNG */ +#define IGC_FACTPS 0x05B30 +/* Interrupt Register Description */ #define IGC_EICS 0x01520/* Ext. Interrupt Cause Set - W0 */ #define IGC_EIMS 0x01524/* Ext. Interrupt Mask Set/Read - RW */
Signature · 1 line
2.18.0