Skip to content

Commit 186734c

Browse files
Roger Quadrosdavem330
authored andcommitted
net: ti: icssg-prueth: add packet timestamping and ptp support
Add packet timestamping TS and PTP PHC clock support. For AM65x and AM64x: - IEP1 is not used - IEP0 is configured in shadow mode with 1ms cycle and shared between Linux and FW. It provides time and TS in number cycles, so special conversation in ns is required. - IEP0 shared between PRUeth ports. - IEP0 supports PPS, periodic output. - IEP0 settime() and enabling PPS required FW interraction. - RX TS provided with each packet in CPPI5 descriptor. - TX TS returned through separate ICSSG hw queues for each port. TX TS readiness is signaled by INTC IRQ. Only one packet at time can be requested for TX TS. Signed-off-by: Roger Quadros <rogerq@ti.com> Co-developed-by: Grygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: MD Danish Anwar <danishanwar@ti.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent c1e0230 commit 186734c

File tree

5 files changed

+467
-6
lines changed

5 files changed

+467
-6
lines changed

drivers/net/ethernet/ti/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ config CPMAC
186186
config TI_ICSSG_PRUETH
187187
tristate "TI Gigabit PRU Ethernet driver"
188188
select PHYLIB
189+
select TI_ICSS_IEP
189190
depends on PRU_REMOTEPROC
190191
depends on ARCH_K3 && OF && TI_K3_UDMA_GLUE_LAYER
191192
help

drivers/net/ethernet/ti/icssg/icss_iep.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/regmap.h>
1414

1515
struct icss_iep;
16+
extern const struct icss_iep_clockops prueth_iep_clockops;
1617

1718
/* Firmware specific clock operations */
1819
struct icss_iep_clockops {

drivers/net/ethernet/ti/icssg/icssg_ethtool.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,26 @@ static void emac_get_ethtool_stats(struct net_device *ndev,
109109
*(data++) = emac->stats[i];
110110
}
111111

112+
static int emac_get_ts_info(struct net_device *ndev,
113+
struct ethtool_ts_info *info)
114+
{
115+
struct prueth_emac *emac = netdev_priv(ndev);
116+
117+
info->so_timestamping =
118+
SOF_TIMESTAMPING_TX_HARDWARE |
119+
SOF_TIMESTAMPING_TX_SOFTWARE |
120+
SOF_TIMESTAMPING_RX_HARDWARE |
121+
SOF_TIMESTAMPING_RX_SOFTWARE |
122+
SOF_TIMESTAMPING_SOFTWARE |
123+
SOF_TIMESTAMPING_RAW_HARDWARE;
124+
125+
info->phc_index = icss_iep_get_ptp_clock_idx(emac->iep);
126+
info->tx_types = BIT(HWTSTAMP_TX_OFF) | BIT(HWTSTAMP_TX_ON);
127+
info->rx_filters = BIT(HWTSTAMP_FILTER_NONE) | BIT(HWTSTAMP_FILTER_ALL);
128+
129+
return 0;
130+
}
131+
112132
static int emac_set_channels(struct net_device *ndev,
113133
struct ethtool_channels *ch)
114134
{
@@ -176,6 +196,7 @@ const struct ethtool_ops icssg_ethtool_ops = {
176196
.get_sset_count = emac_get_sset_count,
177197
.get_ethtool_stats = emac_get_ethtool_stats,
178198
.get_strings = emac_get_strings,
199+
.get_ts_info = emac_get_ts_info,
179200
.get_channels = emac_get_channels,
180201
.set_channels = emac_set_channels,
181202
.get_link_ksettings = emac_get_link_ksettings,

0 commit comments

Comments
 (0)