1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
--- a/drivers/net/ethernet/intel/igb/igb.h
+++ b/drivers/net/ethernet/intel/igb/igb.h
@@ -443,7 +443,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)
{
@@ -598,6 +605,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)
@@ -605,6 +613,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)
{
@@ -618,6 +627,7 @@ static int igb_ptp_verify_pin(struct ptp
}
return 0;
}
+#endif
/**
* igb_ptp_tx_work
@@ -1010,7 +1020,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:
@@ -1051,6 +1063,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++) {
@@ -1077,6 +1090,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;
@@ -1088,11 +1102,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()));
|