From: Simon Horman <horms@kernel.org>
To: Min Li <lnimi@hotmail.com>
Cc: richardcochran@gmail.com, lee@kernel.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
Min Li <min.li.xe@renesas.com>
Subject: Re: [PATCH net-next v7 2/2] ptp: add FemtoClock3 Wireless as ptp hardware clock
Date: Fri, 5 Jan 2024 21:27:04 +0000 [thread overview]
Message-ID: <20240105212704.GB31813@kernel.org> (raw)
In-Reply-To: <PH7PR03MB706426DF26B4443DF1350E07A0662@PH7PR03MB7064.namprd03.prod.outlook.com>
On Fri, Jan 05, 2024 at 10:23:13AM -0500, Min Li wrote:
> From: Min Li <min.li.xe@renesas.com>
>
> The RENESAS FemtoClock3 Wireless is a high-performance jitter attenuator,
> frequency translator, and clock synthesizer. The device is comprised of 3
> digital PLLs (DPLL) to track CLKIN inputs and three independent low phase
> noise fractional output dividers (FOD) that output low phase noise clocks.
>
> FemtoClock3 supports one Time Synchronization (Time Sync) channel to enable
> an external processor to control the phase and frequency of the Time Sync
> channel and to take phase measurements using the TDC. Intended applications
> are synchronization using the precision time protocol (PTP) and
> synchronization with 0.5 Hz and 1 Hz signals from GNSS.
>
> Signed-off-by: Min Li <min.li.xe@renesas.com>
Hi Min Li,
some minor suggestions from my side.
...
> +static int idtfc3_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
> +{
> + struct idtfc3 *idtfc3 = container_of(ptp, struct idtfc3, caps);
> + int err;
> +
> + mutex_lock(idtfc3->lock);
> + err = _idtfc3_gettime(idtfc3, ts);
> + mutex_unlock(idtfc3->lock);
> +
> + if (err)
> + dev_err(idtfc3->dev, "Failed at line %d in %s!",
> + __LINE__, __func__);
IMHO messages like the one above offer no value to users.
I would remove it and similar messages.
> +
> + return err;
> +}
> +
> +static int _idtfc3_settime(struct idtfc3 *idtfc3, const struct timespec64 *ts)
> +{
> + s64 offset_ns, now_ns, sync_ns;
> + u32 counter, sub_ns;
> + int now;
> +
> + if (timespec64_valid(ts) == false) {
> + dev_err(idtfc3->dev, "%s: invalid timespec", __func__);
> + return -EINVAL;
> + }
> +
> + now = idtfc3_read_subcounter(idtfc3);
> + if (now < 0)
> + return now;
> +
> + offset_ns = (idtfc3->sub_sync_count - now) * idtfc3->ns_per_counter;
> + now_ns = timespec64_to_ns(ts);
> + sync_ns = ns2counters(idtfc3, offset_ns + now_ns, &sub_ns);
nit: sync_ns is set but unused in this function.
I think you can remove sync_ns from this function and simply do:
ns2counters(idtfc3, offset_ns + now_ns, &sub_ns);
> +
> + counter = sub_ns / idtfc3->ns_per_counter;
> + return idtfc3_timecounter_update(idtfc3, counter, now_ns);
> +}
...
next prev parent reply other threads:[~2024-01-05 21:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240105152313.24235-1-lnimi@hotmail.com>
2024-01-05 15:23 ` [PATCH net-next v7 2/2] ptp: add FemtoClock3 Wireless as ptp hardware clock Min Li
2024-01-05 21:27 ` Simon Horman [this message]
[not found] <20240124184947.5263-1-lnimi@hotmail.com>
2024-01-24 18:49 ` Min Li
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=20240105212704.GB31813@kernel.org \
--to=horms@kernel.org \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lnimi@hotmail.com \
--cc=min.li.xe@renesas.com \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
/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).