From: "Jiawen Wu" <jiawenwu@trustnetic.com>
To: "'Richard Cochran'" <richardcochran@gmail.com>
Cc: <andrew+netdev@lunn.ch>, <davem@davemloft.net>,
<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
<linux@armlinux.org.uk>, <horms@kernel.org>,
<jacob.e.keller@intel.com>, <netdev@vger.kernel.org>,
<vadim.fedorenko@linux.dev>, <mengyuanlou@net-swift.com>
Subject: RE: [PATCH net-next v3 4/4] net: ngbe: Add support for 1PPS and TOD
Date: Mon, 13 Jan 2025 14:30:24 +0800 [thread overview]
Message-ID: <057b01db6584$a13a69d0$e3af3d70$@trustnetic.com> (raw)
In-Reply-To: <Z4KnPlCtlhHjFI6z@hoboy.vegasvil.org>
On Sun, Jan 12, 2025 1:16 AM, Richard Cochran wrote:
> On Fri, Jan 10, 2025 at 11:17:16AM +0800, Jiawen Wu wrote:
>
> When I quickly scan the logic here...
>
> > + /* Figure out how far past the next second we are */
> > + div_u64_rem(ns, WX_NS_PER_SEC, &rem);
> > +
> > + /* Figure out how many nanoseconds to add to round the clock edge up
> > + * to the next full second
> > + */
> > + rem = (WX_NS_PER_SEC - rem);
> > +
> > + /* Adjust the clock edge to align with the next full second. */
> > + wx->pps_edge_start += div_u64(((u64)rem << cc->shift), cc->mult);
> > + trgttiml0 = (u32)wx->pps_edge_start;
> > + trgttimh0 = (u32)(wx->pps_edge_start >> 32);
> > +
> > + wx_set_pps(wx, wx->pps_enabled, ns + rem, wx->pps_edge_start);
> > +
> > + rem += wx->pps_width;
> > + wx->pps_edge_end += div_u64(((u64)rem << cc->shift), cc->mult);
> > + trgttiml1 = (u32)wx->pps_edge_end;
> > + trgttimh1 = (u32)(wx->pps_edge_end >> 32);
> > +
> > + wr32ptp(wx, WX_TSC_1588_TRGT_L(0), trgttiml0);
> > + wr32ptp(wx, WX_TSC_1588_TRGT_H(0), trgttimh0);
> > + wr32ptp(wx, WX_TSC_1588_TRGT_L(1), trgttiml1);
> > + wr32ptp(wx, WX_TSC_1588_TRGT_H(1), trgttimh1);
> > + wr32ptp(wx, WX_TSC_1588_SDP(0), tssdp);
> > + wr32ptp(wx, WX_TSC_1588_SDP(1), tssdp1);
> > + wr32ptp(wx, WX_TSC_1588_AUX_CTL, tsauxc);
> > + wr32ptp(wx, WX_TSC_1588_INT_EN, WX_TSC_1588_INT_EN_TT1);
> > + WX_WRITE_FLUSH(wx);
> > +
> > + rem = WX_NS_PER_SEC;
> > + /* Adjust the clock edge to align with the next full second. */
> > + wx->sec_to_cc = div_u64(((u64)rem << cc->shift), cc->mult);
>
> ... that appears to be hard coding a period of one second?
Yes. We only want to support 1pps functionality.
>
> > + wx->pps_width = rq->perout.period.nsec;
> > + wx->ptp_setup_sdp(wx);
>
> And this ^^^ is taking the dialed period and turning into the duty
> cycle?
We try to use "width", which means the time from the rising edge to the falling edge.
next prev parent reply other threads:[~2025-01-13 6:33 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-10 3:17 [PATCH net-next v3 0/4] Support PTP clock for Wangxun NICs Jiawen Wu
2025-01-10 3:17 ` [PATCH net-next v3 1/4] net: wangxun: Add support for PTP clock Jiawen Wu
2025-01-10 13:35 ` Vadim Fedorenko
2025-01-13 7:16 ` Jiawen Wu
2025-01-13 10:38 ` Vadim Fedorenko
2025-01-10 3:17 ` [PATCH net-next v3 2/4] net: wangxun: Support to get ts info Jiawen Wu
2025-01-10 3:17 ` [PATCH net-next v3 3/4] net: wangxun: Implement do_aux_work of ptp_clock_info Jiawen Wu
2025-01-10 13:42 ` Vadim Fedorenko
2025-01-10 3:17 ` [PATCH net-next v3 4/4] net: ngbe: Add support for 1PPS and TOD Jiawen Wu
2025-01-11 16:42 ` Richard Cochran
2025-01-11 16:56 ` Richard Cochran
2025-01-11 17:15 ` Richard Cochran
2025-01-13 6:30 ` Jiawen Wu [this message]
2025-01-14 16:21 ` Richard Cochran
2025-01-11 17:18 ` Richard Cochran
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='057b01db6584$a13a69d0$e3af3d70$@trustnetic.com' \
--to=jiawenwu@trustnetic.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jacob.e.keller@intel.com \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mengyuanlou@net-swift.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=vadim.fedorenko@linux.dev \
/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).