mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Pawel Dembicki <paweldembicki@gmail.com>
Cc: netdev@vger.kernel.org, Florian Fainelli <f.fainelli@gmail.com>,
	Vladimir Oltean <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 1/2] net: dsa: vsc73xx: make RGMII delays configurable
Date: Wed, 17 Jul 2024 20:30:01 +0200	[thread overview]
Message-ID: <97827b19-a747-4f4d-99e7-8c2bec3d5f0a@lunn.ch> (raw)
In-Reply-To: <20240716183735.1169323-1-paweldembicki@gmail.com>

On Tue, Jul 16, 2024 at 08:37:34PM +0200, Pawel Dembicki wrote:
> This patch switches hardcoded RGMII transmit/receive delay to
> a configurable value. Delay values are taken from the properties of
> the CPU port: 'tx-internal-delay-ps' and 'rx-internal-delay-ps'.
> 
> The default value is configured to 2.0 ns to maintain backward
> compatibility with existing code.
> 
> Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
> ---
>  drivers/net/dsa/vitesse-vsc73xx-core.c | 68 ++++++++++++++++++++++++--
>  1 file changed, 64 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/dsa/vitesse-vsc73xx-core.c b/drivers/net/dsa/vitesse-vsc73xx-core.c
> index d9d3e30fd47a..7d3c8176dff7 100644
> --- a/drivers/net/dsa/vitesse-vsc73xx-core.c
> +++ b/drivers/net/dsa/vitesse-vsc73xx-core.c
> @@ -684,6 +684,67 @@ vsc73xx_update_vlan_table(struct vsc73xx *vsc, int port, u16 vid, bool set)
>  	return vsc73xx_write_vlan_table_entry(vsc, vid, portmap);
>  }
>  
> +static void vsc73xx_configure_rgmii_port_delay(struct dsa_switch *ds)
> +{
> +	/* Keep 2.0 ns delay for backward complatibility */
> +	u32 tx_delay = VSC73XX_GMIIDELAY_GMII0_GTXDELAY_2_0_NS;
> +	u32 rx_delay = VSC73XX_GMIIDELAY_GMII0_RXDELAY_2_0_NS;
> +	struct dsa_port *dp = dsa_to_port(ds, CPU_PORT);
> +	struct device_node *port_dn = dp->dn;
> +	struct vsc73xx *vsc = ds->priv;
> +	u32 delay;
> +
> +	if (!of_property_read_u32(port_dn, "tx-internal-delay-ps", &delay)) {
> +		switch (delay) {
> +		case 0:
> +			tx_delay = VSC73XX_GMIIDELAY_GMII0_GTXDELAY_NONE;
> +			break;
> +		case 1400:
> +			tx_delay = VSC73XX_GMIIDELAY_GMII0_GTXDELAY_1_4_NS;
> +			break;
> +		case 1700:
> +			tx_delay = VSC73XX_GMIIDELAY_GMII0_GTXDELAY_1_7_NS;
> +			break;
> +		case 2000:
> +			break;
> +		default:
> +			dev_warn(vsc->dev,
> +				 "Unsupported RGMII Transmit Clock Delay, set to 2.0 ns\n");

I would suggest you make this dev_err() and return -EINVAL. The DT has
a real error in it which should be fixed.

> +			break;
> +		}
> +	} else {
> +		dev_info(vsc->dev,
> +			 "RGMII Transmit Clock Delay isn't configured, set to 2.0 ns\n");

This is for backwards compatibility. Do we need to spam the log? I
would say dev_dbg().

Same for RX please.

	Andrew

      parent reply	other threads:[~2024-07-17 18:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-16 18:37 Pawel Dembicki
2024-07-16 18:37 ` [PATCH net-next 2/2] dt-bindings: net: dsa: vsc73xx: add {rx,tx}-internal-delay-ps Pawel Dembicki
2024-07-17 18:33   ` Andrew Lunn
2024-07-17 18:30 ` Andrew Lunn [this message]

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=97827b19-a747-4f4d-99e7-8c2bec3d5f0a@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=paweldembicki@gmail.com \
    --cc=robh@kernel.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

all inboxes | Powered by JetHome®