diff options
author | Bryan Whitehead <Bryan.Whitehead@microchip.com> | 2018-08-09 22:36:10 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-08-11 21:42:18 +0300 |
commit | 07624df1c9efd4b7f2f6762581587c590b03c7a2 (patch) | |
tree | 89a02c8d6a7f6aa34558b1b0f6cc94549d406ed8 /drivers/net/ethernet/microchip/lan743x_ethtool.c | |
parent | 217e502b89d42dce2afa80a1256adceae070237e (diff) | |
download | linux-07624df1c9efd4b7f2f6762581587c590b03c7a2.tar.xz |
lan743x: lan743x: Add PTP support
PTP support includes:
Ingress, and egress timestamping.
One step timestamping available.
PTP clock support.
Periodic output support.
Signed-off-by: Bryan Whitehead <Bryan.Whitehead@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/microchip/lan743x_ethtool.c')
-rw-r--r-- | drivers/net/ethernet/microchip/lan743x_ethtool.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/net/ethernet/microchip/lan743x_ethtool.c b/drivers/net/ethernet/microchip/lan743x_ethtool.c index c25b3e97ae26..07c1eb63415a 100644 --- a/drivers/net/ethernet/microchip/lan743x_ethtool.c +++ b/drivers/net/ethernet/microchip/lan743x_ethtool.c @@ -4,6 +4,7 @@ #include <linux/netdevice.h> #include "lan743x_main.h" #include "lan743x_ethtool.h" +#include <linux/net_tstamp.h> #include <linux/pci.h> #include <linux/phy.h> @@ -542,6 +543,31 @@ static int lan743x_ethtool_set_rxfh(struct net_device *netdev, return 0; } +static int lan743x_ethtool_get_ts_info(struct net_device *netdev, + struct ethtool_ts_info *ts_info) +{ + struct lan743x_adapter *adapter = netdev_priv(netdev); + + ts_info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE | + SOF_TIMESTAMPING_RX_SOFTWARE | + SOF_TIMESTAMPING_SOFTWARE | + SOF_TIMESTAMPING_TX_HARDWARE | + SOF_TIMESTAMPING_RX_HARDWARE | + SOF_TIMESTAMPING_RAW_HARDWARE; + + if (adapter->ptp.ptp_clock) + ts_info->phc_index = ptp_clock_index(adapter->ptp.ptp_clock); + else + ts_info->phc_index = -1; + + ts_info->tx_types = BIT(HWTSTAMP_TX_OFF) | + BIT(HWTSTAMP_TX_ON) | + BIT(HWTSTAMP_TX_ONESTEP_SYNC); + ts_info->rx_filters = BIT(HWTSTAMP_FILTER_NONE) | + BIT(HWTSTAMP_FILTER_ALL); + return 0; +} + static int lan743x_ethtool_get_eee(struct net_device *netdev, struct ethtool_eee *eee) { @@ -685,6 +711,7 @@ const struct ethtool_ops lan743x_ethtool_ops = { .get_rxfh_indir_size = lan743x_ethtool_get_rxfh_indir_size, .get_rxfh = lan743x_ethtool_get_rxfh, .set_rxfh = lan743x_ethtool_set_rxfh, + .get_ts_info = lan743x_ethtool_get_ts_info, .get_eee = lan743x_ethtool_get_eee, .set_eee = lan743x_ethtool_set_eee, .get_link_ksettings = phy_ethtool_get_link_ksettings, |