All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Puranjay Mohan <p-mohan@ti.com>
Cc: linux-kernel@vger.kernel.org, davem@davemloft.net,
	edumazet@google.com, krzysztof.kozlowski+dt@linaro.org,
	netdev@vger.kernel.org, devicetree@vger.kernel.org, nm@ti.com,
	ssantosh@kernel.org, s-anna@ti.com,
	linux-arm-kernel@lists.infradead.org, rogerq@kernel.org,
	grygorii.strashko@ti.com, vigneshr@ti.com, kishon@ti.com,
	robh+dt@kernel.org, afd@ti.com
Subject: Re: [PATCH 2/2] net: ti: icssg-prueth: Add ICSSG ethernet driver
Date: Fri, 6 May 2022 18:49:50 +0200	[thread overview]
Message-ID: <YnVRrk7fjPeme/JU@lunn.ch> (raw)
In-Reply-To: <20220506052433.28087-3-p-mohan@ti.com>

> +static int prueth_config_rgmiidelay(struct prueth *prueth,
> +				    struct device_node *eth_np,
> +				    phy_interface_t phy_if)
> +{
> +	struct device *dev = prueth->dev;
> +	struct regmap *ctrl_mmr;
> +	u32 rgmii_tx_id = 0;
> +	u32 icssgctrl_reg;
> +
> +	if (!phy_interface_mode_is_rgmii(phy_if))
> +		return 0;
> +
> +	ctrl_mmr = syscon_regmap_lookup_by_phandle(eth_np, "ti,syscon-rgmii-delay");
> +	if (IS_ERR(ctrl_mmr)) {
> +		dev_err(dev, "couldn't get ti,syscon-rgmii-delay\n");
> +		return -ENODEV;
> +	}
> +
> +	if (of_property_read_u32_index(eth_np, "ti,syscon-rgmii-delay", 1,
> +				       &icssgctrl_reg)) {
> +		dev_err(dev, "couldn't get ti,rgmii-delay reg. offset\n");
> +		return -ENODEV;
> +	}
> +
> +	if (phy_if == PHY_INTERFACE_MODE_RGMII_ID ||
> +	    phy_if == PHY_INTERFACE_MODE_RGMII_TXID)
> +		rgmii_tx_id |= ICSSG_CTRL_RGMII_ID_MODE;
> +
> +	regmap_update_bits(ctrl_mmr, icssgctrl_reg, ICSSG_CTRL_RGMII_ID_MODE, rgmii_tx_id);

I know we discussed this before. Why are you adding a delay here in
the MAC? If you do add the delay here, you need to mask what you pass
to phy_connect(), otherwise the PHY is also going to add a delay for
"id" and "txid".

In general, it is best to leave all delays to the PHY.

     Andrew

WARNING: multiple messages have this Message-ID (diff)
From: Andrew Lunn <andrew@lunn.ch>
To: Puranjay Mohan <p-mohan@ti.com>
Cc: nm@ti.com, devicetree@vger.kernel.org, grygorii.strashko@ti.com,
	vigneshr@ti.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, kishon@ti.com, rogerq@kernel.org,
	afd@ti.com, edumazet@google.com, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, ssantosh@kernel.org,
	davem@davemloft.net, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/2] net: ti: icssg-prueth: Add ICSSG ethernet driver
Date: Fri, 6 May 2022 18:49:50 +0200	[thread overview]
Message-ID: <YnVRrk7fjPeme/JU@lunn.ch> (raw)
In-Reply-To: <20220506052433.28087-3-p-mohan@ti.com>

> +static int prueth_config_rgmiidelay(struct prueth *prueth,
> +				    struct device_node *eth_np,
> +				    phy_interface_t phy_if)
> +{
> +	struct device *dev = prueth->dev;
> +	struct regmap *ctrl_mmr;
> +	u32 rgmii_tx_id = 0;
> +	u32 icssgctrl_reg;
> +
> +	if (!phy_interface_mode_is_rgmii(phy_if))
> +		return 0;
> +
> +	ctrl_mmr = syscon_regmap_lookup_by_phandle(eth_np, "ti,syscon-rgmii-delay");
> +	if (IS_ERR(ctrl_mmr)) {
> +		dev_err(dev, "couldn't get ti,syscon-rgmii-delay\n");
> +		return -ENODEV;
> +	}
> +
> +	if (of_property_read_u32_index(eth_np, "ti,syscon-rgmii-delay", 1,
> +				       &icssgctrl_reg)) {
> +		dev_err(dev, "couldn't get ti,rgmii-delay reg. offset\n");
> +		return -ENODEV;
> +	}
> +
> +	if (phy_if == PHY_INTERFACE_MODE_RGMII_ID ||
> +	    phy_if == PHY_INTERFACE_MODE_RGMII_TXID)
> +		rgmii_tx_id |= ICSSG_CTRL_RGMII_ID_MODE;
> +
> +	regmap_update_bits(ctrl_mmr, icssgctrl_reg, ICSSG_CTRL_RGMII_ID_MODE, rgmii_tx_id);

I know we discussed this before. Why are you adding a delay here in
the MAC? If you do add the delay here, you need to mask what you pass
to phy_connect(), otherwise the PHY is also going to add a delay for
"id" and "txid".

In general, it is best to leave all delays to the PHY.

     Andrew

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2022-05-06 16:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-06  5:24 [PATCH 0/2] Introduce ICSSG based ethernet Driver Puranjay Mohan
2022-05-06  5:24 ` Puranjay Mohan
2022-05-06  5:24 ` [PATCH 1/2] dt-bindings: net: Add ICSSG Ethernet Driver bindings Puranjay Mohan
2022-05-06  5:24   ` Puranjay Mohan
2022-05-06 13:37   ` Rob Herring
2022-05-06 13:37     ` Rob Herring
2022-05-10 18:07   ` Rob Herring
2022-05-10 18:07     ` Rob Herring
2022-05-06  5:24 ` [PATCH 2/2] net: ti: icssg-prueth: Add ICSSG ethernet driver Puranjay Mohan
2022-05-06 16:44   ` Andrew Lunn
2022-05-06 16:44     ` Andrew Lunn
2022-05-09 10:20     ` Puranjay Mohan
2022-05-09 10:20       ` Puranjay Mohan
2022-05-09 12:32       ` Andrew Lunn
2022-05-09 12:32         ` Andrew Lunn
2022-05-16  5:09         ` Puranjay Mohan
2022-05-16  5:09           ` Puranjay Mohan
2022-05-06 16:49   ` Andrew Lunn [this message]
2022-05-06 16:49     ` Andrew Lunn

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=YnVRrk7fjPeme/JU@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=afd@ti.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=grygorii.strashko@ti.com \
    --cc=kishon@ti.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=p-mohan@ti.com \
    --cc=robh+dt@kernel.org \
    --cc=rogerq@kernel.org \
    --cc=s-anna@ti.com \
    --cc=ssantosh@kernel.org \
    --cc=vigneshr@ti.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.