From mboxrd@z Thu Jan 1 00:00:00 1970 From: jbrunet@baylibre.com (Jerome Brunet) Date: Fri, 25 Nov 2016 10:53:49 +0100 Subject: [net-next PATCH v1 0/2] stmmac: dwmac-meson8b: configurable RGMII TX delay In-Reply-To: References: <20161124143417.10178-1-martin.blumenstingl@googlemail.com> <1480002964.17538.131.camel@baylibre.com> Message-ID: <1480067629.17538.151.camel@baylibre.com> To: linus-amlogic@lists.infradead.org List-Id: linus-amlogic.lists.infradead.org On Thu, 2016-11-24 at 18:05 +0100, Martin Blumenstingl wrote: > On Thu, Nov 24, 2016 at 4:56 PM, Jerome Brunet > wrote: > > > > On Thu, 2016-11-24 at 15:34 +0100, Martin Blumenstingl wrote: > > > > > > Currently the dwmac-meson8b stmmac glue driver uses a hardcoded > > > 1/4 > > > cycle TX clock delay. This seems to work fine for many boards > > > (for > > > example Odroid-C2 or Amlogic's reference boards) but there are > > > some > > > others where TX traffic is simply broken. > > > There are probably multiple reasons why it's working on some > > > boards > > > while it's broken on others: > > > - some of Amlogic's reference boards are using a Micrel PHY > > > - hardware circuit design > > > - maybe more... > > > > > > This raises a question though: > > > Which device is supposed to enable the TX delay when both MAC and > > > PHY > > > support it? And should we implement it for each PHY / MAC > > > separately > > > or should we think about a more generic solution (currently it's > > > not > > > possible to disable the TX delay generated by the RTL8211F PHY > > > via > > > devicetree when using phy-mode "rgmii")? > > > > Actually you can skip the part which activate the Tx-delay on the > > phy > > by setting "phy-mode = "rgmii-id" instead of "rgmii" > > > > phy->interface will no longer be PHY_INTERFACE_MODE_RGMII > > but PHY_INTERFACE_MODE_RGMII_ID. > unfortunately this is not true for RTL8211F (I did my previous tests > with the same expectation in mind)! > the code seems to suggest that TX-delay is disabled whenever mode != > PHY_INTERFACE_MODE_RGMII. > BUT: on my device RTL8211F_TX_DELAY is set even before > "phy_write(phydev, 0x11, reg);"! Thx a lot for pointing this out. I wrongly assumed that is was off by default. It turns out it is ON on the OdroidC2 as well. So I re-did all my test: On the OdroidC2, as long as eee is not disabled (using ethtool or through my patch) I can't get iperf to work properly. Disabling EEE, the link works for the following configurations: PHY TX Delay bit set : MAC delay 0ns, 2ns. PHY TX Delay bit cleared : MAC delay 2ns, 4ns. This seems to confirm that the PHY adds a 2ns delay when the bit is set. I could not test on my MXQPRO2.1 ... the PHY is no longer found during the boot. Something died overnight :(? > > Based on what I found it seems that rgmii-id, rgmii-txid and > rgmii-rxid are supposed to be handled by the PHY. > That would mean that we have two problems here: > 1) drivers/net/phy/realtek.c:rtl8211f_config_init should check for > PHY_INTERFACE_MODE_RGMII_ID or PHY_INTERFACE_MODE_RGMII_TXID and > enable the TX-delay in that case - otherwise explicitly disable it > 2) dwmac-meson8b.c should only use the configured TX-delay for > PHY_INTERFACE_MODE_RGMII > @Florian: could you please share your thoughts on this (who handles > the TX delay in which case)? > > > Regards, > Martin From mboxrd@z Thu Jan 1 00:00:00 1970 From: jbrunet@baylibre.com (Jerome Brunet) Date: Fri, 25 Nov 2016 10:53:49 +0100 Subject: [net-next PATCH v1 0/2] stmmac: dwmac-meson8b: configurable RGMII TX delay In-Reply-To: References: <20161124143417.10178-1-martin.blumenstingl@googlemail.com> <1480002964.17538.131.camel@baylibre.com> Message-ID: <1480067629.17538.151.camel@baylibre.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Thu, 2016-11-24 at 18:05 +0100, Martin Blumenstingl wrote: > On Thu, Nov 24, 2016 at 4:56 PM, Jerome Brunet > wrote: > > > > On Thu, 2016-11-24 at 15:34 +0100, Martin Blumenstingl wrote: > > > > > > Currently the dwmac-meson8b stmmac glue driver uses a hardcoded > > > 1/4 > > > cycle TX clock delay. This seems to work fine for many boards > > > (for > > > example Odroid-C2 or Amlogic's reference boards) but there are > > > some > > > others where TX traffic is simply broken. > > > There are probably multiple reasons why it's working on some > > > boards > > > while it's broken on others: > > > - some of Amlogic's reference boards are using a Micrel PHY > > > - hardware circuit design > > > - maybe more... > > > > > > This raises a question though: > > > Which device is supposed to enable the TX delay when both MAC and > > > PHY > > > support it? And should we implement it for each PHY / MAC > > > separately > > > or should we think about a more generic solution (currently it's > > > not > > > possible to disable the TX delay generated by the RTL8211F PHY > > > via > > > devicetree when using phy-mode "rgmii")? > > > > Actually you can skip the part which activate the Tx-delay on the > > phy > > by setting "phy-mode = "rgmii-id" instead of "rgmii" > > > > phy->interface will no longer be PHY_INTERFACE_MODE_RGMII > > but PHY_INTERFACE_MODE_RGMII_ID. > unfortunately this is not true for RTL8211F (I did my previous tests > with the same expectation in mind)! > the code seems to suggest that TX-delay is disabled whenever mode != > PHY_INTERFACE_MODE_RGMII. > BUT: on my device RTL8211F_TX_DELAY is set even before > "phy_write(phydev, 0x11, reg);"! Thx a lot for pointing this out. I wrongly assumed that is was off by default. It turns out it is ON on the OdroidC2 as well. So I re-did all my test: On the OdroidC2, as long as eee is not disabled (using ethtool or through my patch) I can't get iperf to work properly. Disabling EEE, the link works for the following configurations: PHY TX Delay bit set : MAC delay 0ns, 2ns. PHY TX Delay bit cleared : MAC delay 2ns, 4ns. This seems to confirm that the PHY adds a 2ns delay when the bit is set. I could not test on my MXQPRO2.1 ... the PHY is no longer found during the boot. Something died overnight :(? > > Based on what I found it seems that rgmii-id, rgmii-txid and > rgmii-rxid are supposed to be handled by the PHY. > That would mean that we have two problems here: > 1) drivers/net/phy/realtek.c:rtl8211f_config_init should check for > PHY_INTERFACE_MODE_RGMII_ID or PHY_INTERFACE_MODE_RGMII_TXID and > enable the TX-delay in that case - otherwise explicitly disable it > 2) dwmac-meson8b.c should only use the configured TX-delay for > PHY_INTERFACE_MODE_RGMII > @Florian: could you please share your thoughts on this (who handles > the TX delay in which case)? > > > Regards, > Martin From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerome Brunet Subject: Re: [net-next PATCH v1 0/2] stmmac: dwmac-meson8b: configurable RGMII TX delay Date: Fri, 25 Nov 2016 10:53:49 +0100 Message-ID: <1480067629.17538.151.camel@baylibre.com> References: <20161124143417.10178-1-martin.blumenstingl@googlemail.com> <1480002964.17538.131.camel@baylibre.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Return-path: In-Reply-To: Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Martin Blumenstingl , f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Cc: linux-amlogic-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org, khilman-rdvid1DuHRBWk0Htik3J/w@public.gmane.org, mark.rutland-5wv7dgnIgG8@public.gmane.org, robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, alexandre.torgue-qxv4g6HH51o@public.gmane.org, peppe.cavallaro-qxv4g6HH51o@public.gmane.org, carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org List-Id: devicetree@vger.kernel.org On Thu, 2016-11-24 at 18:05 +0100, Martin Blumenstingl wrote: > On Thu, Nov 24, 2016 at 4:56 PM, Jerome Brunet > wrote: > > > > On Thu, 2016-11-24 at 15:34 +0100, Martin Blumenstingl wrote: > > > > > > Currently the dwmac-meson8b stmmac glue driver uses a hardcoded > > > 1/4 > > > cycle TX clock delay. This seems to work fine for many boards > > > (for > > > example Odroid-C2 or Amlogic's reference boards) but there are > > > some > > > others where TX traffic is simply broken. > > > There are probably multiple reasons why it's working on some > > > boards > > > while it's broken on others: > > > - some of Amlogic's reference boards are using a Micrel PHY > > > - hardware circuit design > > > - maybe more... > > > > > > This raises a question though: > > > Which device is supposed to enable the TX delay when both MAC and > > > PHY > > > support it? And should we implement it for each PHY / MAC > > > separately > > > or should we think about a more generic solution (currently it's > > > not > > > possible to disable the TX delay generated by the RTL8211F PHY > > > via > > > devicetree when using phy-mode "rgmii")? > > > > Actually you can skip the part which activate the Tx-delay on the > > phy > > by setting "phy-mode = "rgmii-id" instead of "rgmii" > > > > phy->interface will no longer be PHY_INTERFACE_MODE_RGMII > > but PHY_INTERFACE_MODE_RGMII_ID. > unfortunately this is not true for RTL8211F (I did my previous tests > with the same expectation in mind)! > the code seems to suggest that TX-delay is disabled whenever mode != > PHY_INTERFACE_MODE_RGMII. > BUT: on my device RTL8211F_TX_DELAY is set even before > "phy_write(phydev, 0x11, reg);"! Thx a lot for pointing this out. I wrongly assumed that is was off by default. It turns out it is ON on the OdroidC2 as well. So I re-did all my test: On the OdroidC2, as long as eee is not disabled (using ethtool or through my patch) I can't get iperf to work properly. Disabling EEE, the link works for the following configurations: PHY TX Delay bit set : MAC delay 0ns, 2ns. PHY TX Delay bit cleared : MAC delay 2ns, 4ns. This seems to confirm that the PHY adds a 2ns delay when the bit is set. I could not test on my MXQPRO2.1 ... the PHY is no longer found during the boot. Something died overnight :(  > > Based on what I found it seems that rgmii-id, rgmii-txid and > rgmii-rxid are supposed to be handled by the PHY. > That would mean that we have two problems here: > 1) drivers/net/phy/realtek.c:rtl8211f_config_init should check for > PHY_INTERFACE_MODE_RGMII_ID or PHY_INTERFACE_MODE_RGMII_TXID and > enable the TX-delay in that case - otherwise explicitly disable it > 2) dwmac-meson8b.c should only use the configured TX-delay for > PHY_INTERFACE_MODE_RGMII > @Florian: could you please share your thoughts on this (who handles > the TX delay in which case)? > > > Regards, > Martin -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html