blob: c0812a028a8312d8eaa15084b54318dbe9037551 [file] [log] [blame]
--- a/drivers/net/ethernet/intel/igb/igb.h
+++ b/drivers/net/ethernet/intel/igb/igb.h
@@ -444,7 +444,9 @@ struct igb_adapter {
u32 tx_hwtstamp_timeouts;
u32 rx_hwtstamp_cleared;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)
struct ptp_pin_desc sdp_config[IGB_N_SDP];
+#endif
struct {
struct timespec64 start;
struct timespec64 period;
--- a/drivers/net/ethernet/intel/igb/igb_ptp.c
+++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
@@ -115,6 +115,7 @@ static cycle_t igb_ptp_read_82580(const
return val;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)
/* SYSTIM read access for I210/I211 */
static void igb_ptp_read_i210(struct igb_adapter *adapter,
struct timespec64 *ts)
@@ -133,6 +134,7 @@ static void igb_ptp_read_i210(struct igb
ts->tv_sec = sec;
ts->tv_nsec = nsec;
}
+#endif
static void igb_ptp_write_i210(struct igb_adapter *adapter,
const struct timespec64 *ts)
@@ -265,6 +267,7 @@ static int igb_ptp_adjtime_82576(struct
return 0;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)
static int igb_ptp_adjtime_i210(struct ptp_clock_info *ptp, s64 delta)
{
struct igb_adapter *igb = container_of(ptp, struct igb_adapter,
@@ -282,6 +285,7 @@ static int igb_ptp_adjtime_i210(struct p
return 0;
}
+#endif
static int igb_ptp_gettime_82576(struct ptp_clock_info *ptp,
struct timespec64 *ts)
@@ -302,6 +306,7 @@ static int igb_ptp_gettime_82576(struct
return 0;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)
static int igb_ptp_gettime_i210(struct ptp_clock_info *ptp,
struct timespec64 *ts)
{
@@ -317,6 +322,7 @@ static int igb_ptp_gettime_i210(struct p
return 0;
}
+#endif
static int igb_ptp_settime_82576(struct ptp_clock_info *ptp,
const struct timespec64 *ts)
@@ -337,6 +343,7 @@ static int igb_ptp_settime_82576(struct
return 0;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)
static int igb_ptp_settime_i210(struct ptp_clock_info *ptp,
const struct timespec64 *ts)
{
@@ -597,6 +604,7 @@ static int igb_ptp_feature_enable_i210(s
return -EOPNOTSUPP;
}
+#endif
static int igb_ptp_feature_enable(struct ptp_clock_info *ptp,
struct ptp_clock_request *rq, int on)
@@ -604,6 +612,7 @@ static int igb_ptp_feature_enable(struct
return -EOPNOTSUPP;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)
static int igb_ptp_verify_pin(struct ptp_clock_info *ptp, unsigned int pin,
enum ptp_pin_function func, unsigned int chan)
{
@@ -617,6 +626,7 @@ static int igb_ptp_verify_pin(struct ptp
}
return 0;
}
+#endif
/**
* igb_ptp_tx_work
@@ -1009,7 +1019,9 @@ void igb_ptp_init(struct igb_adapter *ad
{
struct e1000_hw *hw = &adapter->hw;
struct net_device *netdev = adapter->netdev;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)
int i;
+#endif
switch (hw->mac.type) {
case e1000_82576:
@@ -1050,6 +1062,7 @@ void igb_ptp_init(struct igb_adapter *ad
/* Enable the timer functions by clearing bit 31. */
wr32(E1000_TSAUXC, 0x0);
break;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)
case e1000_i210:
case e1000_i211:
for (i = 0; i < IGB_N_SDP; i++) {
@@ -1076,6 +1089,7 @@ void igb_ptp_init(struct igb_adapter *ad
/* Enable the timer functions by clearing bit 31. */
wr32(E1000_TSAUXC, 0x0);
break;
+#endif
default:
adapter->ptp_clock = NULL;
return;
@@ -1087,11 +1101,14 @@ void igb_ptp_init(struct igb_adapter *ad
INIT_WORK(&adapter->ptp_tx_work, igb_ptp_tx_work);
/* Initialize the clock and overflow work for devices that need it. */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)
if ((hw->mac.type == e1000_i210) || (hw->mac.type == e1000_i211)) {
struct timespec64 ts = ktime_to_timespec64(ktime_get_real());
igb_ptp_settime_i210(&adapter->ptp_caps, &ts);
- } else {
+ } else
+#endif
+ {
timecounter_init(&adapter->tc, &adapter->cc,
ktime_to_ns(ktime_get_real()));