From: Grygorii Strashko <grygorii.strashko@ti.com>
To: Puranjay Mohan <p-mohan@ti.com>, Andrew Lunn <andrew@lunn.ch>
Cc: <linux-kernel@vger.kernel.org>, <bjorn.andersson@linaro.org>,
<mathieu.poirier@linaro.org>, <krzysztof.kozlowski+dt@linaro.org>,
<linux-remoteproc@vger.kernel.org>, <devicetree@vger.kernel.org>,
<nm@ti.com>, <ssantosh@kernel.org>, <s-anna@ti.com>,
<linux-arm-kernel@lists.infradead.org>, <davem@davemloft.net>,
<kuba@kernel.org>, <netdev@vger.kernel.org>, <vigneshr@ti.com>,
<kishon@ti.com>, Roger Quadros <rogerq@kernel.org>
Subject: Re: [RFC 13/13] net: ti: icssg-prueth: Add ICSSG ethernet driver
Date: Tue, 12 Apr 2022 12:56:18 +0300 [thread overview]
Message-ID: <f3ae48a8-7177-3a92-bdfd-3b243a5527c1@ti.com> (raw)
In-Reply-To: <468d4d9b-44b4-2894-2a75-4caab1e72147@ti.com>
On 12/04/2022 12:45, Puranjay Mohan wrote:
> + Roger, Grygorii
>
> On 07/04/22 00:07, Andrew Lunn wrote:
>>> +static int emac_phy_connect(struct prueth_emac *emac)
>>> +{
>>> + struct prueth *prueth = emac->prueth;
>>> +
>>> + /* connect PHY */
>>> + emac->phydev = of_phy_connect(emac->ndev, emac->phy_node,
>>> + &emac_adjust_link, 0, emac->phy_if);
>>
>>> +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);
>>> +
>>> + return 0;
>>> +}
>>>
>>
>> O.K, so this does not do what i initially thought it was doing. I was
>> thinking it was to fine tune the delay, ti,syscon-rgmii-delay would be
>> a small pico second value to allow the 2ns delay to be tuned to the
>> board.
>>
>> But now i think this is actually inserting the full 2ns delay?
>>
>> The problem is, you also pass phy_if to of_phy_connect() so the PHY
>> will also insert the delay if requested. So you end up with double
>> delays for rgmii_id and rgmii_txid.
It's misunderstanding here. The bit field name in TRM is RGMII0_ID_MODE
and meaning:
0h - Internal transmit delay is enabled
1h - Internal transmit delay is not enabled.
So here internal delay will be disabled for RGMII_ID/RGMII_TXID.
>>
>> The general recommendation is that the PHY inserts the delay, based on
>> phy-mode. The MAC does not add a delay, so i suggest you always write
>> 0 here, just to ensure the system is in a deterministic state, and the
>> bootloader and not being messing around with things.
>>
>> Andrew
--
Best regards,
Grygorii, Ukraine
next prev parent reply other threads:[~2022-04-12 11:08 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-06 9:43 [RFC 00/13] PRUSS Remoteproc, Platform APIS, and Ethernet Driver Puranjay Mohan
2022-04-06 9:43 ` [RFC 01/13] dt-bindings: remoteproc: Add PRU consumer bindings Puranjay Mohan
2022-04-07 13:50 ` Rob Herring
2022-04-07 15:09 ` Rob Herring
2022-04-12 6:41 ` Puranjay Mohan
2022-04-06 9:43 ` [RFC 02/13] remoteproc: pru: Add APIs to get and put the PRU cores Puranjay Mohan
2022-04-06 9:43 ` [RFC 03/13] remoteproc: pru: Make sysfs entries read-only for PRU client driven boots Puranjay Mohan
2022-04-06 9:43 ` [RFC 04/13] remoteproc: pru: Add pru_rproc_set_ctable() function Puranjay Mohan
2022-04-06 9:43 ` [RFC 05/13] remoteproc: pru: Configure firmware based on client setup Puranjay Mohan
2022-04-06 9:43 ` [RFC 06/13] soc: ti: pruss: Add pruss_get()/put() API Puranjay Mohan
2022-04-06 9:43 ` [RFC 07/13] soc: ti: pruss: Add pruss_{request,release}_mem_region() API Puranjay Mohan
2022-04-06 9:43 ` [RFC 08/13] soc: ti: pruss: Add pruss_cfg_read()/update() API Puranjay Mohan
2022-04-06 9:43 ` [RFC 09/13] soc: ti: pruss: Add helper functions to set GPI mode, MII_RT_event and XFR Puranjay Mohan
2022-04-06 9:43 ` [RFC 10/13] soc: ti: pruss: Add helper function to enable OCP master ports Puranjay Mohan
2022-04-06 9:43 ` [RFC 11/13] soc: ti: pruss: Add helper functions to get/set PRUSS_CFG_GPMUX Puranjay Mohan
2022-04-06 9:43 ` [RFC 12/13] dt-bindings: net: Add ICSSG Ethernet Driver bindings Puranjay Mohan
2022-04-06 18:54 ` Rob Herring
2022-04-07 16:56 ` Rob Herring
[not found] ` <20220406094358.7895-14-p-mohan@ti.com>
2022-04-06 14:13 ` [RFC 13/13] net: ti: icssg-prueth: Add ICSSG ethernet driver Andrew Lunn
2022-04-12 9:42 ` Puranjay Mohan
2022-04-13 8:15 ` Roger Quadros
2022-04-06 18:37 ` Andrew Lunn
2022-04-12 9:45 ` Puranjay Mohan
2022-04-12 9:56 ` Grygorii Strashko [this message]
2022-04-12 13:10 ` Andrew Lunn
2022-04-06 18:42 ` Andrew Lunn
2022-04-12 9:46 ` Puranjay Mohan
2022-04-13 8:09 ` Roger Quadros
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=f3ae48a8-7177-3a92-bdfd-3b243a5527c1@ti.com \
--to=grygorii.strashko@ti.com \
--cc=andrew@lunn.ch \
--cc=bjorn.andersson@linaro.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=kishon@ti.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=netdev@vger.kernel.org \
--cc=nm@ti.com \
--cc=p-mohan@ti.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox