[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0d7b04a6-9f5b-41c7-bd52-890521019f8d@lunn.ch>
Date: Thu, 9 May 2024 22:25:27 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Niklas Söderlund <niklas.soderlund+renesas@...natech.se>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
netdev@...r.kernel.org, linux-renesas-soc@...r.kernel.org
Subject: Re: [net-next,v4] net: ethernet: rtsn: Add support for Renesas
Ethernet-TSN
> +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;
> +
> + /* The MAC is capable of applying a delay on both Rx and Tx. Each
> + * delay can either be on or off, there is no way to set its length.
> + *
> + * The exact delay applied depends on electric characteristics of the
> + * board. The datasheet describes a typical Rx delay of 1800 ps and a
> + * typical Tx delay of 2000 ps.
> + *
> + * There are boards where the RTSN device is used together with PHYs
> + * who do not support a large enough internal delays to function. These
> + * boards depends on the MAC applying these inexact delays.
> + */
> +
> + /* If the phy-mode is rgmii or rgmii-rxid apply Rx delay on the MAC */
> + if (priv->iface == PHY_INTERFACE_MODE_RGMII_ID ||
> + priv->iface == PHY_INTERFACE_MODE_RGMII_RXID)
> + if (!of_property_read_u32(np, "rx-internal-delay-ps", &delay))
> + if (delay)
> + val |= GPOUT_RDM;
> +
> + /* If the phy-mode is rgmii or rgmii-txid apply Tx delay on the MAC */
> + if (priv->iface == PHY_INTERFACE_MODE_RGMII_ID ||
> + priv->iface == PHY_INTERFACE_MODE_RGMII_TXID)
> + if (!of_property_read_u32(np, "tx-internal-delay-ps", &delay))
> + if (delay)
> + val |= GPOUT_TDM;
Much better, but still not correct. rx-internal-delay-ps and
tx-internal-delay-ps is meant for fine tuning the delays, generally in
steps of a few 10ps. It is applied unconditionally, since it is just a
fine tune.
You hardware does not support fine tuning, just 1800/2000ps. So it
makes no sense to use these DT properties. Just enable GPOUT_RDM or
GPOUT_TDM as appropriate for PHY_INTERFACE_MODE_*.
Andrew
---
pw-bot: cr
Powered by blists - more mailing lists