From: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [net-next] net: ethernet: rtsn: Add support for Renesas Ethernet-TSN
Date: Tue, 16 Apr 2024 10:58:02 +0200 [thread overview]
Message-ID: <20240416085802.GE3460978@ragnatech.se> (raw)
In-Reply-To: <5fd25c58-b421-4ec0-8b4f-24f86f054a44@lunn.ch>
Hi Andrew,
Thanks for your thorough review, much appreciated.
I agree with all suggestions except one and will fix those for v2.
On 2024-04-16 00:55:12 +0200, Andrew Lunn wrote:
<snip>
> > +static void rtsn_set_delay_mode(struct rtsn_private *priv)
> > +{
> > + struct device_node *np = priv->ndev->dev.parent->of_node;
> > + u32 delay;
> > + u32 val;
> > +
> > + val = 0;
> > +
> > + /* Valid values are 0 and 1800, according to DT bindings */
>
> The bindings should not matter. It is what the hardware supports. The
> bindings should match the hardware, since it is hard to modify the
> hardware to make it match the binding.
I agree the comment could be improved. It should likely point to the
datasheet instead. See below for why.
>
> > + if (!of_property_read_u32(np, "rx-internal-delay-ps", &delay))
> > + if (delay)
> > + val |= GPOUT_RDM;
> > +
> > + /* Valid values are 0 and 2000, according to DT bindings */
> > + if (!of_property_read_u32(np, "tx-internal-delay-ps", &delay))
> > + if (delay)
> > + val |= GPOUT_TDM;
> > +
> > + rtsn_write(priv, GPOUT, val);
>
> So you seem to be using it as bool?
Yes.
> That is wrong. It is a number of pico seconds!
The issue is that the hardware only supports no delay or a fixed delay
that can depend on electric properties of the board. The datasheets
states that the typical Rx delay is 1800 ps while the typical Tx delay
is 2000 ps. The hardware register implementation for this is a single
bit for each delay, on or off.
To model this in the bindings after some discussions [1] the standard
property was picked over a vendor specific bool variant of it. Here in
the driver I tried to document that the binding will enforce the value
to either be 0 or {1800,2000}, but that for the hardware it should be
treated as a on/off switch.
<snip>
1. https://lore.kernel.org/linux-renesas-soc/ZVzbigCtv2q_2-Bx@oden.dyn.berto.se/
--
Kind Regards,
Niklas Söderlund
next prev parent reply other threads:[~2024-04-16 8:58 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-14 13:59 [net-next] net: ethernet: rtsn: Add support for Renesas Ethernet-TSN Niklas Söderlund
2024-04-15 7:34 ` Paul Barker
2024-04-16 8:36 ` Niklas Söderlund
2024-04-15 22:55 ` Andrew Lunn
2024-04-16 8:58 ` Niklas Söderlund [this message]
2024-04-16 13:05 ` Andrew Lunn
2024-04-19 8:16 ` Geert Uytterhoeven
2024-04-19 12:56 ` Andrew Lunn
2024-05-03 10:20 ` Niklas Söderlund
2024-05-03 11:59 ` Andrew Lunn
2024-05-03 13:30 ` Niklas Söderlund
2024-05-06 1:51 ` Andrew Lunn
2024-05-06 14:05 ` Niklas Söderlund
2024-05-06 17:43 ` Geert Uytterhoeven
2024-05-06 18:26 ` Niklas Söderlund
2024-05-06 20:00 ` Andrew Lunn
2024-05-07 11:18 ` Niklas Söderlund
2024-05-06 19:53 ` Andrew Lunn
2024-05-07 11:14 ` Niklas Söderlund
2024-04-18 18:32 ` Simon Horman
2024-04-18 19:03 ` Arnd Bergmann
2024-05-03 8:50 ` Niklas Söderlund
2024-04-18 18:35 ` Simon Horman
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=20240416085802.GE3460978@ragnatech.se \
--to=niklas.soderlund+renesas@ragnatech.se \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=yoshihiro.shimoda.uh@renesas.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.