netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] Support PTP clock and hardware timestamping for DSA Felix driver
@ 2019-11-20  8:23 Yangbo Lu
  2019-11-20  8:23 ` [PATCH 1/5] net: mscc: ocelot: export ocelot_hwstamp_get/set functions Yangbo Lu
                   ` (5 more replies)
  0 siblings, 6 replies; 18+ messages in thread
From: Yangbo Lu @ 2019-11-20  8:23 UTC (permalink / raw)
  To: netdev, Alexandre Belloni, Microchip Linux Driver Support,
	David S . Miller, Vladimir Oltean, Claudiu Manoil,
	Vivien Didelot, Florian Fainelli, Richard Cochran
  Cc: Yangbo Lu

This patch-set is to support PTP clock and hardware timestamping
for DSA Felix driver. Some functions in ocelot.c/ocelot_board.c
driver were reworked/exported, so that DSA Felix driver was able
to reuse them as much as possible.

On TX path, timestamping works on packet which requires timestamp.
The injection header will be configured accordingly, and skb clone
requires timestamp will be added into a list. The TX timestamp
is final handled in threaded interrupt handler when PTP timestamp
FIFO is ready.
On RX path, timestamping is always working. The RX timestamp could
be got from extraction header.

Yangbo Lu (5):
  net: mscc: ocelot: export ocelot_hwstamp_get/set functions
  net: mscc: ocelot: convert to use ocelot_get_txtstamp()
  net: mscc: ocelot: convert to use ocelot_port_add_txtstamp_skb()
  net: dsa: ocelot: define PTP registers for felix_vsc9959
  net: dsa: ocelot: add hardware timestamping support for Felix

 drivers/net/dsa/ocelot/felix.c           |  89 ++++++++++++++++++++++++
 drivers/net/dsa/ocelot/felix_vsc9959.c   |  16 +++++
 drivers/net/ethernet/mscc/ocelot.c       | 113 +++++++++++++++++++++++++------
 drivers/net/ethernet/mscc/ocelot.h       |   6 --
 drivers/net/ethernet/mscc/ocelot_board.c |  53 +--------------
 include/soc/mscc/ocelot.h                |  13 +++-
 net/dsa/tag_ocelot.c                     |  14 +++-
 7 files changed, 222 insertions(+), 82 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 1/5] net: mscc: ocelot: export ocelot_hwstamp_get/set functions
  2019-11-20  8:23 [PATCH 0/5] Support PTP clock and hardware timestamping for DSA Felix driver Yangbo Lu
@ 2019-11-20  8:23 ` Yangbo Lu
  2019-11-21  2:40   ` Andrew Lunn
  2019-11-21  4:03   ` Florian Fainelli
  2019-11-20  8:23 ` [PATCH 2/5] net: mscc: ocelot: convert to use ocelot_get_txtstamp() Yangbo Lu
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 18+ messages in thread
From: Yangbo Lu @ 2019-11-20  8:23 UTC (permalink / raw)
  To: netdev, Alexandre Belloni, Microchip Linux Driver Support,
	David S . Miller, Vladimir Oltean, Claudiu Manoil,
	Vivien Didelot, Florian Fainelli, Richard Cochran
  Cc: Yangbo Lu

Export ocelot_hwstamp_get/set functions so that DSA driver
is able to reuse them.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
 drivers/net/ethernet/mscc/ocelot.c | 8 ++++----
 include/soc/mscc/ocelot.h          | 2 ++
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c
index 90c46ba..7302724 100644
--- a/drivers/net/ethernet/mscc/ocelot.c
+++ b/drivers/net/ethernet/mscc/ocelot.c
@@ -1049,15 +1049,14 @@ static int ocelot_get_port_parent_id(struct net_device *dev,
 	return 0;
 }
 
-static int ocelot_hwstamp_get(struct ocelot *ocelot, int port,
-			      struct ifreq *ifr)
+int ocelot_hwstamp_get(struct ocelot *ocelot, int port, struct ifreq *ifr)
 {
 	return copy_to_user(ifr->ifr_data, &ocelot->hwtstamp_config,
 			    sizeof(ocelot->hwtstamp_config)) ? -EFAULT : 0;
 }
+EXPORT_SYMBOL(ocelot_hwstamp_get);
 
-static int ocelot_hwstamp_set(struct ocelot *ocelot, int port,
-			      struct ifreq *ifr)
+int ocelot_hwstamp_set(struct ocelot *ocelot, int port, struct ifreq *ifr)
 {
 	struct ocelot_port *ocelot_port = ocelot->ports[port];
 	struct hwtstamp_config cfg;
@@ -1120,6 +1119,7 @@ static int ocelot_hwstamp_set(struct ocelot *ocelot, int port,
 
 	return copy_to_user(ifr->ifr_data, &cfg, sizeof(cfg)) ? -EFAULT : 0;
 }
+EXPORT_SYMBOL(ocelot_hwstamp_set);
 
 static int ocelot_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 {
diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h
index a836afe..2bac4bc 100644
--- a/include/soc/mscc/ocelot.h
+++ b/include/soc/mscc/ocelot.h
@@ -533,6 +533,8 @@ int ocelot_fdb_del(struct ocelot *ocelot, int port,
 int ocelot_vlan_add(struct ocelot *ocelot, int port, u16 vid, bool pvid,
 		    bool untagged);
 int ocelot_vlan_del(struct ocelot *ocelot, int port, u16 vid);
+int ocelot_hwstamp_get(struct ocelot *ocelot, int port, struct ifreq *ifr);
+int ocelot_hwstamp_set(struct ocelot *ocelot, int port, struct ifreq *ifr);
 int ocelot_ptp_gettime64(struct ptp_clock_info *ptp, struct timespec64 *ts);
 void ocelot_get_hwtimestamp(struct ocelot *ocelot, struct timespec64 *ts);
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 2/5] net: mscc: ocelot: convert to use ocelot_get_txtstamp()
  2019-11-20  8:23 [PATCH 0/5] Support PTP clock and hardware timestamping for DSA Felix driver Yangbo Lu
  2019-11-20  8:23 ` [PATCH 1/5] net: mscc: ocelot: export ocelot_hwstamp_get/set functions Yangbo Lu
@ 2019-11-20  8:23 ` Yangbo Lu
  2019-11-21  2:41   ` Andrew Lunn
  2019-11-21  4:04   ` Florian Fainelli
  2019-11-20  8:23 ` [PATCH 3/5] net: mscc: ocelot: convert to use ocelot_port_add_txtstamp_skb() Yangbo Lu
                   ` (3 subsequent siblings)
  5 siblings, 2 replies; 18+ messages in thread
From: Yangbo Lu @ 2019-11-20  8:23 UTC (permalink / raw)
  To: netdev, Alexandre Belloni, Microchip Linux Driver Support,
	David S . Miller, Vladimir Oltean, Claudiu Manoil,
	Vivien Didelot, Florian Fainelli, Richard Cochran
  Cc: Yangbo Lu

The method getting TX timestamp by reading timestamp FIFO and
matching skbs list is common for DSA Felix driver too.
So move code out of ocelot_board.c, convert to use
ocelot_get_txtstamp() function and export it.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
 drivers/net/ethernet/mscc/ocelot.c       | 62 ++++++++++++++++++++++++++++++--
 drivers/net/ethernet/mscc/ocelot.h       |  6 ----
 drivers/net/ethernet/mscc/ocelot_board.c | 53 +--------------------------
 include/soc/mscc/ocelot.h                |  9 ++++-
 4 files changed, 69 insertions(+), 61 deletions(-)

diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c
index 7302724..a58d2ed 100644
--- a/drivers/net/ethernet/mscc/ocelot.c
+++ b/drivers/net/ethernet/mscc/ocelot.c
@@ -661,7 +661,8 @@ static int ocelot_port_xmit(struct sk_buff *skb, struct net_device *dev)
 	return NETDEV_TX_OK;
 }
 
-void ocelot_get_hwtimestamp(struct ocelot *ocelot, struct timespec64 *ts)
+static void ocelot_get_hwtimestamp(struct ocelot *ocelot,
+				   struct timespec64 *ts)
 {
 	unsigned long flags;
 	u32 val;
@@ -686,7 +687,64 @@ void ocelot_get_hwtimestamp(struct ocelot *ocelot, struct timespec64 *ts)
 
 	spin_unlock_irqrestore(&ocelot->ptp_clock_lock, flags);
 }
-EXPORT_SYMBOL(ocelot_get_hwtimestamp);
+
+void ocelot_get_txtstamp(struct ocelot *ocelot)
+{
+	int budget = OCELOT_PTP_QUEUE_SZ;
+
+	while (budget--) {
+		struct skb_shared_hwtstamps shhwtstamps;
+		struct list_head *pos, *tmp;
+		struct sk_buff *skb = NULL;
+		struct ocelot_skb *entry;
+		struct ocelot_port *port;
+		struct timespec64 ts;
+		u32 val, id, txport;
+
+		val = ocelot_read(ocelot, SYS_PTP_STATUS);
+
+		/* Check if a timestamp can be retrieved */
+		if (!(val & SYS_PTP_STATUS_PTP_MESS_VLD))
+			break;
+
+		WARN_ON(val & SYS_PTP_STATUS_PTP_OVFL);
+
+		/* Retrieve the ts ID and Tx port */
+		id = SYS_PTP_STATUS_PTP_MESS_ID_X(val);
+		txport = SYS_PTP_STATUS_PTP_MESS_TXPORT_X(val);
+
+		/* Retrieve its associated skb */
+		port = ocelot->ports[txport];
+
+		list_for_each_safe(pos, tmp, &port->skbs) {
+			entry = list_entry(pos, struct ocelot_skb, head);
+			if (entry->id != id)
+				continue;
+
+			skb = entry->skb;
+
+			list_del(pos);
+			kfree(entry);
+		}
+
+		/* Next ts */
+		ocelot_write(ocelot, SYS_PTP_NXT_PTP_NXT, SYS_PTP_NXT);
+
+		if (unlikely(!skb))
+			continue;
+
+		/* Get the h/w timestamp */
+		ocelot_get_hwtimestamp(ocelot, &ts);
+
+		/* Set the timestamp into the skb */
+		memset(&shhwtstamps, 0, sizeof(shhwtstamps));
+		shhwtstamps.hwtstamp = ktime_set(ts.tv_sec, ts.tv_nsec);
+		skb_tstamp_tx(skb, &shhwtstamps);
+
+		dev_kfree_skb_any(skb);
+	}
+}
+EXPORT_SYMBOL(ocelot_get_txtstamp);
 
 static int ocelot_mc_unsync(struct net_device *dev, const unsigned char *addr)
 {
diff --git a/drivers/net/ethernet/mscc/ocelot.h b/drivers/net/ethernet/mscc/ocelot.h
index 32fef4f..c259114 100644
--- a/drivers/net/ethernet/mscc/ocelot.h
+++ b/drivers/net/ethernet/mscc/ocelot.h
@@ -74,12 +74,6 @@ struct ocelot_port_private {
 	struct ocelot_port_tc tc;
 };
 
-struct ocelot_skb {
-	struct list_head head;
-	struct sk_buff *skb;
-	u8 id;
-};
-
 u32 ocelot_port_readl(struct ocelot_port *port, u32 reg);
 void ocelot_port_writel(struct ocelot_port *port, u32 val, u32 reg);
 
diff --git a/drivers/net/ethernet/mscc/ocelot_board.c b/drivers/net/ethernet/mscc/ocelot_board.c
index 5541ec2..2da8eee 100644
--- a/drivers/net/ethernet/mscc/ocelot_board.c
+++ b/drivers/net/ethernet/mscc/ocelot_board.c
@@ -190,60 +190,9 @@ static irqreturn_t ocelot_xtr_irq_handler(int irq, void *arg)
 
 static irqreturn_t ocelot_ptp_rdy_irq_handler(int irq, void *arg)
 {
-	int budget = OCELOT_PTP_QUEUE_SZ;
 	struct ocelot *ocelot = arg;
 
-	while (budget--) {
-		struct skb_shared_hwtstamps shhwtstamps;
-		struct list_head *pos, *tmp;
-		struct sk_buff *skb = NULL;
-		struct ocelot_skb *entry;
-		struct ocelot_port *port;
-		struct timespec64 ts;
-		u32 val, id, txport;
-
-		val = ocelot_read(ocelot, SYS_PTP_STATUS);
-
-		/* Check if a timestamp can be retrieved */
-		if (!(val & SYS_PTP_STATUS_PTP_MESS_VLD))
-			break;
-
-		WARN_ON(val & SYS_PTP_STATUS_PTP_OVFL);
-
-		/* Retrieve the ts ID and Tx port */
-		id = SYS_PTP_STATUS_PTP_MESS_ID_X(val);
-		txport = SYS_PTP_STATUS_PTP_MESS_TXPORT_X(val);
-
-		/* Retrieve its associated skb */
-		port = ocelot->ports[txport];
-
-		list_for_each_safe(pos, tmp, &port->skbs) {
-			entry = list_entry(pos, struct ocelot_skb, head);
-			if (entry->id != id)
-				continue;
-
-			skb = entry->skb;
-
-			list_del(pos);
-			kfree(entry);
-		}
-
-		/* Next ts */
-		ocelot_write(ocelot, SYS_PTP_NXT_PTP_NXT, SYS_PTP_NXT);
-
-		if (unlikely(!skb))
-			continue;
-
-		/* Get the h/w timestamp */
-		ocelot_get_hwtimestamp(ocelot, &ts);
-
-		/* Set the timestamp into the skb */
-		memset(&shhwtstamps, 0, sizeof(shhwtstamps));
-		shhwtstamps.hwtstamp = ktime_set(ts.tv_sec, ts.tv_nsec);
-		skb_tstamp_tx(skb, &shhwtstamps);
-
-		dev_kfree_skb_any(skb);
-	}
+	ocelot_get_txtstamp(ocelot);
 
 	return IRQ_HANDLED;
 }
diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h
index 2bac4bc..1a5cb1b 100644
--- a/include/soc/mscc/ocelot.h
+++ b/include/soc/mscc/ocelot.h
@@ -406,6 +406,13 @@ struct ocelot_ops {
 	int (*reset)(struct ocelot *ocelot);
 };
 
+struct ocelot_skb {
+	struct list_head head;
+	struct sk_buff *skb;
+	u8 id;
+};
+
+
 struct ocelot_port {
 	struct ocelot			*ocelot;
 
@@ -536,6 +543,6 @@ int ocelot_vlan_del(struct ocelot *ocelot, int port, u16 vid);
 int ocelot_hwstamp_get(struct ocelot *ocelot, int port, struct ifreq *ifr);
 int ocelot_hwstamp_set(struct ocelot *ocelot, int port, struct ifreq *ifr);
 int ocelot_ptp_gettime64(struct ptp_clock_info *ptp, struct timespec64 *ts);
-void ocelot_get_hwtimestamp(struct ocelot *ocelot, struct timespec64 *ts);
+void ocelot_get_txtstamp(struct ocelot *ocelot);
 
 #endif
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 3/5] net: mscc: ocelot: convert to use ocelot_port_add_txtstamp_skb()
  2019-11-20  8:23 [PATCH 0/5] Support PTP clock and hardware timestamping for DSA Felix driver Yangbo Lu
  2019-11-20  8:23 ` [PATCH 1/5] net: mscc: ocelot: export ocelot_hwstamp_get/set functions Yangbo Lu
  2019-11-20  8:23 ` [PATCH 2/5] net: mscc: ocelot: convert to use ocelot_get_txtstamp() Yangbo Lu
@ 2019-11-20  8:23 ` Yangbo Lu
  2019-11-21  2:43   ` Andrew Lunn
  2019-11-21  4:04   ` Florian Fainelli
  2019-11-20  8:23 ` [PATCH 4/5] net: dsa: ocelot: define PTP registers for felix_vsc9959 Yangbo Lu
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 18+ messages in thread
From: Yangbo Lu @ 2019-11-20  8:23 UTC (permalink / raw)
  To: netdev, Alexandre Belloni, Microchip Linux Driver Support,
	David S . Miller, Vladimir Oltean, Claudiu Manoil,
	Vivien Didelot, Florian Fainelli, Richard Cochran
  Cc: Yangbo Lu

Convert to use ocelot_port_add_txtstamp_skb() for adding skbs which
require TX timestamp into list. Export it so that DSA Felix driver
could reuse it too.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
 drivers/net/ethernet/mscc/ocelot.c | 43 ++++++++++++++++++++++++--------------
 include/soc/mscc/ocelot.h          |  2 ++
 2 files changed, 29 insertions(+), 16 deletions(-)

diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c
index a58d2ed..0e96ffa 100644
--- a/drivers/net/ethernet/mscc/ocelot.c
+++ b/drivers/net/ethernet/mscc/ocelot.c
@@ -575,6 +575,32 @@ static int ocelot_gen_ifh(u32 *ifh, struct frame_info *info)
 	return 0;
 }
 
+int ocelot_port_add_txtstamp_skb(struct ocelot_port *ocelot_port,
+				 struct sk_buff *skb)
+{
+	struct skb_shared_info *shinfo = skb_shinfo(skb);
+	struct ocelot *ocelot = ocelot_port->ocelot;
+
+	if (ocelot->ptp && shinfo->tx_flags & SKBTX_HW_TSTAMP &&
+	    ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) {
+		struct ocelot_skb *oskb =
+			kzalloc(sizeof(struct ocelot_skb), GFP_ATOMIC);
+
+		if (unlikely(!oskb))
+			return -ENOMEM;
+
+		shinfo->tx_flags |= SKBTX_IN_PROGRESS;
+
+		oskb->skb = skb;
+		oskb->id = ocelot_port->ts_id % 4;
+
+		list_add_tail(&oskb->head, &ocelot_port->skbs);
+		return 0;
+	}
+	return -ENODATA;
+}
+EXPORT_SYMBOL(ocelot_port_add_txtstamp_skb);
+
 static int ocelot_port_xmit(struct sk_buff *skb, struct net_device *dev)
 {
 	struct ocelot_port_private *priv = netdev_priv(dev);
@@ -637,26 +663,11 @@ static int ocelot_port_xmit(struct sk_buff *skb, struct net_device *dev)
 	dev->stats.tx_packets++;
 	dev->stats.tx_bytes += skb->len;
 
-	if (ocelot->ptp && shinfo->tx_flags & SKBTX_HW_TSTAMP &&
-	    ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) {
-		struct ocelot_skb *oskb =
-			kzalloc(sizeof(struct ocelot_skb), GFP_ATOMIC);
-
-		if (unlikely(!oskb))
-			goto out;
-
-		skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
-
-		oskb->skb = skb;
-		oskb->id = ocelot_port->ts_id % 4;
+	if (!ocelot_port_add_txtstamp_skb(ocelot_port, skb)) {
 		ocelot_port->ts_id++;
-
-		list_add_tail(&oskb->head, &ocelot_port->skbs);
-
 		return NETDEV_TX_OK;
 	}
 
-out:
 	dev_kfree_skb_any(skb);
 	return NETDEV_TX_OK;
 }
diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h
index 1a5cb1b..e1108a5 100644
--- a/include/soc/mscc/ocelot.h
+++ b/include/soc/mscc/ocelot.h
@@ -543,6 +543,8 @@ int ocelot_vlan_del(struct ocelot *ocelot, int port, u16 vid);
 int ocelot_hwstamp_get(struct ocelot *ocelot, int port, struct ifreq *ifr);
 int ocelot_hwstamp_set(struct ocelot *ocelot, int port, struct ifreq *ifr);
 int ocelot_ptp_gettime64(struct ptp_clock_info *ptp, struct timespec64 *ts);
+int ocelot_port_add_txtstamp_skb(struct ocelot_port *ocelot_port,
+				 struct sk_buff *skb);
 void ocelot_get_txtstamp(struct ocelot *ocelot);
 
 #endif
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 4/5] net: dsa: ocelot: define PTP registers for felix_vsc9959
  2019-11-20  8:23 [PATCH 0/5] Support PTP clock and hardware timestamping for DSA Felix driver Yangbo Lu
                   ` (2 preceding siblings ...)
  2019-11-20  8:23 ` [PATCH 3/5] net: mscc: ocelot: convert to use ocelot_port_add_txtstamp_skb() Yangbo Lu
@ 2019-11-20  8:23 ` Yangbo Lu
  2019-11-21  2:49   ` Andrew Lunn
  2019-11-21  4:04   ` Florian Fainelli
  2019-11-20  8:23 ` [PATCH 5/5] net: dsa: ocelot: add hardware timestamping support for Felix Yangbo Lu
  2019-11-21 22:39 ` [PATCH 0/5] Support PTP clock and hardware timestamping for DSA Felix driver David Miller
  5 siblings, 2 replies; 18+ messages in thread
From: Yangbo Lu @ 2019-11-20  8:23 UTC (permalink / raw)
  To: netdev, Alexandre Belloni, Microchip Linux Driver Support,
	David S . Miller, Vladimir Oltean, Claudiu Manoil,
	Vivien Didelot, Florian Fainelli, Richard Cochran
  Cc: Yangbo Lu

This patch is to define PTP registers for felix_vsc9959.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
 drivers/net/dsa/ocelot/felix_vsc9959.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c
index d67bd14..b9758b0 100644
--- a/drivers/net/dsa/ocelot/felix_vsc9959.c
+++ b/drivers/net/dsa/ocelot/felix_vsc9959.c
@@ -282,6 +282,16 @@ static const u32 vsc9959_sys_regmap[] = {
 	REG_RESERVED(SYS_CM_DATA),
 };
 
+static const u32 vsc9959_ptp_regmap[] = {
+	REG(PTP_PIN_CFG,                   0x000000),
+	REG(PTP_PIN_TOD_SEC_MSB,           0x000004),
+	REG(PTP_PIN_TOD_SEC_LSB,           0x000008),
+	REG(PTP_PIN_TOD_NSEC,              0x00000c),
+	REG(PTP_CFG_MISC,                  0x0000a0),
+	REG(PTP_CLK_CFG_ADJ_CFG,           0x0000a4),
+	REG(PTP_CLK_CFG_ADJ_FREQ,          0x0000a8),
+};
+
 static const u32 vsc9959_gcb_regmap[] = {
 	REG(GCB_SOFT_RST,			0x000004),
 };
@@ -293,6 +303,7 @@ static const u32 *vsc9959_regmap[] = {
 	[REW]	= vsc9959_rew_regmap,
 	[SYS]	= vsc9959_sys_regmap,
 	[S2]	= vsc9959_s2_regmap,
+	[PTP]	= vsc9959_ptp_regmap,
 	[GCB]	= vsc9959_gcb_regmap,
 };
 
@@ -330,6 +341,11 @@ static struct resource vsc9959_target_io_res[] = {
 		.end	= 0x00603ff,
 		.name	= "s2",
 	},
+	[PTP] = {
+		.start	= 0x0090000,
+		.end	= 0x00900cb,
+		.name	= "ptp",
+	},
 	[GCB] = {
 		.start	= 0x0070000,
 		.end	= 0x00701ff,
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 5/5] net: dsa: ocelot: add hardware timestamping support for Felix
  2019-11-20  8:23 [PATCH 0/5] Support PTP clock and hardware timestamping for DSA Felix driver Yangbo Lu
                   ` (3 preceding siblings ...)
  2019-11-20  8:23 ` [PATCH 4/5] net: dsa: ocelot: define PTP registers for felix_vsc9959 Yangbo Lu
@ 2019-11-20  8:23 ` Yangbo Lu
  2019-11-21  2:56   ` Andrew Lunn
  2019-11-21 22:39 ` [PATCH 0/5] Support PTP clock and hardware timestamping for DSA Felix driver David Miller
  5 siblings, 1 reply; 18+ messages in thread
From: Yangbo Lu @ 2019-11-20  8:23 UTC (permalink / raw)
  To: netdev, Alexandre Belloni, Microchip Linux Driver Support,
	David S . Miller, Vladimir Oltean, Claudiu Manoil,
	Vivien Didelot, Florian Fainelli, Richard Cochran
  Cc: Yangbo Lu

This patch is to reuse ocelot functions as possible to enable PTP
clock and to support hardware timestamping on Felix.
On TX path, timestamping works on packet which requires timestamp.
The injection header will be configured accordingly, and skb clone
requires timestamp will be added into a list. The TX timestamp
is final handled in threaded interrupt handler when PTP timestamp
FIFO is ready.
On RX path, timestamping is always working. The RX timestamp could
be got from extraction header.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
 drivers/net/dsa/ocelot/felix.c | 89 ++++++++++++++++++++++++++++++++++++++++++
 net/dsa/tag_ocelot.c           | 14 ++++++-
 2 files changed, 102 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
index ce3637b..167e415 100644
--- a/drivers/net/dsa/ocelot/felix.c
+++ b/drivers/net/dsa/ocelot/felix.c
@@ -3,6 +3,7 @@
  */
 #include <uapi/linux/if_bridge.h>
 #include <soc/mscc/ocelot.h>
+#include <linux/packing.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/of.h>
@@ -303,6 +304,62 @@ static void felix_teardown(struct dsa_switch *ds)
 	ocelot_deinit(ocelot);
 }
 
+static int felix_hwtstamp_get(struct dsa_switch *ds, int port,
+			      struct ifreq *ifr)
+{
+	struct ocelot *ocelot = ds->priv;
+
+	return ocelot_hwstamp_get(ocelot, port, ifr);
+}
+
+static int felix_hwtstamp_set(struct dsa_switch *ds, int port,
+			      struct ifreq *ifr)
+{
+	struct ocelot *ocelot = ds->priv;
+
+	return ocelot_hwstamp_set(ocelot, port, ifr);
+}
+
+static bool felix_rxtstamp(struct dsa_switch *ds, int port,
+			   struct sk_buff *skb, unsigned int type)
+{
+	struct skb_shared_hwtstamps *shhwtstamps;
+	struct ocelot *ocelot = ds->priv;
+	u8 *extraction = skb->data - ETH_HLEN - OCELOT_TAG_LEN;
+	u32 tstamp_lo, tstamp_hi;
+	struct timespec64 ts;
+	u64 tstamp, val;
+
+	ocelot_ptp_gettime64(&ocelot->ptp_info, &ts);
+	tstamp = ktime_set(ts.tv_sec, ts.tv_nsec);
+
+	packing(extraction, &val,  116, 85, OCELOT_TAG_LEN, UNPACK, 0);
+	tstamp_lo = (u32)val;
+
+	tstamp_hi = tstamp >> 32;
+	if ((tstamp & 0xffffffff) < tstamp_lo)
+		tstamp_hi--;
+
+	tstamp = ((u64)tstamp_hi << 32) | tstamp_lo;
+
+	shhwtstamps = skb_hwtstamps(skb);
+	memset(shhwtstamps, 0, sizeof(struct skb_shared_hwtstamps));
+	shhwtstamps->hwtstamp = tstamp;
+	return false;
+}
+
+bool felix_txtstamp(struct dsa_switch *ds, int port,
+		    struct sk_buff *clone, unsigned int type)
+{
+	struct ocelot *ocelot = ds->priv;
+	struct ocelot_port *ocelot_port = ocelot->ports[port];
+
+	if (!ocelot_port_add_txtstamp_skb(ocelot_port, clone))
+		return true;
+
+	return false;
+}
+
 static const struct dsa_switch_ops felix_switch_ops = {
 	.get_tag_protocol	= felix_get_tag_protocol,
 	.setup			= felix_setup,
@@ -325,12 +382,33 @@ static const struct dsa_switch_ops felix_switch_ops = {
 	.port_vlan_filtering	= felix_vlan_filtering,
 	.port_vlan_add		= felix_vlan_add,
 	.port_vlan_del		= felix_vlan_del,
+	.port_hwtstamp_get	= felix_hwtstamp_get,
+	.port_hwtstamp_set	= felix_hwtstamp_set,
+	.port_rxtstamp		= felix_rxtstamp,
+	.port_txtstamp		= felix_txtstamp,
 };
 
 static struct felix_info *felix_instance_tbl[] = {
 	[FELIX_INSTANCE_VSC9959] = &felix_info_vsc9959,
 };
 
+static irqreturn_t felix_irq_handler(int irq, void *data)
+{
+	struct ocelot *ocelot = (struct ocelot *)data;
+
+	/* The INTB interrupt is used for both PTP TX timestamp interrupt
+	 * and preemption status change interrupt on each port.
+	 *
+	 * - Get txtstamp if have
+	 * - TODO: handle preemption. Without handling it, driver may get
+	 *   interrupt storm.
+	 */
+
+	ocelot_get_txtstamp(ocelot);
+
+	return IRQ_HANDLED;
+}
+
 static int felix_pci_probe(struct pci_dev *pdev,
 			   const struct pci_device_id *id)
 {
@@ -372,6 +450,16 @@ static int felix_pci_probe(struct pci_dev *pdev,
 
 	pci_set_master(pdev);
 
+	err = devm_request_threaded_irq(&pdev->dev, pdev->irq, NULL,
+					&felix_irq_handler, IRQF_ONESHOT,
+					"felix-intb", ocelot);
+	if (err) {
+		dev_err(&pdev->dev, "Failed to request irq\n");
+		goto err_alloc_irq;
+	}
+
+	ocelot->ptp = 1;
+
 	ds = kzalloc(sizeof(struct dsa_switch), GFP_KERNEL);
 	if (!ds) {
 		err = -ENOMEM;
@@ -396,6 +484,7 @@ static int felix_pci_probe(struct pci_dev *pdev,
 err_register_ds:
 	kfree(ds);
 err_alloc_ds:
+err_alloc_irq:
 err_alloc_felix:
 	kfree(felix);
 err_dma:
diff --git a/net/dsa/tag_ocelot.c b/net/dsa/tag_ocelot.c
index 078d479..8e3e728 100644
--- a/net/dsa/tag_ocelot.c
+++ b/net/dsa/tag_ocelot.c
@@ -137,9 +137,11 @@ static struct sk_buff *ocelot_xmit(struct sk_buff *skb,
 				   struct net_device *netdev)
 {
 	struct dsa_port *dp = dsa_slave_to_port(netdev);
-	u64 bypass, dest, src, qos_class;
+	u64 bypass, dest, src, qos_class, rew_op;
 	struct dsa_switch *ds = dp->ds;
 	int port = dp->index;
+	struct ocelot *ocelot = ds->priv;
+	struct ocelot_port *ocelot_port = ocelot->ports[port];
 	u8 *injection;
 
 	if (unlikely(skb_cow_head(skb, OCELOT_TAG_LEN) < 0)) {
@@ -161,6 +163,16 @@ static struct sk_buff *ocelot_xmit(struct sk_buff *skb,
 	packing(injection, &src,       46,  43, OCELOT_TAG_LEN, PACK, 0);
 	packing(injection, &qos_class, 19,  17, OCELOT_TAG_LEN, PACK, 0);
 
+	if (ocelot->ptp && (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) {
+		rew_op = ocelot_port->ptp_cmd;
+		if (ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) {
+			rew_op |= (ocelot_port->ts_id  % 4) << 3;
+			ocelot_port->ts_id++;
+		}
+
+		packing(injection, &rew_op, 125, 117, OCELOT_TAG_LEN, PACK, 0);
+	}
+
 	return skb;
 }
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/5] net: mscc: ocelot: export ocelot_hwstamp_get/set functions
  2019-11-20  8:23 ` [PATCH 1/5] net: mscc: ocelot: export ocelot_hwstamp_get/set functions Yangbo Lu
@ 2019-11-21  2:40   ` Andrew Lunn
  2019-11-21  4:03   ` Florian Fainelli
  1 sibling, 0 replies; 18+ messages in thread
From: Andrew Lunn @ 2019-11-21  2:40 UTC (permalink / raw)
  To: Yangbo Lu
  Cc: netdev, Alexandre Belloni, Microchip Linux Driver Support,
	David S . Miller, Vladimir Oltean, Claudiu Manoil,
	Vivien Didelot, Florian Fainelli, Richard Cochran

On Wed, Nov 20, 2019 at 04:23:14PM +0800, Yangbo Lu wrote:
> Export ocelot_hwstamp_get/set functions so that DSA driver
> is able to reuse them.
> 
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/5] net: mscc: ocelot: convert to use ocelot_get_txtstamp()
  2019-11-20  8:23 ` [PATCH 2/5] net: mscc: ocelot: convert to use ocelot_get_txtstamp() Yangbo Lu
@ 2019-11-21  2:41   ` Andrew Lunn
  2019-11-21  4:04   ` Florian Fainelli
  1 sibling, 0 replies; 18+ messages in thread
From: Andrew Lunn @ 2019-11-21  2:41 UTC (permalink / raw)
  To: Yangbo Lu
  Cc: netdev, Alexandre Belloni, Microchip Linux Driver Support,
	David S . Miller, Vladimir Oltean, Claudiu Manoil,
	Vivien Didelot, Florian Fainelli, Richard Cochran

On Wed, Nov 20, 2019 at 04:23:15PM +0800, Yangbo Lu wrote:
> The method getting TX timestamp by reading timestamp FIFO and
> matching skbs list is common for DSA Felix driver too.
> So move code out of ocelot_board.c, convert to use
> ocelot_get_txtstamp() function and export it.
> 
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/5] net: mscc: ocelot: convert to use ocelot_port_add_txtstamp_skb()
  2019-11-20  8:23 ` [PATCH 3/5] net: mscc: ocelot: convert to use ocelot_port_add_txtstamp_skb() Yangbo Lu
@ 2019-11-21  2:43   ` Andrew Lunn
  2019-11-21  4:04   ` Florian Fainelli
  1 sibling, 0 replies; 18+ messages in thread
From: Andrew Lunn @ 2019-11-21  2:43 UTC (permalink / raw)
  To: Yangbo Lu
  Cc: netdev, Alexandre Belloni, Microchip Linux Driver Support,
	David S . Miller, Vladimir Oltean, Claudiu Manoil,
	Vivien Didelot, Florian Fainelli, Richard Cochran

On Wed, Nov 20, 2019 at 04:23:16PM +0800, Yangbo Lu wrote:
> Convert to use ocelot_port_add_txtstamp_skb() for adding skbs which
> require TX timestamp into list. Export it so that DSA Felix driver
> could reuse it too.
> 
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 4/5] net: dsa: ocelot: define PTP registers for felix_vsc9959
  2019-11-20  8:23 ` [PATCH 4/5] net: dsa: ocelot: define PTP registers for felix_vsc9959 Yangbo Lu
@ 2019-11-21  2:49   ` Andrew Lunn
  2019-11-21  3:20     ` Y.b. Lu
  2019-11-21  4:04   ` Florian Fainelli
  1 sibling, 1 reply; 18+ messages in thread
From: Andrew Lunn @ 2019-11-21  2:49 UTC (permalink / raw)
  To: Yangbo Lu
  Cc: netdev, Alexandre Belloni, Microchip Linux Driver Support,
	David S . Miller, Vladimir Oltean, Claudiu Manoil,
	Vivien Didelot, Florian Fainelli, Richard Cochran

> +static const u32 vsc9959_ptp_regmap[] = {
> +	REG(PTP_PIN_CFG,                   0x000000),
> +	REG(PTP_PIN_TOD_SEC_MSB,           0x000004),
> +	REG(PTP_PIN_TOD_SEC_LSB,           0x000008),
> +	REG(PTP_PIN_TOD_NSEC,              0x00000c),
> +	REG(PTP_CFG_MISC,                  0x0000a0),
> +	REG(PTP_CLK_CFG_ADJ_CFG,           0x0000a4),
> +	REG(PTP_CLK_CFG_ADJ_FREQ,          0x0000a8),
> +};
> +

> +	[PTP] = {
> +		.start	= 0x0090000,
> +		.end	= 0x00900cb,
> +		.name	= "ptp",
> +	},

Seems like an odd end value. Is the last word used for something else?

Also, the last regmap register you defined is 0xa8. So could end
actually be 900ab?

	 Andrew

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 5/5] net: dsa: ocelot: add hardware timestamping support for Felix
  2019-11-20  8:23 ` [PATCH 5/5] net: dsa: ocelot: add hardware timestamping support for Felix Yangbo Lu
@ 2019-11-21  2:56   ` Andrew Lunn
  2019-11-21  3:29     ` Y.b. Lu
  0 siblings, 1 reply; 18+ messages in thread
From: Andrew Lunn @ 2019-11-21  2:56 UTC (permalink / raw)
  To: Yangbo Lu
  Cc: netdev, Alexandre Belloni, Microchip Linux Driver Support,
	David S . Miller, Vladimir Oltean, Claudiu Manoil,
	Vivien Didelot, Florian Fainelli, Richard Cochran

> +static irqreturn_t felix_irq_handler(int irq, void *data)
> +{
> +	struct ocelot *ocelot = (struct ocelot *)data;
> +
> +	/* The INTB interrupt is used for both PTP TX timestamp interrupt
> +	 * and preemption status change interrupt on each port.
> +	 *
> +	 * - Get txtstamp if have
> +	 * - TODO: handle preemption. Without handling it, driver may get
> +	 *   interrupt storm.
> +	 */

I assume there are no register bits to enable/disable these two
interrupt sources?

What is preemption?

     Andrew

^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: [PATCH 4/5] net: dsa: ocelot: define PTP registers for felix_vsc9959
  2019-11-21  2:49   ` Andrew Lunn
@ 2019-11-21  3:20     ` Y.b. Lu
  0 siblings, 0 replies; 18+ messages in thread
From: Y.b. Lu @ 2019-11-21  3:20 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: netdev, Alexandre Belloni, Microchip Linux Driver Support,
	David S . Miller, Vladimir Oltean, Claudiu Manoil,
	Vivien Didelot, Florian Fainelli, Richard Cochran

Hi Andrew,

> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: Thursday, November 21, 2019 10:49 AM
> To: Y.b. Lu <yangbo.lu@nxp.com>
> Cc: netdev@vger.kernel.org; Alexandre Belloni
> <alexandre.belloni@bootlin.com>; Microchip Linux Driver Support
> <UNGLinuxDriver@microchip.com>; David S . Miller <davem@davemloft.net>;
> Vladimir Oltean <vladimir.oltean@nxp.com>; Claudiu Manoil
> <claudiu.manoil@nxp.com>; Vivien Didelot <vivien.didelot@gmail.com>;
> Florian Fainelli <f.fainelli@gmail.com>; Richard Cochran
> <richardcochran@gmail.com>
> Subject: Re: [PATCH 4/5] net: dsa: ocelot: define PTP registers for
> felix_vsc9959
> 
> > +static const u32 vsc9959_ptp_regmap[] = {
> > +	REG(PTP_PIN_CFG,                   0x000000),
> > +	REG(PTP_PIN_TOD_SEC_MSB,           0x000004),
> > +	REG(PTP_PIN_TOD_SEC_LSB,           0x000008),
> > +	REG(PTP_PIN_TOD_NSEC,              0x00000c),
> > +	REG(PTP_CFG_MISC,                  0x0000a0),
> > +	REG(PTP_CLK_CFG_ADJ_CFG,           0x0000a4),
> > +	REG(PTP_CLK_CFG_ADJ_FREQ,          0x0000a8),
> > +};
> > +
> 
> > +	[PTP] = {
> > +		.start	= 0x0090000,
> > +		.end	= 0x00900cb,
> > +		.name	= "ptp",
> > +	},
> 
> Seems like an odd end value. Is the last word used for something else?
> 
> Also, the last regmap register you defined is 0xa8. So could end actually be
> 900ab?

[Y.b. Lu] The PTP registers range is from 0x0090000 to 0x00900cb according to reference manual.
The patch has only defined the registers which ocelot driver is using now, not all registers in vsc9959_ptp_regmap.

In the future, as new features will be added, I think more registers will be added to use.
Thanks.
> 
> 	 Andrew

^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: [PATCH 5/5] net: dsa: ocelot: add hardware timestamping support for Felix
  2019-11-21  2:56   ` Andrew Lunn
@ 2019-11-21  3:29     ` Y.b. Lu
  0 siblings, 0 replies; 18+ messages in thread
From: Y.b. Lu @ 2019-11-21  3:29 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: netdev, Alexandre Belloni, Microchip Linux Driver Support,
	David S . Miller, Vladimir Oltean, Claudiu Manoil,
	Vivien Didelot, Florian Fainelli, Richard Cochran

Hi Andrew,

> -----Original Message-----
> From: netdev-owner@vger.kernel.org <netdev-owner@vger.kernel.org> On
> Behalf Of Andrew Lunn
> Sent: Thursday, November 21, 2019 10:56 AM
> To: Y.b. Lu <yangbo.lu@nxp.com>
> Cc: netdev@vger.kernel.org; Alexandre Belloni
> <alexandre.belloni@bootlin.com>; Microchip Linux Driver Support
> <UNGLinuxDriver@microchip.com>; David S . Miller <davem@davemloft.net>;
> Vladimir Oltean <vladimir.oltean@nxp.com>; Claudiu Manoil
> <claudiu.manoil@nxp.com>; Vivien Didelot <vivien.didelot@gmail.com>;
> Florian Fainelli <f.fainelli@gmail.com>; Richard Cochran
> <richardcochran@gmail.com>
> Subject: Re: [PATCH 5/5] net: dsa: ocelot: add hardware timestamping support
> for Felix
> 
> > +static irqreturn_t felix_irq_handler(int irq, void *data) {
> > +	struct ocelot *ocelot = (struct ocelot *)data;
> > +
> > +	/* The INTB interrupt is used for both PTP TX timestamp interrupt
> > +	 * and preemption status change interrupt on each port.
> > +	 *
> > +	 * - Get txtstamp if have
> > +	 * - TODO: handle preemption. Without handling it, driver may get
> > +	 *   interrupt storm.
> > +	 */
> 
> I assume there are no register bits to enable/disable these two interrupt
> sources?
> 
> What is preemption?

[Y.b. Lu] For PTP timestamp interrupt, there are not register bits to enable/disable interrupt source, and to clean interrupt status.
That's why use threaded handler with oneshot flag.
For preemption, it is a feature of TSN Qbu. I'm not familiar with it. The function hasn't been supported/enabled in driver.
It seems it has status bit to check, but has no bits to enable/disable interrupt source either.

Thanks.
> 
>      Andrew

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/5] net: mscc: ocelot: export ocelot_hwstamp_get/set functions
  2019-11-20  8:23 ` [PATCH 1/5] net: mscc: ocelot: export ocelot_hwstamp_get/set functions Yangbo Lu
  2019-11-21  2:40   ` Andrew Lunn
@ 2019-11-21  4:03   ` Florian Fainelli
  1 sibling, 0 replies; 18+ messages in thread
From: Florian Fainelli @ 2019-11-21  4:03 UTC (permalink / raw)
  To: Yangbo Lu, netdev, Alexandre Belloni,
	Microchip Linux Driver Support, David S . Miller,
	Vladimir Oltean, Claudiu Manoil, Vivien Didelot, Richard Cochran



On 11/20/2019 12:23 AM, Yangbo Lu wrote:
> Export ocelot_hwstamp_get/set functions so that DSA driver
> is able to reuse them.
> 
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/5] net: mscc: ocelot: convert to use ocelot_get_txtstamp()
  2019-11-20  8:23 ` [PATCH 2/5] net: mscc: ocelot: convert to use ocelot_get_txtstamp() Yangbo Lu
  2019-11-21  2:41   ` Andrew Lunn
@ 2019-11-21  4:04   ` Florian Fainelli
  1 sibling, 0 replies; 18+ messages in thread
From: Florian Fainelli @ 2019-11-21  4:04 UTC (permalink / raw)
  To: Yangbo Lu, netdev, Alexandre Belloni,
	Microchip Linux Driver Support, David S . Miller,
	Vladimir Oltean, Claudiu Manoil, Vivien Didelot, Richard Cochran



On 11/20/2019 12:23 AM, Yangbo Lu wrote:
> The method getting TX timestamp by reading timestamp FIFO and
> matching skbs list is common for DSA Felix driver too.
> So move code out of ocelot_board.c, convert to use
> ocelot_get_txtstamp() function and export it.
> 
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/5] net: mscc: ocelot: convert to use ocelot_port_add_txtstamp_skb()
  2019-11-20  8:23 ` [PATCH 3/5] net: mscc: ocelot: convert to use ocelot_port_add_txtstamp_skb() Yangbo Lu
  2019-11-21  2:43   ` Andrew Lunn
@ 2019-11-21  4:04   ` Florian Fainelli
  1 sibling, 0 replies; 18+ messages in thread
From: Florian Fainelli @ 2019-11-21  4:04 UTC (permalink / raw)
  To: Yangbo Lu, netdev, Alexandre Belloni,
	Microchip Linux Driver Support, David S . Miller,
	Vladimir Oltean, Claudiu Manoil, Vivien Didelot, Richard Cochran



On 11/20/2019 12:23 AM, Yangbo Lu wrote:
> Convert to use ocelot_port_add_txtstamp_skb() for adding skbs which
> require TX timestamp into list. Export it so that DSA Felix driver
> could reuse it too.
> 
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 4/5] net: dsa: ocelot: define PTP registers for felix_vsc9959
  2019-11-20  8:23 ` [PATCH 4/5] net: dsa: ocelot: define PTP registers for felix_vsc9959 Yangbo Lu
  2019-11-21  2:49   ` Andrew Lunn
@ 2019-11-21  4:04   ` Florian Fainelli
  1 sibling, 0 replies; 18+ messages in thread
From: Florian Fainelli @ 2019-11-21  4:04 UTC (permalink / raw)
  To: Yangbo Lu, netdev, Alexandre Belloni,
	Microchip Linux Driver Support, David S . Miller,
	Vladimir Oltean, Claudiu Manoil, Vivien Didelot, Richard Cochran



On 11/20/2019 12:23 AM, Yangbo Lu wrote:
> This patch is to define PTP registers for felix_vsc9959.
> 
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 0/5] Support PTP clock and hardware timestamping for DSA Felix driver
  2019-11-20  8:23 [PATCH 0/5] Support PTP clock and hardware timestamping for DSA Felix driver Yangbo Lu
                   ` (4 preceding siblings ...)
  2019-11-20  8:23 ` [PATCH 5/5] net: dsa: ocelot: add hardware timestamping support for Felix Yangbo Lu
@ 2019-11-21 22:39 ` David Miller
  5 siblings, 0 replies; 18+ messages in thread
From: David Miller @ 2019-11-21 22:39 UTC (permalink / raw)
  To: yangbo.lu
  Cc: netdev, alexandre.belloni, UNGLinuxDriver, vladimir.oltean,
	claudiu.manoil, vivien.didelot, f.fainelli, richardcochran

From: Yangbo Lu <yangbo.lu@nxp.com>
Date: Wed, 20 Nov 2019 16:23:13 +0800

> This patch-set is to support PTP clock and hardware timestamping
> for DSA Felix driver. Some functions in ocelot.c/ocelot_board.c
> driver were reworked/exported, so that DSA Felix driver was able
> to reuse them as much as possible.
> 
> On TX path, timestamping works on packet which requires timestamp.
> The injection header will be configured accordingly, and skb clone
> requires timestamp will be added into a list. The TX timestamp
> is final handled in threaded interrupt handler when PTP timestamp
> FIFO is ready.
> On RX path, timestamping is always working. The RX timestamp could
> be got from extraction header.

Series applied, thank you.

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2019-11-21 22:39 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-20  8:23 [PATCH 0/5] Support PTP clock and hardware timestamping for DSA Felix driver Yangbo Lu
2019-11-20  8:23 ` [PATCH 1/5] net: mscc: ocelot: export ocelot_hwstamp_get/set functions Yangbo Lu
2019-11-21  2:40   ` Andrew Lunn
2019-11-21  4:03   ` Florian Fainelli
2019-11-20  8:23 ` [PATCH 2/5] net: mscc: ocelot: convert to use ocelot_get_txtstamp() Yangbo Lu
2019-11-21  2:41   ` Andrew Lunn
2019-11-21  4:04   ` Florian Fainelli
2019-11-20  8:23 ` [PATCH 3/5] net: mscc: ocelot: convert to use ocelot_port_add_txtstamp_skb() Yangbo Lu
2019-11-21  2:43   ` Andrew Lunn
2019-11-21  4:04   ` Florian Fainelli
2019-11-20  8:23 ` [PATCH 4/5] net: dsa: ocelot: define PTP registers for felix_vsc9959 Yangbo Lu
2019-11-21  2:49   ` Andrew Lunn
2019-11-21  3:20     ` Y.b. Lu
2019-11-21  4:04   ` Florian Fainelli
2019-11-20  8:23 ` [PATCH 5/5] net: dsa: ocelot: add hardware timestamping support for Felix Yangbo Lu
2019-11-21  2:56   ` Andrew Lunn
2019-11-21  3:29     ` Y.b. Lu
2019-11-21 22:39 ` [PATCH 0/5] Support PTP clock and hardware timestamping for DSA Felix driver David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).