aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2012-10-31 11:33:52 -0400
committerDavid S. Miller <davem@davemloft.net>2012-11-01 11:35:18 -0400
commita24006ed12616bde1bbdb26868495906a212d8dc (patch)
treeb03b42a75f1ff9ced6e2ab75efe6f7b3c8aa3ef2
parent42a7ccef0a06519e2ea0be71d7c0f4ed9198509f (diff)
ptp: Enable clock drivers along with associated net/PHY drivers
Where a PTP clock driver is associated with a net or PHY driver, it should be enabled automatically whenever that driver is enabled. Therefore: - Make PTP clock drivers select rather than depending on PTP_1588_CLOCK - Remove separate boolean options for PTP clock drivers that are built as part of net driver modules. (This also fixes cases where the PTP subsystem is wrongly forced to be built-in.) - Set 'default y' for PTP clock drivers that depend on specific net drivers but are built separately Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/intel/Kconfig26
-rw-r--r--drivers/net/ethernet/intel/igb/Makefile4
-rw-r--r--drivers/net/ethernet/intel/igb/igb.h6
-rw-r--r--drivers/net/ethernet/intel/igb/igb_ethtool.c2
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c28
-rw-r--r--drivers/net/ethernet/intel/ixgbe/Makefile3
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe.h6
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c28
-rw-r--r--drivers/net/ethernet/oki-semi/pch_gbe/Kconfig14
-rw-r--r--drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h2
-rw-r--r--drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c14
-rw-r--r--drivers/net/ethernet/sfc/Kconfig7
-rw-r--r--drivers/net/ethernet/sfc/Makefile3
-rw-r--r--drivers/net/ethernet/sfc/net_driver.h2
-rw-r--r--drivers/net/ethernet/sfc/nic.h26
-rw-r--r--drivers/ptp/Kconfig13
17 files changed, 13 insertions, 173 deletions
diff --git a/drivers/net/ethernet/intel/Kconfig b/drivers/net/ethernet/intel/Kconfig
index d5b359df6e7c..73d28d51b5d9 100644
--- a/drivers/net/ethernet/intel/Kconfig
+++ b/drivers/net/ethernet/intel/Kconfig
@@ -93,6 +93,7 @@ config E1000E
93config IGB 93config IGB
94 tristate "Intel(R) 82575/82576 PCI-Express Gigabit Ethernet support" 94 tristate "Intel(R) 82575/82576 PCI-Express Gigabit Ethernet support"
95 depends on PCI 95 depends on PCI
96 select PTP_1588_CLOCK
96 ---help--- 97 ---help---
97 This driver supports Intel(R) 82575/82576 gigabit ethernet family of 98 This driver supports Intel(R) 82575/82576 gigabit ethernet family of
98 adapters. For more information on how to identify your adapter, go 99 adapters. For more information on how to identify your adapter, go
@@ -120,18 +121,6 @@ config IGB_DCA
120 driver. DCA is a method for warming the CPU cache before data 121 driver. DCA is a method for warming the CPU cache before data
121 is used, with the intent of lessening the impact of cache misses. 122 is used, with the intent of lessening the impact of cache misses.
122 123
123config IGB_PTP
124 bool "PTP Hardware Clock (PHC)"
125 default n
126 depends on IGB
127 select PTP_1588_CLOCK
128 ---help---
129 Say Y here if you want to use PTP Hardware Clock (PHC) in the
130 driver. Only the basic clock operations have been implemented.
131
132 Every timestamp and clock read operations must consult the
133 overflow counter to form a correct time value.
134
135config IGBVF 124config IGBVF
136 tristate "Intel(R) 82576 Virtual Function Ethernet support" 125 tristate "Intel(R) 82576 Virtual Function Ethernet support"
137 depends on PCI 126 depends on PCI
@@ -179,6 +168,7 @@ config IXGBE
179 tristate "Intel(R) 10GbE PCI Express adapters support" 168 tristate "Intel(R) 10GbE PCI Express adapters support"
180 depends on PCI && INET 169 depends on PCI && INET
181 select MDIO 170 select MDIO
171 select PTP_1588_CLOCK
182 ---help--- 172 ---help---
183 This driver supports Intel(R) 10GbE PCI Express family of 173 This driver supports Intel(R) 10GbE PCI Express family of
184 adapters. For more information on how to identify your adapter, go 174 adapters. For more information on how to identify your adapter, go
@@ -221,18 +211,6 @@ config IXGBE_DCB
221 211
222 If unsure, say N. 212 If unsure, say N.
223 213
224config IXGBE_PTP
225 bool "PTP Clock Support"
226 default n
227 depends on IXGBE
228 select PTP_1588_CLOCK
229 ---help---
230 Say Y here if you want support for 1588 Timestamping with a
231 PHC device, using the PTP 1588 Clock support. This is
232 required to enable timestamping support for the device.
233
234 If unsure, say N.
235
236config IXGBEVF 214config IXGBEVF
237 tristate "Intel(R) 82599 Virtual Function Ethernet support" 215 tristate "Intel(R) 82599 Virtual Function Ethernet support"
238 depends on PCI_MSI 216 depends on PCI_MSI
diff --git a/drivers/net/ethernet/intel/igb/Makefile b/drivers/net/ethernet/intel/igb/Makefile
index 97c197fd4a8e..624476cfa727 100644
--- a/drivers/net/ethernet/intel/igb/Makefile
+++ b/drivers/net/ethernet/intel/igb/Makefile
@@ -34,6 +34,4 @@ obj-$(CONFIG_IGB) += igb.o
34 34
35igb-objs := igb_main.o igb_ethtool.o e1000_82575.o \ 35igb-objs := igb_main.o igb_ethtool.o e1000_82575.o \
36 e1000_mac.o e1000_nvm.o e1000_phy.o e1000_mbx.o \ 36 e1000_mac.o e1000_nvm.o e1000_phy.o e1000_mbx.o \
37 e1000_i210.o 37 e1000_i210.o igb_ptp.o
38
39igb-$(CONFIG_IGB_PTP) += igb_ptp.o
diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h
index be1971b18297..796db53954d9 100644
--- a/drivers/net/ethernet/intel/igb/igb.h
+++ b/drivers/net/ethernet/intel/igb/igb.h
@@ -34,11 +34,9 @@
34#include "e1000_mac.h" 34#include "e1000_mac.h"
35#include "e1000_82575.h" 35#include "e1000_82575.h"
36 36
37#ifdef CONFIG_IGB_PTP
38#include <linux/clocksource.h> 37#include <linux/clocksource.h>
39#include <linux/net_tstamp.h> 38#include <linux/net_tstamp.h>
40#include <linux/ptp_clock_kernel.h> 39#include <linux/ptp_clock_kernel.h>
41#endif /* CONFIG_IGB_PTP */
42#include <linux/bitops.h> 40#include <linux/bitops.h>
43#include <linux/if_vlan.h> 41#include <linux/if_vlan.h>
44 42
@@ -376,7 +374,6 @@ struct igb_adapter {
376 u32 wvbr; 374 u32 wvbr;
377 u32 *shadow_vfta; 375 u32 *shadow_vfta;
378 376
379#ifdef CONFIG_IGB_PTP
380 struct ptp_clock *ptp_clock; 377 struct ptp_clock *ptp_clock;
381 struct ptp_clock_info ptp_caps; 378 struct ptp_clock_info ptp_caps;
382 struct delayed_work ptp_overflow_work; 379 struct delayed_work ptp_overflow_work;
@@ -385,7 +382,6 @@ struct igb_adapter {
385 spinlock_t tmreg_lock; 382 spinlock_t tmreg_lock;
386 struct cyclecounter cc; 383 struct cyclecounter cc;
387 struct timecounter tc; 384 struct timecounter tc;
388#endif /* CONFIG_IGB_PTP */
389 385
390 char fw_version[32]; 386 char fw_version[32];
391}; 387};
@@ -439,7 +435,6 @@ extern bool igb_has_link(struct igb_adapter *adapter);
439extern void igb_set_ethtool_ops(struct net_device *); 435extern void igb_set_ethtool_ops(struct net_device *);
440extern void igb_power_up_link(struct igb_adapter *); 436extern void igb_power_up_link(struct igb_adapter *);
441extern void igb_set_fw_version(struct igb_adapter *); 437extern void igb_set_fw_version(struct igb_adapter *);
442#ifdef CONFIG_IGB_PTP
443extern void igb_ptp_init(struct igb_adapter *adapter); 438extern void igb_ptp_init(struct igb_adapter *adapter);
444extern void igb_ptp_stop(struct igb_adapter *adapter); 439extern void igb_ptp_stop(struct igb_adapter *adapter);
445extern void igb_ptp_reset(struct igb_adapter *adapter); 440extern void igb_ptp_reset(struct igb_adapter *adapter);
@@ -461,7 +456,6 @@ static inline void igb_ptp_rx_hwtstamp(struct igb_q_vector *q_vector,
461 456
462extern int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, 457extern int igb_ptp_hwtstamp_ioctl(struct net_device *netdev,
463 struct ifreq *ifr, int cmd); 458 struct ifreq *ifr, int cmd);
464#endif /* CONFIG_IGB_PTP */
465 459
466static inline s32 igb_reset_phy(struct e1000_hw *hw) 460static inline s32 igb_reset_phy(struct e1000_hw *hw)
467{ 461{
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index 375c0dad8d29..d8b1bee606c0 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -2310,7 +2310,6 @@ static int igb_get_ts_info(struct net_device *dev,
2310 struct igb_adapter *adapter = netdev_priv(dev); 2310 struct igb_adapter *adapter = netdev_priv(dev);
2311 2311
2312 switch (adapter->hw.mac.type) { 2312 switch (adapter->hw.mac.type) {
2313#ifdef CONFIG_IGB_PTP
2314 case e1000_82576: 2313 case e1000_82576:
2315 case e1000_82580: 2314 case e1000_82580:
2316 case e1000_i350: 2315 case e1000_i350:
@@ -2346,7 +2345,6 @@ static int igb_get_ts_info(struct net_device *dev,
2346 (1 << HWTSTAMP_FILTER_PTP_V2_EVENT); 2345 (1 << HWTSTAMP_FILTER_PTP_V2_EVENT);
2347 2346
2348 return 0; 2347 return 0;
2349#endif /* CONFIG_IGB_PTP */
2350 default: 2348 default:
2351 return -EOPNOTSUPP; 2349 return -EOPNOTSUPP;
2352 } 2350 }
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index df1e7907bbaf..082ce73dc627 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -1708,10 +1708,8 @@ void igb_reset(struct igb_adapter *adapter)
1708 /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */ 1708 /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */
1709 wr32(E1000_VET, ETHERNET_IEEE_VLAN_TYPE); 1709 wr32(E1000_VET, ETHERNET_IEEE_VLAN_TYPE);
1710 1710
1711#ifdef CONFIG_IGB_PTP
1712 /* Re-enable PTP, where applicable. */ 1711 /* Re-enable PTP, where applicable. */
1713 igb_ptp_reset(adapter); 1712 igb_ptp_reset(adapter);
1714#endif /* CONFIG_IGB_PTP */
1715 1713
1716 igb_get_phy_info(hw); 1714 igb_get_phy_info(hw);
1717} 1715}
@@ -2119,10 +2117,8 @@ static int __devinit igb_probe(struct pci_dev *pdev,
2119 2117
2120#endif 2118#endif
2121 2119
2122#ifdef CONFIG_IGB_PTP
2123 /* do hw tstamp init after resetting */ 2120 /* do hw tstamp init after resetting */
2124 igb_ptp_init(adapter); 2121 igb_ptp_init(adapter);
2125#endif /* CONFIG_IGB_PTP */
2126 2122
2127 dev_info(&pdev->dev, "Intel(R) Gigabit Ethernet Network Connection\n"); 2123 dev_info(&pdev->dev, "Intel(R) Gigabit Ethernet Network Connection\n");
2128 /* print bus type/speed/width info */ 2124 /* print bus type/speed/width info */
@@ -2197,9 +2193,7 @@ static void __devexit igb_remove(struct pci_dev *pdev)
2197 struct e1000_hw *hw = &adapter->hw; 2193 struct e1000_hw *hw = &adapter->hw;
2198 2194
2199 pm_runtime_get_noresume(&pdev->dev); 2195 pm_runtime_get_noresume(&pdev->dev);
2200#ifdef CONFIG_IGB_PTP
2201 igb_ptp_stop(adapter); 2196 igb_ptp_stop(adapter);
2202#endif /* CONFIG_IGB_PTP */
2203 2197
2204 /* 2198 /*
2205 * The watchdog timer may be rescheduled, so explicitly 2199 * The watchdog timer may be rescheduled, so explicitly
@@ -3095,10 +3089,8 @@ void igb_configure_rx_ring(struct igb_adapter *adapter,
3095 srrctl = IGB_RX_HDR_LEN << E1000_SRRCTL_BSIZEHDRSIZE_SHIFT; 3089 srrctl = IGB_RX_HDR_LEN << E1000_SRRCTL_BSIZEHDRSIZE_SHIFT;
3096 srrctl |= IGB_RX_BUFSZ >> E1000_SRRCTL_BSIZEPKT_SHIFT; 3090 srrctl |= IGB_RX_BUFSZ >> E1000_SRRCTL_BSIZEPKT_SHIFT;
3097 srrctl |= E1000_SRRCTL_DESCTYPE_ADV_ONEBUF; 3091 srrctl |= E1000_SRRCTL_DESCTYPE_ADV_ONEBUF;
3098#ifdef CONFIG_IGB_PTP
3099 if (hw->mac.type >= e1000_82580) 3092 if (hw->mac.type >= e1000_82580)
3100 srrctl |= E1000_SRRCTL_TIMESTAMP; 3093 srrctl |= E1000_SRRCTL_TIMESTAMP;
3101#endif /* CONFIG_IGB_PTP */
3102 /* Only set Drop Enable if we are supporting multiple queues */ 3094 /* Only set Drop Enable if we are supporting multiple queues */
3103 if (adapter->vfs_allocated_count || adapter->num_rx_queues > 1) 3095 if (adapter->vfs_allocated_count || adapter->num_rx_queues > 1)
3104 srrctl |= E1000_SRRCTL_DROP_EN; 3096 srrctl |= E1000_SRRCTL_DROP_EN;
@@ -4134,11 +4126,9 @@ static __le32 igb_tx_cmd_type(u32 tx_flags)
4134 if (tx_flags & IGB_TX_FLAGS_VLAN) 4126 if (tx_flags & IGB_TX_FLAGS_VLAN)
4135 cmd_type |= cpu_to_le32(E1000_ADVTXD_DCMD_VLE); 4127 cmd_type |= cpu_to_le32(E1000_ADVTXD_DCMD_VLE);
4136 4128
4137#ifdef CONFIG_IGB_PTP
4138 /* set timestamp bit if present */ 4129 /* set timestamp bit if present */
4139 if (unlikely(tx_flags & IGB_TX_FLAGS_TSTAMP)) 4130 if (unlikely(tx_flags & IGB_TX_FLAGS_TSTAMP))
4140 cmd_type |= cpu_to_le32(E1000_ADVTXD_MAC_TSTAMP); 4131 cmd_type |= cpu_to_le32(E1000_ADVTXD_MAC_TSTAMP);
4141#endif /* CONFIG_IGB_PTP */
4142 4132
4143 /* set segmentation bits for TSO */ 4133 /* set segmentation bits for TSO */
4144 if (tx_flags & IGB_TX_FLAGS_TSO) 4134 if (tx_flags & IGB_TX_FLAGS_TSO)
@@ -4347,9 +4337,7 @@ static inline int igb_maybe_stop_tx(struct igb_ring *tx_ring, const u16 size)
4347netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb, 4337netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,
4348 struct igb_ring *tx_ring) 4338 struct igb_ring *tx_ring)
4349{ 4339{
4350#ifdef CONFIG_IGB_PTP
4351 struct igb_adapter *adapter = netdev_priv(tx_ring->netdev); 4340 struct igb_adapter *adapter = netdev_priv(tx_ring->netdev);
4352#endif /* CONFIG_IGB_PTP */
4353 struct igb_tx_buffer *first; 4341 struct igb_tx_buffer *first;
4354 int tso; 4342 int tso;
4355 u32 tx_flags = 0; 4343 u32 tx_flags = 0;
@@ -4372,7 +4360,6 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,
4372 first->bytecount = skb->len; 4360 first->bytecount = skb->len;
4373 first->gso_segs = 1; 4361 first->gso_segs = 1;
4374 4362
4375#ifdef CONFIG_IGB_PTP
4376 if (unlikely((skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) && 4363 if (unlikely((skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&
4377 !(adapter->ptp_tx_skb))) { 4364 !(adapter->ptp_tx_skb))) {
4378 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; 4365 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
@@ -4382,7 +4369,6 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,
4382 if (adapter->hw.mac.type == e1000_82576) 4369 if (adapter->hw.mac.type == e1000_82576)
4383 schedule_work(&adapter->ptp_tx_work); 4370 schedule_work(&adapter->ptp_tx_work);
4384 } 4371 }
4385#endif /* CONFIG_IGB_PTP */
4386 4372
4387 if (vlan_tx_tag_present(skb)) { 4373 if (vlan_tx_tag_present(skb)) {
4388 tx_flags |= IGB_TX_FLAGS_VLAN; 4374 tx_flags |= IGB_TX_FLAGS_VLAN;
@@ -4776,7 +4762,6 @@ static irqreturn_t igb_msix_other(int irq, void *data)
4776 mod_timer(&adapter->watchdog_timer, jiffies + 1); 4762 mod_timer(&adapter->watchdog_timer, jiffies + 1);
4777 } 4763 }
4778 4764
4779#ifdef CONFIG_IGB_PTP
4780 if (icr & E1000_ICR_TS) { 4765 if (icr & E1000_ICR_TS) {
4781 u32 tsicr = rd32(E1000_TSICR); 4766 u32 tsicr = rd32(E1000_TSICR);
4782 4767
@@ -4787,7 +4772,6 @@ static irqreturn_t igb_msix_other(int irq, void *data)
4787 schedule_work(&adapter->ptp_tx_work); 4772 schedule_work(&adapter->ptp_tx_work);
4788 } 4773 }
4789 } 4774 }
4790#endif /* CONFIG_IGB_PTP */
4791 4775
4792 wr32(E1000_EIMS, adapter->eims_other); 4776 wr32(E1000_EIMS, adapter->eims_other);
4793 4777
@@ -5539,7 +5523,6 @@ static irqreturn_t igb_intr_msi(int irq, void *data)
5539 mod_timer(&adapter->watchdog_timer, jiffies + 1); 5523 mod_timer(&adapter->watchdog_timer, jiffies + 1);
5540 } 5524 }
5541 5525
5542#ifdef CONFIG_IGB_PTP
5543 if (icr & E1000_ICR_TS) { 5526 if (icr & E1000_ICR_TS) {
5544 u32 tsicr = rd32(E1000_TSICR); 5527 u32 tsicr = rd32(E1000_TSICR);
5545 5528
@@ -5550,7 +5533,6 @@ static irqreturn_t igb_intr_msi(int irq, void *data)
5550 schedule_work(&adapter->ptp_tx_work); 5533 schedule_work(&adapter->ptp_tx_work);
5551 } 5534 }
5552 } 5535 }
5553#endif /* CONFIG_IGB_PTP */
5554 5536
5555 napi_schedule(&q_vector->napi); 5537 napi_schedule(&q_vector->napi);
5556 5538
@@ -5593,7 +5575,6 @@ static irqreturn_t igb_intr(int irq, void *data)
5593 mod_timer(&adapter->watchdog_timer, jiffies + 1); 5575 mod_timer(&adapter->watchdog_timer, jiffies + 1);
5594 } 5576 }
5595 5577
5596#ifdef CONFIG_IGB_PTP
5597 if (icr & E1000_ICR_TS) { 5578 if (icr & E1000_ICR_TS) {
5598 u32 tsicr = rd32(E1000_TSICR); 5579 u32 tsicr = rd32(E1000_TSICR);
5599 5580
@@ -5604,7 +5585,6 @@ static irqreturn_t igb_intr(int irq, void *data)
5604 schedule_work(&adapter->ptp_tx_work); 5585 schedule_work(&adapter->ptp_tx_work);
5605 } 5586 }
5606 } 5587 }
5607#endif /* CONFIG_IGB_PTP */
5608 5588
5609 napi_schedule(&q_vector->napi); 5589 napi_schedule(&q_vector->napi);
5610 5590
@@ -5889,14 +5869,12 @@ static bool igb_add_rx_frag(struct igb_ring *rx_ring,
5889 if ((size <= IGB_RX_HDR_LEN) && !skb_is_nonlinear(skb)) { 5869 if ((size <= IGB_RX_HDR_LEN) && !skb_is_nonlinear(skb)) {
5890 unsigned char *va = page_address(page) + rx_buffer->page_offset; 5870 unsigned char *va = page_address(page) + rx_buffer->page_offset;
5891 5871
5892#ifdef CONFIG_IGB_PTP
5893 if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) { 5872 if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) {
5894 igb_ptp_rx_pktstamp(rx_ring->q_vector, va, skb); 5873 igb_ptp_rx_pktstamp(rx_ring->q_vector, va, skb);
5895 va += IGB_TS_HDR_LEN; 5874 va += IGB_TS_HDR_LEN;
5896 size -= IGB_TS_HDR_LEN; 5875 size -= IGB_TS_HDR_LEN;
5897 } 5876 }
5898 5877
5899#endif
5900 memcpy(__skb_put(skb, size), va, ALIGN(size, sizeof(long))); 5878 memcpy(__skb_put(skb, size), va, ALIGN(size, sizeof(long)));
5901 5879
5902 /* we can reuse buffer as-is, just make sure it is local */ 5880 /* we can reuse buffer as-is, just make sure it is local */
@@ -6221,7 +6199,6 @@ static void igb_pull_tail(struct igb_ring *rx_ring,
6221 */ 6199 */
6222 va = skb_frag_address(frag); 6200 va = skb_frag_address(frag);
6223 6201
6224#ifdef CONFIG_IGB_PTP
6225 if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) { 6202 if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) {
6226 /* retrieve timestamp from buffer */ 6203 /* retrieve timestamp from buffer */
6227 igb_ptp_rx_pktstamp(rx_ring->q_vector, va, skb); 6204 igb_ptp_rx_pktstamp(rx_ring->q_vector, va, skb);
@@ -6236,7 +6213,6 @@ static void igb_pull_tail(struct igb_ring *rx_ring,
6236 va += IGB_TS_HDR_LEN; 6213 va += IGB_TS_HDR_LEN;
6237 } 6214 }
6238 6215
6239#endif
6240 /* 6216 /*
6241 * we need the header to contain the greater of either ETH_HLEN or 6217 * we need the header to contain the greater of either ETH_HLEN or
6242 * 60 bytes if the skb->len is less than 60 for skb_pad. 6218 * 60 bytes if the skb->len is less than 60 for skb_pad.
@@ -6317,9 +6293,7 @@ static void igb_process_skb_fields(struct igb_ring *rx_ring,
6317 6293
6318 igb_rx_checksum(rx_ring, rx_desc, skb); 6294 igb_rx_checksum(rx_ring, rx_desc, skb);
6319 6295
6320#ifdef CONFIG_IGB_PTP
6321 igb_ptp_rx_hwtstamp(rx_ring->q_vector, rx_desc, skb); 6296 igb_ptp_rx_hwtstamp(rx_ring->q_vector, rx_desc, skb);
6322#endif /* CONFIG_IGB_PTP */
6323 6297
6324 if ((dev->features & NETIF_F_HW_VLAN_RX) && 6298 if ((dev->features & NETIF_F_HW_VLAN_RX) &&
6325 igb_test_staterr(rx_desc, E1000_RXD_STAT_VP)) { 6299 igb_test_staterr(rx_desc, E1000_RXD_STAT_VP)) {
@@ -6553,10 +6527,8 @@ static int igb_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
6553 case SIOCGMIIREG: 6527 case SIOCGMIIREG:
6554 case SIOCSMIIREG: 6528 case SIOCSMIIREG:
6555 return igb_mii_ioctl(netdev, ifr, cmd); 6529 return igb_mii_ioctl(netdev, ifr, cmd);
6556#ifdef CONFIG_IGB_PTP
6557 case SIOCSHWTSTAMP: 6530 case SIOCSHWTSTAMP:
6558 return igb_ptp_hwtstamp_ioctl(netdev, ifr, cmd); 6531 return igb_ptp_hwtstamp_ioctl(netdev, ifr, cmd);
6559#endif /* CONFIG_IGB_PTP */
6560 default: 6532 default:
6561 return -EOPNOTSUPP; 6533 return -EOPNOTSUPP;
6562 } 6534 }
diff --git a/drivers/net/ethernet/intel/ixgbe/Makefile b/drivers/net/ethernet/intel/ixgbe/Makefile
index 89f40e51fc13..f3a632bf8d96 100644
--- a/drivers/net/ethernet/intel/ixgbe/Makefile
+++ b/drivers/net/ethernet/intel/ixgbe/Makefile
@@ -34,11 +34,10 @@ obj-$(CONFIG_IXGBE) += ixgbe.o
34 34
35ixgbe-objs := ixgbe_main.o ixgbe_common.o ixgbe_ethtool.o ixgbe_debugfs.o\ 35ixgbe-objs := ixgbe_main.o ixgbe_common.o ixgbe_ethtool.o ixgbe_debugfs.o\
36 ixgbe_82599.o ixgbe_82598.o ixgbe_phy.o ixgbe_sriov.o \ 36 ixgbe_82599.o ixgbe_82598.o ixgbe_phy.o ixgbe_sriov.o \
37 ixgbe_mbx.o ixgbe_x540.o ixgbe_lib.o 37 ixgbe_mbx.o ixgbe_x540.o ixgbe_lib.o ixgbe_ptp.o
38 38
39ixgbe-$(CONFIG_IXGBE_DCB) += ixgbe_dcb.o ixgbe_dcb_82598.o \ 39ixgbe-$(CONFIG_IXGBE_DCB) += ixgbe_dcb.o ixgbe_dcb_82598.o \
40 ixgbe_dcb_82599.o ixgbe_dcb_nl.o 40 ixgbe_dcb_82599.o ixgbe_dcb_nl.o
41 41
42ixgbe-$(CONFIG_IXGBE_PTP) += ixgbe_ptp.o
43ixgbe-$(CONFIG_IXGBE_HWMON) += ixgbe_sysfs.o 42ixgbe-$(CONFIG_IXGBE_HWMON) += ixgbe_sysfs.o
44ixgbe-$(CONFIG_FCOE:m=y) += ixgbe_fcoe.o 43ixgbe-$(CONFIG_FCOE:m=y) += ixgbe_fcoe.o
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index a17116b3c470..7ff4c4fdcb0d 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -36,11 +36,9 @@
36#include <linux/aer.h> 36#include <linux/aer.h>
37#include <linux/if_vlan.h> 37#include <linux/if_vlan.h>
38 38
39#ifdef CONFIG_IXGBE_PTP
40#include <linux/clocksource.h> 39#include <linux/clocksource.h>
41#include <linux/net_tstamp.h> 40#include <linux/net_tstamp.h>
42#include <linux/ptp_clock_kernel.h> 41#include <linux/ptp_clock_kernel.h>
43#endif /* CONFIG_IXGBE_PTP */
44 42
45#include "ixgbe_type.h" 43#include "ixgbe_type.h"
46#include "ixgbe_common.h" 44#include "ixgbe_common.h"
@@ -572,7 +570,6 @@ struct ixgbe_adapter {
572 u32 interrupt_event; 570 u32 interrupt_event;
573 u32 led_reg; 571 u32 led_reg;
574 572
575#ifdef CONFIG_IXGBE_PTP
576 struct ptp_clock *ptp_clock; 573 struct ptp_clock *ptp_clock;
577 struct ptp_clock_info ptp_caps; 574 struct ptp_clock_info ptp_caps;
578 unsigned long last_overflow_check; 575 unsigned long last_overflow_check;
@@ -581,7 +578,6 @@ struct ixgbe_adapter {
581 struct timecounter tc; 578 struct timecounter tc;
582 int rx_hwtstamp_filter; 579 int rx_hwtstamp_filter;
583 u32 base_incval; 580 u32 base_incval;
584#endif /* CONFIG_IXGBE_PTP */
585 581
586 /* SR-IOV */ 582 /* SR-IOV */
587 DECLARE_BITMAP(active_vfs, IXGBE_MAX_VF_FUNCTIONS); 583 DECLARE_BITMAP(active_vfs, IXGBE_MAX_VF_FUNCTIONS);
@@ -742,7 +738,6 @@ static inline struct netdev_queue *txring_txq(const struct ixgbe_ring *ring)
742 return netdev_get_tx_queue(ring->netdev, ring->queue_index); 738 return netdev_get_tx_queue(ring->netdev, ring->queue_index);
743} 739}
744 740
745#ifdef CONFIG_IXGBE_PTP
746extern void ixgbe_ptp_init(struct ixgbe_adapter *adapter); 741extern void ixgbe_ptp_init(struct ixgbe_adapter *adapter);
747extern void ixgbe_ptp_stop(struct ixgbe_adapter *adapter); 742extern void ixgbe_ptp_stop(struct ixgbe_adapter *adapter);
748extern void ixgbe_ptp_overflow_check(struct ixgbe_adapter *adapter); 743extern void ixgbe_ptp_overflow_check(struct ixgbe_adapter *adapter);
@@ -756,6 +751,5 @@ extern int ixgbe_ptp_hwtstamp_ioctl(struct ixgbe_adapter *adapter,
756extern void ixgbe_ptp_start_cyclecounter(struct ixgbe_adapter *adapter); 751extern void ixgbe_ptp_start_cyclecounter(struct ixgbe_adapter *adapter);
757extern void ixgbe_ptp_reset(struct ixgbe_adapter *adapter); 752extern void ixgbe_ptp_reset(struct ixgbe_adapter *adapter);
758extern void ixgbe_ptp_check_pps_event(struct ixgbe_adapter *adapter, u32 eicr); 753extern void ixgbe_ptp_check_pps_event(struct ixgbe_adapter *adapter, u32 eicr);
759#endif /* CONFIG_IXGBE_PTP */
760 754
761#endif /* _IXGBE_H_ */ 755#endif /* _IXGBE_H_ */
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index 872c3374ddfa..bbf07bd6ab9d 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -2667,7 +2667,6 @@ static int ixgbe_get_ts_info(struct net_device *dev,
2667 struct ixgbe_adapter *adapter = netdev_priv(dev); 2667 struct ixgbe_adapter *adapter = netdev_priv(dev);
2668 2668
2669 switch (adapter->hw.mac.type) { 2669 switch (adapter->hw.mac.type) {
2670#ifdef CONFIG_IXGBE_PTP
2671 case ixgbe_mac_X540: 2670 case ixgbe_mac_X540:
2672 case ixgbe_mac_82599EB: 2671 case ixgbe_mac_82599EB:
2673 info->so_timestamping = 2672 info->so_timestamping =
@@ -2690,7 +2689,6 @@ static int ixgbe_get_ts_info(struct net_device *dev,
2690 (1 << HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ) | 2689 (1 << HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ) |
2691 (1 << HWTSTAMP_FILTER_PTP_V2_EVENT); 2690 (1 << HWTSTAMP_FILTER_PTP_V2_EVENT);
2692 break; 2691 break;
2693#endif /* CONFIG_IXGBE_PTP */
2694 default: 2692 default:
2695 return ethtool_op_get_ts_info(dev, info); 2693 return ethtool_op_get_ts_info(dev, info);
2696 break; 2694 break;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 26bfaaee9515..e5f993e8069c 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -841,10 +841,8 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector,
841 total_bytes += tx_buffer->bytecount; 841 total_bytes += tx_buffer->bytecount;
842 total_packets += tx_buffer->gso_segs; 842 total_packets += tx_buffer->gso_segs;
843 843
844#ifdef CONFIG_IXGBE_PTP
845 if (unlikely(tx_buffer->tx_flags & IXGBE_TX_FLAGS_TSTAMP)) 844 if (unlikely(tx_buffer->tx_flags & IXGBE_TX_FLAGS_TSTAMP))
846 ixgbe_ptp_tx_hwtstamp(q_vector, tx_buffer->skb); 845 ixgbe_ptp_tx_hwtstamp(q_vector, tx_buffer->skb);
847#endif
848 846
849 /* free the skb */ 847 /* free the skb */
850 dev_kfree_skb_any(tx_buffer->skb); 848 dev_kfree_skb_any(tx_buffer->skb);
@@ -1432,9 +1430,7 @@ static void ixgbe_process_skb_fields(struct ixgbe_ring *rx_ring,
1432 1430
1433 ixgbe_rx_checksum(rx_ring, rx_desc, skb); 1431 ixgbe_rx_checksum(rx_ring, rx_desc, skb);
1434 1432
1435#ifdef CONFIG_IXGBE_PTP
1436 ixgbe_ptp_rx_hwtstamp(rx_ring->q_vector, rx_desc, skb); 1433 ixgbe_ptp_rx_hwtstamp(rx_ring->q_vector, rx_desc, skb);
1437#endif
1438 1434
1439 if ((dev->features & NETIF_F_HW_VLAN_RX) && 1435 if ((dev->features & NETIF_F_HW_VLAN_RX) &&
1440 ixgbe_test_staterr(rx_desc, IXGBE_RXD_STAT_VP)) { 1436 ixgbe_test_staterr(rx_desc, IXGBE_RXD_STAT_VP)) {
@@ -2386,10 +2382,8 @@ static inline void ixgbe_irq_enable(struct ixgbe_adapter *adapter, bool queues,
2386 break; 2382 break;
2387 } 2383 }
2388 2384
2389#ifdef CONFIG_IXGBE_PTP
2390 if (adapter->hw.mac.type == ixgbe_mac_X540) 2385 if (adapter->hw.mac.type == ixgbe_mac_X540)
2391 mask |= IXGBE_EIMS_TIMESYNC; 2386 mask |= IXGBE_EIMS_TIMESYNC;
2392#endif
2393 2387
2394 if ((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) && 2388 if ((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) &&
2395 !(adapter->flags2 & IXGBE_FLAG2_FDIR_REQUIRES_REINIT)) 2389 !(adapter->flags2 & IXGBE_FLAG2_FDIR_REQUIRES_REINIT))
@@ -2455,10 +2449,8 @@ static irqreturn_t ixgbe_msix_other(int irq, void *data)
2455 2449
2456 ixgbe_check_fan_failure(adapter, eicr); 2450 ixgbe_check_fan_failure(adapter, eicr);
2457 2451
2458#ifdef CONFIG_IXGBE_PTP
2459 if (unlikely(eicr & IXGBE_EICR_TIMESYNC)) 2452 if (unlikely(eicr & IXGBE_EICR_TIMESYNC))
2460 ixgbe_ptp_check_pps_event(adapter, eicr); 2453 ixgbe_ptp_check_pps_event(adapter, eicr);
2461#endif
2462 2454
2463 /* re-enable the original interrupt state, no lsc, no queues */ 2455 /* re-enable the original interrupt state, no lsc, no queues */
2464 if (!test_bit(__IXGBE_DOWN, &adapter->state)) 2456 if (!test_bit(__IXGBE_DOWN, &adapter->state))
@@ -2650,10 +2642,8 @@ static irqreturn_t ixgbe_intr(int irq, void *data)
2650 } 2642 }
2651 2643
2652 ixgbe_check_fan_failure(adapter, eicr); 2644 ixgbe_check_fan_failure(adapter, eicr);
2653#ifdef CONFIG_IXGBE_PTP
2654 if (unlikely(eicr & IXGBE_EICR_TIMESYNC)) 2645 if (unlikely(eicr & IXGBE_EICR_TIMESYNC))
2655 ixgbe_ptp_check_pps_event(adapter, eicr); 2646 ixgbe_ptp_check_pps_event(adapter, eicr);
2656#endif
2657 2647
2658 /* would disable interrupts here but EIAM disabled it */ 2648 /* would disable interrupts here but EIAM disabled it */
2659 napi_schedule(&q_vector->napi); 2649 napi_schedule(&q_vector->napi);
@@ -4251,10 +4241,8 @@ void ixgbe_reset(struct ixgbe_adapter *adapter)
4251 if (hw->mac.san_mac_rar_index) 4241 if (hw->mac.san_mac_rar_index)
4252 hw->mac.ops.set_vmdq_san_mac(hw, VMDQ_P(0)); 4242 hw->mac.ops.set_vmdq_san_mac(hw, VMDQ_P(0));
4253 4243
4254#ifdef CONFIG_IXGBE_PTP
4255 if (adapter->flags2 & IXGBE_FLAG2_PTP_ENABLED) 4244 if (adapter->flags2 & IXGBE_FLAG2_PTP_ENABLED)
4256 ixgbe_ptp_reset(adapter); 4245 ixgbe_ptp_reset(adapter);
4257#endif
4258} 4246}
4259 4247
4260/** 4248/**
@@ -4961,9 +4949,7 @@ static int ixgbe_open(struct net_device *netdev)
4961 if (err) 4949 if (err)
4962 goto err_set_queues; 4950 goto err_set_queues;
4963 4951
4964#ifdef CONFIG_IXGBE_PTP
4965 ixgbe_ptp_init(adapter); 4952 ixgbe_ptp_init(adapter);
4966#endif /* CONFIG_IXGBE_PTP*/
4967 4953
4968 ixgbe_up_complete(adapter); 4954 ixgbe_up_complete(adapter);
4969 4955
@@ -4996,9 +4982,7 @@ static int ixgbe_close(struct net_device *netdev)
4996{ 4982{
4997 struct ixgbe_adapter *adapter = netdev_priv(netdev); 4983 struct ixgbe_adapter *adapter = netdev_priv(netdev);
4998 4984
4999#ifdef CONFIG_IXGBE_PTP
5000 ixgbe_ptp_stop(adapter); 4985 ixgbe_ptp_stop(adapter);
5001#endif
5002 4986
5003 ixgbe_down(adapter); 4987 ixgbe_down(adapter);
5004 ixgbe_free_irq(adapter); 4988 ixgbe_free_irq(adapter);
@@ -5561,10 +5545,8 @@ static void ixgbe_watchdog_link_is_up(struct ixgbe_adapter *adapter)
5561 break; 5545 break;
5562 } 5546 }
5563 5547
5564#ifdef CONFIG_IXGBE_PTP
5565 if (adapter->flags2 & IXGBE_FLAG2_PTP_ENABLED) 5548 if (adapter->flags2 & IXGBE_FLAG2_PTP_ENABLED)
5566 ixgbe_ptp_start_cyclecounter(adapter); 5549 ixgbe_ptp_start_cyclecounter(adapter);
5567#endif
5568 5550
5569 e_info(drv, "NIC Link is Up %s, Flow Control: %s\n", 5551 e_info(drv, "NIC Link is Up %s, Flow Control: %s\n",
5570 (link_speed == IXGBE_LINK_SPEED_10GB_FULL ? 5552 (link_speed == IXGBE_LINK_SPEED_10GB_FULL ?
@@ -5609,10 +5591,8 @@ static void ixgbe_watchdog_link_is_down(struct ixgbe_adapter *adapter)
5609 if (ixgbe_is_sfp(hw) && hw->mac.type == ixgbe_mac_82598EB) 5591 if (ixgbe_is_sfp(hw) && hw->mac.type == ixgbe_mac_82598EB)
5610 adapter->flags2 |= IXGBE_FLAG2_SEARCH_FOR_SFP; 5592 adapter->flags2 |= IXGBE_FLAG2_SEARCH_FOR_SFP;
5611 5593
5612#ifdef CONFIG_IXGBE_PTP
5613 if (adapter->flags2 & IXGBE_FLAG2_PTP_ENABLED) 5594 if (adapter->flags2 & IXGBE_FLAG2_PTP_ENABLED)
5614 ixgbe_ptp_start_cyclecounter(adapter); 5595 ixgbe_ptp_start_cyclecounter(adapter);
5615#endif
5616 5596
5617 e_info(drv, "NIC Link is Down\n"); 5597 e_info(drv, "NIC Link is Down\n");
5618 netif_carrier_off(netdev); 5598 netif_carrier_off(netdev);
@@ -5917,9 +5897,7 @@ static void ixgbe_service_task(struct work_struct *work)
5917 ixgbe_watchdog_subtask(adapter); 5897 ixgbe_watchdog_subtask(adapter);
5918 ixgbe_fdir_reinit_subtask(adapter); 5898 ixgbe_fdir_reinit_subtask(adapter);
5919 ixgbe_check_hang_subtask(adapter); 5899 ixgbe_check_hang_subtask(adapter);
5920#ifdef CONFIG_IXGBE_PTP
5921 ixgbe_ptp_overflow_check(adapter); 5900 ixgbe_ptp_overflow_check(adapter);
5922#endif
5923 5901
5924 ixgbe_service_event_complete(adapter); 5902 ixgbe_service_event_complete(adapter);
5925} 5903}
@@ -6072,10 +6050,8 @@ static __le32 ixgbe_tx_cmd_type(u32 tx_flags)
6072 if (tx_flags & IXGBE_TX_FLAGS_HW_VLAN) 6050 if (tx_flags & IXGBE_TX_FLAGS_HW_VLAN)
6073 cmd_type |= cpu_to_le32(IXGBE_ADVTXD_DCMD_VLE); 6051 cmd_type |= cpu_to_le32(IXGBE_ADVTXD_DCMD_VLE);
6074 6052
6075#ifdef CONFIG_IXGBE_PTP
6076 if (tx_flags & IXGBE_TX_FLAGS_TSTAMP) 6053 if (tx_flags & IXGBE_TX_FLAGS_TSTAMP)
6077 cmd_type |= cpu_to_le32(IXGBE_ADVTXD_MAC_TSTAMP); 6054 cmd_type |= cpu_to_le32(IXGBE_ADVTXD_MAC_TSTAMP);
6078#endif
6079 6055
6080 /* set segmentation enable bits for TSO/FSO */ 6056 /* set segmentation enable bits for TSO/FSO */
6081#ifdef IXGBE_FCOE 6057#ifdef IXGBE_FCOE
@@ -6477,12 +6453,10 @@ netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb,
6477 6453
6478 skb_tx_timestamp(skb); 6454 skb_tx_timestamp(skb);
6479 6455
6480#ifdef CONFIG_IXGBE_PTP
6481 if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) { 6456 if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) {
6482 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; 6457 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
6483 tx_flags |= IXGBE_TX_FLAGS_TSTAMP; 6458 tx_flags |= IXGBE_TX_FLAGS_TSTAMP;
6484 } 6459 }
6485#endif
6486 6460
6487#ifdef CONFIG_PCI_IOV 6461#ifdef CONFIG_PCI_IOV
6488 /* 6462 /*
@@ -6632,10 +6606,8 @@ static int ixgbe_ioctl(struct net_device *netdev, struct ifreq *req, int cmd)
6632 struct ixgbe_adapter *adapter = netdev_priv(netdev); 6606 struct ixgbe_adapter *adapter = netdev_priv(netdev);
6633 6607
6634 switch (cmd) { 6608 switch (cmd) {
6635#ifdef CONFIG_IXGBE_PTP
6636 case SIOCSHWTSTAMP: 6609 case SIOCSHWTSTAMP:
6637 return ixgbe_ptp_hwtstamp_ioctl(adapter, req, cmd); 6610 return ixgbe_ptp_hwtstamp_ioctl(adapter, req, cmd);
6638#endif
6639 default: 6611 default:
6640 return mdio_mii_ioctl(&adapter->hw.phy.mdio, if_mii(req), cmd); 6612 return mdio_mii_ioctl(&adapter->hw.phy.mdio, if_mii(req), cmd);
6641 } 6613 }
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig b/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig
index d0e36f2b6fba..00bc4fc968c7 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig
@@ -20,17 +20,3 @@ config PCH_GBE
20 purpose use. 20 purpose use.
21 ML7223/ML7831 is companion chip for Intel Atom E6xx series. 21 ML7223/ML7831 is companion chip for Intel Atom E6xx series.
22 ML7223/ML7831 is completely compatible for Intel EG20T PCH. 22 ML7223/ML7831 is completely compatible for Intel EG20T PCH.
23
24if PCH_GBE
25
26config PCH_PTP
27 bool "PCH PTP clock support"
28 default n
29 select PTP_1588_CLOCK
30 select PTP_1588_CLOCK_PCH
31 ---help---
32 Say Y here if you want to use Precision Time Protocol (PTP) in the
33 driver. PTP is a method to precisely synchronize distributed clocks
34 over Ethernet networks.
35
36endif # PCH_GBE
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h
index b07311eaa693..7fb7e178c74e 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h
@@ -649,7 +649,6 @@ extern void pch_gbe_free_tx_resources(struct pch_gbe_adapter *adapter,
649extern void pch_gbe_free_rx_resources(struct pch_gbe_adapter *adapter, 649extern void pch_gbe_free_rx_resources(struct pch_gbe_adapter *adapter,
650 struct pch_gbe_rx_ring *rx_ring); 650 struct pch_gbe_rx_ring *rx_ring);
651extern void pch_gbe_update_stats(struct pch_gbe_adapter *adapter); 651extern void pch_gbe_update_stats(struct pch_gbe_adapter *adapter);
652#ifdef CONFIG_PCH_PTP
653extern u32 pch_ch_control_read(struct pci_dev *pdev); 652extern u32 pch_ch_control_read(struct pci_dev *pdev);
654extern void pch_ch_control_write(struct pci_dev *pdev, u32 val); 653extern void pch_ch_control_write(struct pci_dev *pdev, u32 val);
655extern u32 pch_ch_event_read(struct pci_dev *pdev); 654extern u32 pch_ch_event_read(struct pci_dev *pdev);
@@ -659,7 +658,6 @@ extern u32 pch_src_uuid_hi_read(struct pci_dev *pdev);
659extern u64 pch_rx_snap_read(struct pci_dev *pdev); 658extern u64 pch_rx_snap_read(struct pci_dev *pdev);
660extern u64 pch_tx_snap_read(struct pci_dev *pdev); 659extern u64 pch_tx_snap_read(struct pci_dev *pdev);
661extern int pch_set_station_address(u8 *addr, struct pci_dev *pdev); 660extern int pch_set_station_address(u8 *addr, struct pci_dev *pdev);
662#endif
663 661
664/* pch_gbe_param.c */ 662/* pch_gbe_param.c */
665extern void pch_gbe_check_options(struct pch_gbe_adapter *adapter); 663extern void pch_gbe_check_options(struct pch_gbe_adapter *adapter);
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
index b2a94d02a521..499249a15e88 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
@@ -21,10 +21,8 @@
21#include "pch_gbe.h" 21#include "pch_gbe.h"
22#include "pch_gbe_api.h" 22#include "pch_gbe_api.h"
23#include <linux/module.h> 23#include <linux/module.h>
24#ifdef CONFIG_PCH_PTP
25#include <linux/net_tstamp.h> 24#include <linux/net_tstamp.h>
26#include <linux/ptp_classify.h> 25#include <linux/ptp_classify.h>
27#endif
28 26
29#define DRV_VERSION "1.01" 27#define DRV_VERSION "1.01"
30const char pch_driver_version[] = DRV_VERSION; 28const char pch_driver_version[] = DRV_VERSION;
@@ -98,7 +96,6 @@ const char pch_driver_version[] = DRV_VERSION;
98 96
99#define PCH_GBE_INT_DISABLE_ALL 0 97#define PCH_GBE_INT_DISABLE_ALL 0
100 98
101#ifdef CONFIG_PCH_PTP
102/* Macros for ieee1588 */ 99/* Macros for ieee1588 */
103/* 0x40 Time Synchronization Channel Control Register Bits */ 100/* 0x40 Time Synchronization Channel Control Register Bits */
104#define MASTER_MODE (1<<0) 101#define MASTER_MODE (1<<0)
@@ -113,7 +110,6 @@ const char pch_driver_version[] = DRV_VERSION;
113 110
114#define PTP_L4_MULTICAST_SA "01:00:5e:00:01:81" 111#define PTP_L4_MULTICAST_SA "01:00:5e:00:01:81"
115#define PTP_L2_MULTICAST_SA "01:1b:19:00:00:00" 112#define PTP_L2_MULTICAST_SA "01:1b:19:00:00:00"
116#endif
117 113
118static unsigned int copybreak __read_mostly = PCH_GBE_COPYBREAK_DEFAULT; 114static unsigned int copybreak __read_mostly = PCH_GBE_COPYBREAK_DEFAULT;
119 115
@@ -122,7 +118,6 @@ static void pch_gbe_mdio_write(struct net_device *netdev, int addr, int reg,
122 int data); 118 int data);
123static void pch_gbe_set_multi(struct net_device *netdev); 119static void pch_gbe_set_multi(struct net_device *netdev);
124 120
125#ifdef CONFIG_PCH_PTP
126static struct sock_filter ptp_filter[] = { 121static struct sock_filter ptp_filter[] = {
127 PTP_FILTER 122 PTP_FILTER
128}; 123};
@@ -291,7 +286,6 @@ static int hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
291 286
292 return copy_to_user(ifr->ifr_data, &cfg, sizeof(cfg)) ? -EFAULT : 0; 287 return copy_to_user(ifr->ifr_data, &cfg, sizeof(cfg)) ? -EFAULT : 0;
293} 288}
294#endif
295 289
296inline void pch_gbe_mac_load_mac_addr(struct pch_gbe_hw *hw) 290inline void pch_gbe_mac_load_mac_addr(struct pch_gbe_hw *hw)
297{ 291{
@@ -1261,9 +1255,7 @@ static void pch_gbe_tx_queue(struct pch_gbe_adapter *adapter,
1261 (int)sizeof(struct pch_gbe_tx_desc) * ring_num, 1255 (int)sizeof(struct pch_gbe_tx_desc) * ring_num,
1262 &hw->reg->TX_DSC_SW_P); 1256 &hw->reg->TX_DSC_SW_P);
1263 1257
1264#ifdef CONFIG_PCH_PTP
1265 pch_tx_timestamp(adapter, skb); 1258 pch_tx_timestamp(adapter, skb);
1266#endif
1267 1259
1268 dev_kfree_skb_any(skb); 1260 dev_kfree_skb_any(skb);
1269} 1261}
@@ -1771,9 +1763,7 @@ pch_gbe_clean_rx(struct pch_gbe_adapter *adapter,
1771 /* Write meta date of skb */ 1763 /* Write meta date of skb */
1772 skb_put(skb, length); 1764 skb_put(skb, length);
1773 1765
1774#ifdef CONFIG_PCH_PTP
1775 pch_rx_timestamp(adapter, skb); 1766 pch_rx_timestamp(adapter, skb);
1776#endif
1777 1767
1778 skb->protocol = eth_type_trans(skb, netdev); 1768 skb->protocol = eth_type_trans(skb, netdev);
1779 if (tcp_ip_status & PCH_GBE_RXD_ACC_STAT_TCPIPOK) 1769 if (tcp_ip_status & PCH_GBE_RXD_ACC_STAT_TCPIPOK)
@@ -2369,10 +2359,8 @@ static int pch_gbe_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
2369 2359
2370 pr_debug("cmd : 0x%04x\n", cmd); 2360 pr_debug("cmd : 0x%04x\n", cmd);
2371 2361
2372#ifdef CONFIG_PCH_PTP
2373 if (cmd == SIOCSHWTSTAMP) 2362 if (cmd == SIOCSHWTSTAMP)
2374 return hwtstamp_ioctl(netdev, ifr, cmd); 2363 return hwtstamp_ioctl(netdev, ifr, cmd);
2375#endif
2376 2364
2377 return generic_mii_ioctl(&adapter->mii, if_mii(ifr), cmd, NULL); 2365 return generic_mii_ioctl(&adapter->mii, if_mii(ifr), cmd, NULL);
2378} 2366}
@@ -2665,14 +2653,12 @@ static int pch_gbe_probe(struct pci_dev *pdev,
2665 goto err_free_netdev; 2653 goto err_free_netdev;
2666 } 2654 }
2667 2655
2668#ifdef CONFIG_PCH_PTP
2669 adapter->ptp_pdev = pci_get_bus_and_slot(adapter->pdev->bus->number, 2656 adapter->ptp_pdev = pci_get_bus_and_slot(adapter->pdev->bus->number,
2670 PCI_DEVFN(12, 4)); 2657 PCI_DEVFN(12, 4));
2671 if (ptp_filter_init(ptp_filter, ARRAY_SIZE(ptp_filter))) { 2658 if (ptp_filter_init(ptp_filter, ARRAY_SIZE(ptp_filter))) {
2672 pr_err("Bad ptp filter\n"); 2659 pr_err("Bad ptp filter\n");
2673 return -EINVAL; 2660 return -EINVAL;
2674 } 2661 }
2675#endif
2676 2662
2677 netdev->netdev_ops = &pch_gbe_netdev_ops; 2663 netdev->netdev_ops = &pch_gbe_netdev_ops;
2678 netdev->watchdog_timeo = PCH_GBE_WATCHDOG_PERIOD; 2664 netdev->watchdog_timeo = PCH_GBE_WATCHDOG_PERIOD;
diff --git a/drivers/net/ethernet/sfc/Kconfig b/drivers/net/ethernet/sfc/Kconfig
index 25906c1d1b15..fb3cbc27063c 100644
--- a/drivers/net/ethernet/sfc/Kconfig
+++ b/drivers/net/ethernet/sfc/Kconfig
@@ -34,10 +34,3 @@ config SFC_SRIOV
34 This enables support for the SFC9000 I/O Virtualization 34 This enables support for the SFC9000 I/O Virtualization
35 features, allowing accelerated network performance in 35 features, allowing accelerated network performance in
36 virtualized environments. 36 virtualized environments.
37config SFC_PTP
38 bool "Solarflare SFC9000-family PTP support"
39 depends on SFC && PTP_1588_CLOCK && !(SFC=y && PTP_1588_CLOCK=m)
40 default y
41 ---help---
42 This enables support for the Precision Time Protocol (PTP)
43 on SFC9000-family NICs
diff --git a/drivers/net/ethernet/sfc/Makefile b/drivers/net/ethernet/sfc/Makefile
index e11f2ecf69d9..945bf06e69ef 100644
--- a/drivers/net/ethernet/sfc/Makefile
+++ b/drivers/net/ethernet/sfc/Makefile
@@ -2,9 +2,8 @@ sfc-y += efx.o nic.o falcon.o siena.o tx.o rx.o filter.o \
2 falcon_xmac.o mcdi_mac.o \ 2 falcon_xmac.o mcdi_mac.o \
3 selftest.o ethtool.o qt202x_phy.o mdio_10g.o \ 3 selftest.o ethtool.o qt202x_phy.o mdio_10g.o \
4 tenxpress.o txc43128_phy.o falcon_boards.o \ 4 tenxpress.o txc43128_phy.o falcon_boards.o \
5 mcdi.o mcdi_phy.o mcdi_mon.o 5 mcdi.o mcdi_phy.o mcdi_mon.o ptp.o
6sfc-$(CONFIG_SFC_MTD) += mtd.o 6sfc-$(CONFIG_SFC_MTD) += mtd.o
7sfc-$(CONFIG_SFC_SRIOV) += siena_sriov.o 7sfc-$(CONFIG_SFC_SRIOV) += siena_sriov.o
8sfc-$(CONFIG_SFC_PTP) += ptp.o
9 8
10obj-$(CONFIG_SFC) += sfc.o 9obj-$(CONFIG_SFC) += sfc.o
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index 576a31091165..2487f582ab04 100644
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -868,9 +868,7 @@ struct efx_nic {
868 struct work_struct peer_work; 868 struct work_struct peer_work;
869#endif 869#endif
870 870
871#ifdef CONFIG_SFC_PTP
872 struct efx_ptp_data *ptp_data; 871 struct efx_ptp_data *ptp_data;
873#endif
874 872
875 /* The following fields may be written more often */ 873 /* The following fields may be written more often */
876 874
diff --git a/drivers/net/ethernet/sfc/nic.h b/drivers/net/ethernet/sfc/nic.h
index 438cef11f727..7a9647a3c565 100644
--- a/drivers/net/ethernet/sfc/nic.h
+++ b/drivers/net/ethernet/sfc/nic.h
@@ -252,7 +252,6 @@ extern int efx_sriov_set_vf_spoofchk(struct net_device *net_dev, int vf,
252 bool spoofchk); 252 bool spoofchk);
253 253
254struct ethtool_ts_info; 254struct ethtool_ts_info;
255#ifdef CONFIG_SFC_PTP
256extern void efx_ptp_probe(struct efx_nic *efx); 255extern void efx_ptp_probe(struct efx_nic *efx);
257extern int efx_ptp_ioctl(struct efx_nic *efx, struct ifreq *ifr, int cmd); 256extern int efx_ptp_ioctl(struct efx_nic *efx, struct ifreq *ifr, int cmd);
258extern int efx_ptp_get_ts_info(struct net_device *net_dev, 257extern int efx_ptp_get_ts_info(struct net_device *net_dev,
@@ -260,31 +259,6 @@ extern int efx_ptp_get_ts_info(struct net_device *net_dev,
260extern bool efx_ptp_is_ptp_tx(struct efx_nic *efx, struct sk_buff *skb); 259extern bool efx_ptp_is_ptp_tx(struct efx_nic *efx, struct sk_buff *skb);
261extern int efx_ptp_tx(struct efx_nic *efx, struct sk_buff *skb); 260extern int efx_ptp_tx(struct efx_nic *efx, struct sk_buff *skb);
262extern void efx_ptp_event(struct efx_nic *efx, efx_qword_t *ev); 261extern void efx_ptp_event(struct efx_nic *efx, efx_qword_t *ev);
263#else
264static inline void efx_ptp_probe(struct efx_nic *efx) {}
265static inline int efx_ptp_ioctl(struct efx_nic *efx, struct ifreq *ifr, int cmd)
266{
267 return -EOPNOTSUPP;
268}
269static inline int efx_ptp_get_ts_info(struct net_device *net_dev,
270 struct ethtool_ts_info *ts_info)
271{
272 ts_info->so_timestamping = (SOF_TIMESTAMPING_SOFTWARE |
273 SOF_TIMESTAMPING_RX_SOFTWARE);
274 ts_info->phc_index = -1;
275
276 return 0;
277}
278static inline bool efx_ptp_is_ptp_tx(struct efx_nic *efx, struct sk_buff *skb)
279{
280 return false;
281}
282static inline int efx_ptp_tx(struct efx_nic *efx, struct sk_buff *skb)
283{
284 return NETDEV_TX_OK;
285}
286static inline void efx_ptp_event(struct efx_nic *efx, efx_qword_t *ev) {}
287#endif
288 262
289extern const struct efx_nic_type falcon_a1_nic_type; 263extern const struct efx_nic_type falcon_a1_nic_type;
290extern const struct efx_nic_type falcon_b0_nic_type; 264extern const struct efx_nic_type falcon_b0_nic_type;
diff --git a/drivers/ptp/Kconfig b/drivers/ptp/Kconfig
index 131ef03fd11a..70c5836ebfc9 100644
--- a/drivers/ptp/Kconfig
+++ b/drivers/ptp/Kconfig
@@ -25,8 +25,9 @@ config PTP_1588_CLOCK
25 25
26config PTP_1588_CLOCK_GIANFAR 26config PTP_1588_CLOCK_GIANFAR
27 tristate "Freescale eTSEC as PTP clock" 27 tristate "Freescale eTSEC as PTP clock"
28 depends on PTP_1588_CLOCK
29 depends on GIANFAR 28 depends on GIANFAR
29 select PTP_1588_CLOCK
30 default y
30 help 31 help
31 This driver adds support for using the eTSEC as a PTP 32 This driver adds support for using the eTSEC as a PTP
32 clock. This clock is only useful if your PTP programs are 33 clock. This clock is only useful if your PTP programs are
@@ -38,8 +39,9 @@ config PTP_1588_CLOCK_GIANFAR
38 39
39config PTP_1588_CLOCK_IXP46X 40config PTP_1588_CLOCK_IXP46X
40 tristate "Intel IXP46x as PTP clock" 41 tristate "Intel IXP46x as PTP clock"
41 depends on PTP_1588_CLOCK
42 depends on IXP4XX_ETH 42 depends on IXP4XX_ETH
43 select PTP_1588_CLOCK
44 default y
43 help 45 help
44 This driver adds support for using the IXP46X as a PTP 46 This driver adds support for using the IXP46X as a PTP
45 clock. This clock is only useful if your PTP programs are 47 clock. This clock is only useful if your PTP programs are
@@ -50,13 +52,13 @@ config PTP_1588_CLOCK_IXP46X
50 will be called ptp_ixp46x. 52 will be called ptp_ixp46x.
51 53
52comment "Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks." 54comment "Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks."
53 depends on PTP_1588_CLOCK && (PHYLIB=n || NETWORK_PHY_TIMESTAMPING=n) 55 depends on PHYLIB=n || NETWORK_PHY_TIMESTAMPING=n
54 56
55config DP83640_PHY 57config DP83640_PHY
56 tristate "Driver for the National Semiconductor DP83640 PHYTER" 58 tristate "Driver for the National Semiconductor DP83640 PHYTER"
57 depends on PTP_1588_CLOCK
58 depends on NETWORK_PHY_TIMESTAMPING 59 depends on NETWORK_PHY_TIMESTAMPING
59 depends on PHYLIB 60 depends on PHYLIB
61 select PTP_1588_CLOCK
60 ---help--- 62 ---help---
61 Supports the DP83640 PHYTER with IEEE 1588 features. 63 Supports the DP83640 PHYTER with IEEE 1588 features.
62 64
@@ -70,8 +72,9 @@ config DP83640_PHY
70 72
71config PTP_1588_CLOCK_PCH 73config PTP_1588_CLOCK_PCH
72 tristate "Intel PCH EG20T as PTP clock" 74 tristate "Intel PCH EG20T as PTP clock"
73 depends on PTP_1588_CLOCK
74 depends on PCH_GBE 75 depends on PCH_GBE
76 select PTP_1588_CLOCK
77 default y
75 help 78 help
76 This driver adds support for using the PCH EG20T as a PTP 79 This driver adds support for using the PCH EG20T as a PTP
77 clock. The hardware supports time stamping of PTP packets 80 clock. The hardware supports time stamping of PTP packets