Skip to contentSkip to conversation

ptp: bug fixes for 3.1 and 3.0

PATCH Applied Richard Cochran 2 participants 5 messages Aug 7, 2011 – Aug 8, 2011

Subsystems (4)
lore
Share & tools
lore

Richard Cochran

author maintainer
#0 lore raw

cover ptp: bug fixes for 3.1 and 3.0

These two patches fix two bugs in the PTP Hardware Clock drivers. The drivers were first introduced in Linux version 3.0.

Please apply them.

Thanks,
Richard

Richard Cochran (2):
gianfar: fix fiper alignment after resetting the time
dp83640: increase receive time stamp buffer size

 drivers/net/gianfar_ptp.c |    9 ++-------
 drivers/net/phy/dp83640.c |    5 ++---
 2 files changed, 4 insertions(+), 10 deletions(-)
author maintainer
#1 lore raw

PATCH 1/2 gianfar: fix fiper alignment after resetting the time

After resetting the time, the PPS signals on the FIPER output channels are incorrectly offset from the clock time, as can be readily verified by a looping back the FIPER to the external time stamp input.

Despite its name, setting the "Fiper Realignment Disable" bit seems to fix the problem, at least on the P2020.

Also, following the example code from the Freescale BSP, it is not really necessary to disable and re-enable the timer in order to reprogram the FIPER. (The documentation is rather unclear on this point. It seems that writing to the alarm register also disables the FIPER.)

---
 drivers/net/gianfar_ptp.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)
drivers/net/gianfar_ptp.c +2 -7
index 1c97861..f67b8ae 100644
@@ -193,14 +193,9 @@ static void set_alarm(struct etsects *etsects)
 /* Caller must hold etsects->lock. */
 static void set_fipers(struct etsects *etsects)
 {
-	u32 tmr_ctrl = gfar_read(&etsects->regs->tmr_ctrl);
-
-	gfar_write(&etsects->regs->tmr_ctrl,   tmr_ctrl & (~TE));
-	gfar_write(&etsects->regs->tmr_prsc,   etsects->tmr_prsc);
+	set_alarm(etsects);
 	gfar_write(&etsects->regs->tmr_fiper1, etsects->tmr_fiper1);
 	gfar_write(&etsects->regs->tmr_fiper2, etsects->tmr_fiper2);
-	set_alarm(etsects);
-	gfar_write(&etsects->regs->tmr_ctrl,   tmr_ctrl|TE);
 }
 
 /*
@@ -511,7 +506,7 @@ static int gianfar_ptp_probe(struct platform_device *dev)
 	gfar_write(&etsects->regs->tmr_fiper1, etsects->tmr_fiper1);
 	gfar_write(&etsects->regs->tmr_fiper2, etsects->tmr_fiper2);
 	set_alarm(etsects);
-	gfar_write(&etsects->regs->tmr_ctrl,   tmr_ctrl|FS|RTPE|TE);
+	gfar_write(&etsects->regs->tmr_ctrl,   tmr_ctrl|FS|RTPE|TE|FRD);
 
 	spin_unlock_irqrestore(&etsects->lock, flags);
 
Signature · 1 line
1.7.0.4
maintainer Applied
#2 lore raw

Re: [PATCH 1/2] gianfar: fix fiper alignment after resetting the time

From: Richard Cochran <[email protected]>
Date: Sun, 7 Aug 2011 09:03:03 +0200

Quoted 7 lines

After resetting the time, the PPS signals on the FIPER output channels are incorrectly offset from the clock time, as can be readily verified by a looping back the FIPER to the external time stamp input.

Despite its name, setting the "Fiper Realignment Disable" bit seems to fix the problem, at least on the P2020.

Quoted 7 lines

Also, following the example code from the Freescale BSP, it is not really necessary to disable and re-enable the timer in order to reprogram the FIPER. (The documentation is rather unclear on this point. It seems that writing to the alarm register also disables the FIPER.)

Applied.

author maintainer
#3 lore raw

PATCH 2/2 dp83640: increase receive time stamp buffer size

In reply to Richard Cochran

The dp83640 buffers receive time stamps from special PHY status frames, matching them to received PTP packets in a work queue. Because the timeout for orphaned time stamps is so long and the buffer is so small, the driver can drop time stamps under moderate PTP traffic.

This commit fixes the issue by decreasing the timeout to (at least) one timer tick and increasing the buffer size.

---
 drivers/net/phy/dp83640.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
drivers/net/phy/dp83640.c +2 -3
index 2cd8dc5..cb6e0b4 100644
@@ -34,8 +34,7 @@
 #define PAGESEL		0x13
 #define LAYER4		0x02
 #define LAYER2		0x01
-#define MAX_RXTS	4
-#define MAX_TXTS	4
+#define MAX_RXTS	64
 #define N_EXT_TS	1
 #define PSF_PTPVER	2
 #define PSF_EVNT	0x4000
@@ -218,7 +217,7 @@ static void phy2rxts(struct phy_rxts *p, struct rxts *rxts)
 	rxts->seqid = p->seqid;
 	rxts->msgtype = (p->msgtype >> 12) & 0xf;
 	rxts->hash = p->msgtype & 0x0fff;
-	rxts->tmo = jiffies + HZ;
+	rxts->tmo = jiffies + 2;
 }
 
 static u64 phy2txts(struct phy_txts *p)
Signature · 1 line
1.7.0.4
maintainer Applied
#4 lore raw

Re: [PATCH 2/2] dp83640: increase receive time stamp buffer size

From: Richard Cochran <[email protected]>
Date: Sun, 7 Aug 2011 09:03:04 +0200

Quoted 10 lines

The dp83640 buffers receive time stamps from special PHY status frames, matching them to received PTP packets in a work queue. Because the timeout for orphaned time stamps is so long and the buffer is so small, the driver can drop time stamps under moderate PTP traffic.

This commit fixes the issue by decreasing the timeout to (at least) one timer tick and increasing the buffer size.

Applied.

_______________________________________________
stable mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/stable