diff options
Diffstat (limited to 'drivers/net/ethernet/intel/igc/igc_ptp.c')
| -rw-r--r-- | drivers/net/ethernet/intel/igc/igc_ptp.c | 24 | 
1 files changed, 15 insertions, 9 deletions
| diff --git a/drivers/net/ethernet/intel/igc/igc_ptp.c b/drivers/net/ethernet/intel/igc/igc_ptp.c index 8dbb9f903ca7..4e10ced736db 100644 --- a/drivers/net/ethernet/intel/igc/igc_ptp.c +++ b/drivers/net/ethernet/intel/igc/igc_ptp.c @@ -322,7 +322,7 @@ static int igc_ptp_feature_enable_i225(struct ptp_clock_info *ptp,  		ts = ns_to_timespec64(ns);  		if (rq->perout.index == 1) {  			if (use_freq) { -				tsauxc_mask = IGC_TSAUXC_EN_CLK1; +				tsauxc_mask = IGC_TSAUXC_EN_CLK1 | IGC_TSAUXC_ST1;  				tsim_mask = 0;  			} else {  				tsauxc_mask = IGC_TSAUXC_EN_TT1; @@ -333,7 +333,7 @@ static int igc_ptp_feature_enable_i225(struct ptp_clock_info *ptp,  			freqout = IGC_FREQOUT1;  		} else {  			if (use_freq) { -				tsauxc_mask = IGC_TSAUXC_EN_CLK0; +				tsauxc_mask = IGC_TSAUXC_EN_CLK0 | IGC_TSAUXC_ST0;  				tsim_mask = 0;  			} else {  				tsauxc_mask = IGC_TSAUXC_EN_TT0; @@ -347,10 +347,12 @@ static int igc_ptp_feature_enable_i225(struct ptp_clock_info *ptp,  		tsauxc = rd32(IGC_TSAUXC);  		tsim = rd32(IGC_TSIM);  		if (rq->perout.index == 1) { -			tsauxc &= ~(IGC_TSAUXC_EN_TT1 | IGC_TSAUXC_EN_CLK1); +			tsauxc &= ~(IGC_TSAUXC_EN_TT1 | IGC_TSAUXC_EN_CLK1 | +				    IGC_TSAUXC_ST1);  			tsim &= ~IGC_TSICR_TT1;  		} else { -			tsauxc &= ~(IGC_TSAUXC_EN_TT0 | IGC_TSAUXC_EN_CLK0); +			tsauxc &= ~(IGC_TSAUXC_EN_TT0 | IGC_TSAUXC_EN_CLK0 | +				    IGC_TSAUXC_ST0);  			tsim &= ~IGC_TSICR_TT0;  		}  		if (on) { @@ -415,10 +417,12 @@ static int igc_ptp_verify_pin(struct ptp_clock_info *ptp, unsigned int pin,   *   * We need to convert the system time value stored in the RX/TXSTMP registers   * into a hwtstamp which can be used by the upper level timestamping functions. + * + * Returns 0 on success.   **/ -static void igc_ptp_systim_to_hwtstamp(struct igc_adapter *adapter, -				       struct skb_shared_hwtstamps *hwtstamps, -				       u64 systim) +static int igc_ptp_systim_to_hwtstamp(struct igc_adapter *adapter, +				      struct skb_shared_hwtstamps *hwtstamps, +				      u64 systim)  {  	switch (adapter->hw.mac.type) {  	case igc_i225: @@ -428,8 +432,9 @@ static void igc_ptp_systim_to_hwtstamp(struct igc_adapter *adapter,  						systim & 0xFFFFFFFF);  		break;  	default: -		break; +		return -EINVAL;  	} +	return 0;  }  /** @@ -650,7 +655,8 @@ static void igc_ptp_tx_hwtstamp(struct igc_adapter *adapter)  	regval = rd32(IGC_TXSTMPL);  	regval |= (u64)rd32(IGC_TXSTMPH) << 32; -	igc_ptp_systim_to_hwtstamp(adapter, &shhwtstamps, regval); +	if (igc_ptp_systim_to_hwtstamp(adapter, &shhwtstamps, regval)) +		return;  	switch (adapter->link_speed) {  	case SPEED_10: |