From: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
To: Mans Rullgard <mans@mansr.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
Andrew Lunn <andrew@lunn.ch>,
Martin Blumenstingl <martin.blumenstingl@gmail.com>,
Grygorii Strashko <grygorii.strashko@ti.com>,
Fabio Estevam <fabio.estevam@nxp.com>,
Zefir Kurtisi <zefir.kurtisi@neratec.com>,
Timur Tabi <timur@codeaurora.org>, Daniel Mack <zonque@gmail.com>,
netdev <netdev@vger.kernel.org>,
Linux ARM <linux-arm-kernel@lists.infradead.org>,
"David S. Miller" <davem@davemloft.net>,
Thibaud Cornic <thibaud_cornic@sigmadesigns.com>,
Mason <slash.tmp@free.fr>
Subject: Re: [PATCH v2 3/4] net: ethernet: nb8800: Fix RGMII TX clock delay setup
Date: Fri, 21 Jul 2017 16:18:09 +0200 [thread overview]
Message-ID: <168bfa24-1dfe-e389-ab75-367e6bd2141a@sigmadesigns.com> (raw)
In-Reply-To: <yw1xtw25q4vb.fsf@mansr.com>
On 21/07/2017 15:47, Måns Rullgård wrote:
> Marc Gonzalez wrote:
>
>> On 21/07/2017 15:04, Måns Rullgård wrote:
>>
>>> Marc Gonzalez wrote:
>>>
>>>> According to commit e5f3a4a56ce2a707b2fb8ce37e4414dcac89c672
>>>> ("Documentation: devicetree: clarify usage of the RGMII phy-modes")
>>>> there are 4 RGMII modes to handle:
>>>>
>>>> "rgmii" (RX and TX delays are added by the MAC when required)
>>>> "rgmii-id" (RGMII with internal RX and TX delays provided by the PHY,
>>>> the MAC should not add the RX or TX delays in this case)
>>>> "rgmii-rxid" (RGMII with internal RX delay provided by the PHY,
>>>> the MAC should not add an RX delay in this case)
>>>> "rgmii-txid" (RGMII with internal TX delay provided by the PHY,
>>>> the MAC should not add an TX delay in this case)
>>>>
>>>> Add TX delay in the MAC only for rgmii and rgmii-rxid.
>>>>
>>>> Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
>>>> ---
>>>> drivers/net/ethernet/aurora/nb8800.c | 6 ++++--
>>>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/net/ethernet/aurora/nb8800.c b/drivers/net/ethernet/aurora/nb8800.c
>>>> index ded041dbafe7..f3ed320eb4ad 100644
>>>> --- a/drivers/net/ethernet/aurora/nb8800.c
>>>> +++ b/drivers/net/ethernet/aurora/nb8800.c
>>>> @@ -1268,11 +1268,13 @@ static int nb8800_tangox_init(struct net_device *dev)
>>>> break;
>>>>
>>>> case PHY_INTERFACE_MODE_RGMII:
>>>> - pad_mode = PAD_MODE_RGMII;
>>>> + case PHY_INTERFACE_MODE_RGMII_RXID:
>>>> + pad_mode = PAD_MODE_RGMII | PAD_MODE_GTX_CLK_DELAY;
>>>> break;
>>>>
>>>> + case PHY_INTERFACE_MODE_RGMII_ID:
>>>> case PHY_INTERFACE_MODE_RGMII_TXID:
>>>> - pad_mode = PAD_MODE_RGMII | PAD_MODE_GTX_CLK_DELAY;
>>>> + pad_mode = PAD_MODE_RGMII;
>>>> break;
>>>>
>>>> default:
>>>
>>> I still don't like this. Having both the MAC and PHY drivers react to
>>> the phy-connection-type property is bound to cause trouble somewhere.
>>>
>>> The only way out of the current mess is to define new properties for
>>> both MAC and PHY that override the existing ones if present.
>>
>> Do you mean defining 4 new bindings and their corresponding
>> phy_interface_t enum values? For example:
>>
>> "rgmii-v2"
>> "rgmii-id-v2"
>> "rgmii-rxid-v2"
>> "rgmii-txid-v2"
>>
>> PHY_INTERFACE_MODE_RGMII_V2,
>> PHY_INTERFACE_MODE_RGMII_ID_V2,
>> PHY_INTERFACE_MODE_RGMII_RXID_V2,
>> PHY_INTERFACE_MODE_RGMII_TXID_V2,
>>
>> And then handling these new enums in the at803x and nb8800 drivers?
>
> It has already been suggested to add new properties specifying desired
> delays in picoseconds. If present on the MAC node, the MAC driver
> should attempt to provide the delay, and if present on the PHY node, the
> PHY driver is responsible.
Sorry, I had already forgotten about Florian's suggestion:
> If you introduced PHY and/or MAC specific properties to configure the
> delays in the appropriate unit of time (say ps), you could use a
> non-compliant 'phy-mode' just to satisfy the driver/PHY library and
> still override the delays you need.
So we would need two properties (RX and TX).
"rgmii_rx_skew_ps" and "rgmii_tx_skew_ps"
but it's not clear to me how the MAC probe function communicates
the arguments to the phy driver. Looks like we would need to add
two fields to struct phy_device, and maybe define a new phy-mode
to instruct the PHY driver to look for the two fields.
I don't have time to work on that for now, but I do need to
fix the nb8800 driver now. Can we apply the following patch
in the interim?
diff --git a/drivers/net/ethernet/aurora/nb8800.c b/drivers/net/ethernet/aurora/nb8800.c
index ded041dbafe7..e94159507847 100644
--- a/drivers/net/ethernet/aurora/nb8800.c
+++ b/drivers/net/ethernet/aurora/nb8800.c
@@ -1268,11 +1268,10 @@ static int nb8800_tangox_init(struct net_device *dev)
break;
case PHY_INTERFACE_MODE_RGMII:
- pad_mode = PAD_MODE_RGMII;
- break;
-
+ case PHY_INTERFACE_MODE_RGMII_ID:
+ case PHY_INTERFACE_MODE_RGMII_RXID:
case PHY_INTERFACE_MODE_RGMII_TXID:
- pad_mode = PAD_MODE_RGMII | PAD_MODE_GTX_CLK_DELAY;
+ pad_mode = PAD_MODE_RGMII;
break;
default:
Regards.
next prev parent reply other threads:[~2017-07-21 14:18 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-21 11:22 [PATCH v2 0/4] RGMII RX and TX clock delays using Atheros 8035 Marc Gonzalez
2017-07-21 11:25 ` [PATCH v2 1/4] net: phy: at803x: Document RGMII RX and TX clock delay issues Marc Gonzalez
2017-07-21 13:20 ` Timur Tabi
2017-07-21 13:29 ` Marc Gonzalez
2017-07-21 14:06 ` Timur Tabi
2017-07-21 14:36 ` Marc Gonzalez
2017-07-21 11:25 ` [PATCH v2 2/4] net: ethernet: nb8800: Set RGMII_MODE for all RGMII modes Marc Gonzalez
2017-07-21 13:00 ` Måns Rullgård
2017-07-21 18:06 ` Florian Fainelli
2017-07-21 11:26 ` [PATCH v2 3/4] net: ethernet: nb8800: Fix RGMII TX clock delay setup Marc Gonzalez
2017-07-21 13:04 ` Måns Rullgård
2017-07-21 13:43 ` Marc Gonzalez
2017-07-21 13:47 ` Måns Rullgård
2017-07-21 14:18 ` Marc Gonzalez [this message]
2017-07-21 14:24 ` Måns Rullgård
2017-07-21 18:15 ` Florian Fainelli
2017-07-21 11:29 ` [PATCH v2 4/4] ARM: dts: tango4: Add RGMII RX and TX clock delays Marc Gonzalez
2017-07-21 12:47 ` [PATCH v2 0/4] RGMII RX and TX clock delays using Atheros 8035 Marc Gonzalez
2017-07-21 13:16 ` Marc Gonzalez
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=168bfa24-1dfe-e389-ab75-367e6bd2141a@sigmadesigns.com \
--to=marc_gonzalez@sigmadesigns.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=fabio.estevam@nxp.com \
--cc=grygorii.strashko@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mans@mansr.com \
--cc=martin.blumenstingl@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=slash.tmp@free.fr \
--cc=thibaud_cornic@sigmadesigns.com \
--cc=timur@codeaurora.org \
--cc=zefir.kurtisi@neratec.com \
--cc=zonque@gmail.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;
as well as URLs for NNTP newsgroup(s).