From: Luwei Zhou <b45643@freescale.com>
To: <davem@davemloft.net>, <richardcochran@gmail.com>
Cc: <netdev@vger.kernel.org>, <shawn.guo@linaro.org>,
<bhutchings@solarflare.com>, <R49496@freescale.com>,
<b38611@freescale.com>, <b20596@freescale.com>,
<stephen@networkplumber.org>
Subject: [PATCH v2 1/4] net: fec: ptp: Use the 31-bit ptp timer.
Date: Sun, 28 Sep 2014 12:20:08 +0800 [thread overview]
Message-ID: <1411878011-21767-2-git-send-email-b45643@freescale.com> (raw)
In-Reply-To: <1411878011-21767-1-git-send-email-b45643@freescale.com>
When ptp switches from software adjustment to hardware ajustment, linux ptp can't converge.
It is caused by the IP limit. Hardware adjustment logcial have issue when ptp counter
runs over 0x80000000(31 bit counter). The internal IP reference manual already remove 32bit
free-running count support. This patch replace the 32-bit PTP timer with 31-bit.
Signed-off-by: Luwei Zhou <b45643@freescale.com>
Signed-off-by: Frank Li <Frank.Li@freescale.com>
---
drivers/net/ethernet/freescale/fec_ptp.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c
index cca3617..8016bdd 100644
--- a/drivers/net/ethernet/freescale/fec_ptp.c
+++ b/drivers/net/ethernet/freescale/fec_ptp.c
@@ -70,6 +70,7 @@
#define FEC_TS_TIMESTAMP 0x418
#define FEC_CC_MULT (1 << 31)
+#define FEC_COUNTER_PERIOD (1 << 31)
/**
* fec_ptp_read - read raw cycle counter (to be used by time counter)
* @cc: the cyclecounter structure
@@ -113,14 +114,15 @@ void fec_ptp_start_cyclecounter(struct net_device *ndev)
/* 1ns counter */
writel(inc << FEC_T_INC_OFFSET, fep->hwp + FEC_ATIME_INC);
- /* use free running count */
- writel(0, fep->hwp + FEC_ATIME_EVT_PERIOD);
+ /* use 31-bit timer counter */
+ writel(FEC_COUNTER_PERIOD, fep->hwp + FEC_ATIME_EVT_PERIOD);
- writel(FEC_T_CTRL_ENABLE, fep->hwp + FEC_ATIME_CTRL);
+ writel(FEC_T_CTRL_ENABLE | FEC_T_CTRL_PERIOD_RST,
+ fep->hwp + FEC_ATIME_CTRL);
memset(&fep->cc, 0, sizeof(fep->cc));
fep->cc.read = fec_ptp_read;
- fep->cc.mask = CLOCKSOURCE_MASK(32);
+ fep->cc.mask = CLOCKSOURCE_MASK(31);
fep->cc.shift = 31;
fep->cc.mult = FEC_CC_MULT;
--
1.9.1
next prev parent reply other threads:[~2014-09-28 5:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-28 4:20 [PATCH v2 0/4] net: fec: ptp: Add FEC PPS ouput support Luwei Zhou
2014-09-28 4:20 ` Luwei Zhou [this message]
2014-09-28 4:20 ` [PATCH v2 2/4] net: fec: ptp: Use hardware algorithm to adjust PTP counter Luwei Zhou
2014-09-29 2:13 ` fugang.duan
2014-09-28 4:20 ` [PATCH v2 3/4] ptp: Add PTP_PF_PPS enumeration to ptp_pin_function Luwei Zhou
2014-09-29 8:56 ` Richard Cochran
2014-09-29 9:38 ` luwei.zhou
2014-09-29 13:25 ` Richard Cochran
2014-09-28 4:20 ` [PATCH v2 4/4] net: fec: ptp: Enalbe PPS ouput based on ptp clock Luwei Zhou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1411878011-21767-2-git-send-email-b45643@freescale.com \
--to=b45643@freescale.com \
--cc=R49496@freescale.com \
--cc=b20596@freescale.com \
--cc=b38611@freescale.com \
--cc=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
--cc=shawn.guo@linaro.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).