* [PATCH 0/2] net: phy: realtek: fix RTL8211F TX-delay handling @ 2016-11-25 13:11 Martin Blumenstingl [not found] ` <20161125131201.19994-1-martin.blumenstingl-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> 2016-11-25 13:12 ` [PATCH 2/2] net: phy: realtek: fix enabling of the TX-delay for RTL8211F Martin Blumenstingl 0 siblings, 2 replies; 6+ messages in thread From: Martin Blumenstingl @ 2016-11-25 13:11 UTC (permalink / raw) To: f.fainelli-Re5JQEeQqe8AvxtiuMwx3w, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8, davem-fT/PcQaiUtIeIZ0/mPfg9Q, sean.wang-NuS5LvNUpcJWk0Htik3J/w, netdev-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA Cc: linux-amlogic-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, jbrunet-rdvid1DuHRBWk0Htik3J/w, Martin Blumenstingl The RTL8211F PHY driver currently enables the TX-delay only when the phy-mode is PHY_INTERFACE_MODE_RGMII. This is incorrect, because there are three RGMII variations of the phy-mode which explicitly request the PHY to enable the RX and/or TX delay, while PHY_INTERFACE_MODE_RGMII specifies that the PHY should disable the RX and/or TX delays. Additionally to the RTL8211F PHY driver change this contains a small update to the phy-mode documentation to clarify the purpose of the RGMII phy-modes. While this may not be perfect yet it's at least a start. Please feel free to drop this patch from this series and send an improved version yourself. These patches are the results of recent discussions, see [0] [0] http://lists.infradead.org/pipermail/linux-amlogic/2016-November/001688.html Martin Blumenstingl (2): Documentation: devicetree: clarify usage of the RGMII phy-modes net: phy: realtek: fix enabling of the TX-delay for RTL8211F Documentation/devicetree/bindings/net/ethernet.txt | 24 ++++++++++++++++++---- drivers/net/phy/realtek.c | 20 ++++++++++-------- 2 files changed, 32 insertions(+), 12 deletions(-) -- 2.10.2 -- 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <20161125131201.19994-1-martin.blumenstingl-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>]
* [PATCH 1/2] Documentation: devicetree: clarify usage of the RGMII phy-modes [not found] ` <20161125131201.19994-1-martin.blumenstingl-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> @ 2016-11-25 13:12 ` Martin Blumenstingl [not found] ` <20161125131201.19994-2-martin.blumenstingl-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> 2016-11-28 17:07 ` [PATCH 0/2] net: phy: realtek: fix RTL8211F TX-delay handling David Miller 1 sibling, 1 reply; 6+ messages in thread From: Martin Blumenstingl @ 2016-11-25 13:12 UTC (permalink / raw) To: f.fainelli-Re5JQEeQqe8AvxtiuMwx3w, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8, davem-fT/PcQaiUtIeIZ0/mPfg9Q, sean.wang-NuS5LvNUpcJWk0Htik3J/w, netdev-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA Cc: linux-amlogic-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, jbrunet-rdvid1DuHRBWk0Htik3J/w, Martin Blumenstingl RGMII requires special RX and/or TX delays depending on the actual hardware circuit/wiring. These delays can be added by the MAC, the PHY or the designer of the circuit (the latter means that no delay has to be added by PHY or MAC). There are 4 RGMII phy-modes used describe where a delay should be applied: - rgmii: the RX and TX delays are either added by the MAC (where the exact delay is typically configurable, and can be turned off when no extra delay is needed) or not needed at all (because the hardware wiring adds the delay already). The PHY should neither add the RX nor TX delay in this case. - rgmii-rxid: configures the PHY to enable the RX delay. The MAC should not add the RX delay in this case. - rgmii-txid: configures the PHY to enable the TX delay. The MAC should not add the TX delay in this case. - rgmii-id: combines rgmii-rxid and rgmii-txid and thus configures the PHY to enable the RX and TX delays. The MAC should neither add the RX nor TX delay in this case. Document these cases in the ethernet.txt documentation to make it clear when to use each mode. If applied incorrectly one might end up with MAC and PHY both enabling for example the TX delay, which breaks ethernet TX traffic on 1000Mbit/s links. Signed-off-by: Martin Blumenstingl <martin.blumenstingl-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> --- Documentation/devicetree/bindings/net/ethernet.txt | 24 ++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/net/ethernet.txt b/Documentation/devicetree/bindings/net/ethernet.txt index e1d7681..0515095 100644 --- a/Documentation/devicetree/bindings/net/ethernet.txt +++ b/Documentation/devicetree/bindings/net/ethernet.txt @@ -9,10 +9,26 @@ The following properties are common to the Ethernet controllers: - max-speed: number, specifies maximum speed in Mbit/s supported by the device; - max-frame-size: number, maximum transfer unit (IEEE defined MTU), rather than the maximum frame size (there's contradiction in ePAPR). -- phy-mode: string, operation mode of the PHY interface; supported values are - "mii", "gmii", "sgmii", "qsgmii", "tbi", "rev-mii", "rmii", "rgmii", "rgmii-id", - "rgmii-rxid", "rgmii-txid", "rtbi", "smii", "xgmii", "trgmii"; this is now a - de-facto standard property; +- phy-mode: string, operation mode of the PHY interface. This is now a de-facto + standard property; supported values are: + * "mii" + * "gmii" + * "sgmii" + * "qsgmii" + * "tbi" + * "rev-mii" + * "rmii" + * "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) + * "rtbi" + * "smii" + * "xgmii" + * "trgmii" - phy-connection-type: the same as "phy-mode" property but described in ePAPR; - phy-handle: phandle, specifies a reference to a node representing a PHY device; this property is described in ePAPR and so preferred; -- 2.10.2 -- 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 ^ permalink raw reply related [flat|nested] 6+ messages in thread
[parent not found: <20161125131201.19994-2-martin.blumenstingl-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH 1/2] Documentation: devicetree: clarify usage of the RGMII phy-modes [not found] ` <20161125131201.19994-2-martin.blumenstingl-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> @ 2016-11-27 5:53 ` Florian Fainelli 0 siblings, 0 replies; 6+ messages in thread From: Florian Fainelli @ 2016-11-27 5:53 UTC (permalink / raw) To: Martin Blumenstingl, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8, davem-fT/PcQaiUtIeIZ0/mPfg9Q, sean.wang-NuS5LvNUpcJWk0Htik3J/w, netdev-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA Cc: linux-amlogic-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, jbrunet-rdvid1DuHRBWk0Htik3J/w On 11/25/2016 05:12 AM, Martin Blumenstingl wrote: > RGMII requires special RX and/or TX delays depending on the actual > hardware circuit/wiring. These delays can be added by the MAC, the PHY > or the designer of the circuit (the latter means that no delay has to > be added by PHY or MAC). > There are 4 RGMII phy-modes used describe where a delay should be > applied: > - rgmii: the RX and TX delays are either added by the MAC (where the > exact delay is typically configurable, and can be turned off when no > extra delay is needed) or not needed at all (because the hardware > wiring adds the delay already). The PHY should neither add the RX nor > TX delay in this case. > - rgmii-rxid: configures the PHY to enable the RX delay. The MAC should > not add the RX delay in this case. > - rgmii-txid: configures the PHY to enable the TX delay. The MAC should > not add the TX delay in this case. > - rgmii-id: combines rgmii-rxid and rgmii-txid and thus configures the > PHY to enable the RX and TX delays. The MAC should neither add the RX > nor TX delay in this case. > > Document these cases in the ethernet.txt documentation to make it clear > when to use each mode. > If applied incorrectly one might end up with MAC and PHY both enabling > for example the TX delay, which breaks ethernet TX traffic on 1000Mbit/s > links. > > Signed-off-by: Martin Blumenstingl <martin.blumenstingl-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> Reviewed-by: Florian Fainelli <f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> -- Florian -- 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] net: phy: realtek: fix RTL8211F TX-delay handling [not found] ` <20161125131201.19994-1-martin.blumenstingl-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> 2016-11-25 13:12 ` [PATCH 1/2] Documentation: devicetree: clarify usage of the RGMII phy-modes Martin Blumenstingl @ 2016-11-28 17:07 ` David Miller 1 sibling, 0 replies; 6+ messages in thread From: David Miller @ 2016-11-28 17:07 UTC (permalink / raw) To: martin.blumenstingl-gM/Ye1E23mwN+BqQ9rBEUg Cc: f.fainelli-Re5JQEeQqe8AvxtiuMwx3w, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8, sean.wang-NuS5LvNUpcJWk0Htik3J/w, netdev-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-amlogic-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, jbrunet-rdvid1DuHRBWk0Htik3J/w From: Martin Blumenstingl <martin.blumenstingl-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> Date: Fri, 25 Nov 2016 14:11:59 +0100 > The RTL8211F PHY driver currently enables the TX-delay only when the > phy-mode is PHY_INTERFACE_MODE_RGMII. This is incorrect, because there > are three RGMII variations of the phy-mode which explicitly request the > PHY to enable the RX and/or TX delay, while PHY_INTERFACE_MODE_RGMII > specifies that the PHY should disable the RX and/or TX delays. > > Additionally to the RTL8211F PHY driver change this contains a small > update to the phy-mode documentation to clarify the purpose of the > RGMII phy-modes. > While this may not be perfect yet it's at least a start. Please feel > free to drop this patch from this series and send an improved version > yourself. > > These patches are the results of recent discussions, see [0] > > [0] http://lists.infradead.org/pipermail/linux-amlogic/2016-November/001688.html Series applied, thanks 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] net: phy: realtek: fix enabling of the TX-delay for RTL8211F 2016-11-25 13:11 [PATCH 0/2] net: phy: realtek: fix RTL8211F TX-delay handling Martin Blumenstingl [not found] ` <20161125131201.19994-1-martin.blumenstingl-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> @ 2016-11-25 13:12 ` Martin Blumenstingl [not found] ` <20161125131201.19994-3-martin.blumenstingl-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> 1 sibling, 1 reply; 6+ messages in thread From: Martin Blumenstingl @ 2016-11-25 13:12 UTC (permalink / raw) To: f.fainelli, robh+dt, mark.rutland, davem, sean.wang, netdev, devicetree Cc: linux-amlogic, jbrunet, Martin Blumenstingl The old logic always enabled the TX-delay when the phy-mode was set to PHY_INTERFACE_MODE_RGMII. There are dedicated phy-modes which tell the PHY driver to enable the RX and/or TX delays: - PHY_INTERFACE_MODE_RGMII should disable the RX and TX delay in the PHY (if required, the MAC should add the delays in this case) - PHY_INTERFACE_MODE_RGMII_ID should enable RX and TX delay in the PHY - PHY_INTERFACE_MODE_RGMII_TXID should enable the TX delay in the PHY - PHY_INTERFACE_MODE_RGMII_RXID should enable the RX delay in the PHY (currently not supported by RTL8211F) With this patch we enable the TX delay for PHY_INTERFACE_MODE_RGMII_ID and PHY_INTERFACE_MODE_RGMII_TXID. Additionally we now explicity disable the TX-delay, which seems to be enabled automatically after a hard-reset of the PHY (by triggering it's reset pin) to get a consistent state (as defined by the phy-mode). This fixes a compatibility problem with some SoCs where the TX-delay was also added by the MAC. With the TX-delay being applied twice the TX clock was off and TX traffic was broken or very slow (<10Mbit/s) on 1000Mbit/s links. Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> --- drivers/net/phy/realtek.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index aadd6e9..9cbe645 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -102,15 +102,19 @@ static int rtl8211f_config_init(struct phy_device *phydev) if (ret < 0) return ret; - if (phydev->interface == PHY_INTERFACE_MODE_RGMII) { - /* enable TXDLY */ - phy_write(phydev, RTL8211F_PAGE_SELECT, 0xd08); - reg = phy_read(phydev, 0x11); + phy_write(phydev, RTL8211F_PAGE_SELECT, 0xd08); + reg = phy_read(phydev, 0x11); + + /* enable TX-delay for rgmii-id and rgmii-txid, otherwise disable it */ + if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || + phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) reg |= RTL8211F_TX_DELAY; - phy_write(phydev, 0x11, reg); - /* restore to default page 0 */ - phy_write(phydev, RTL8211F_PAGE_SELECT, 0x0); - } + else + reg &= ~RTL8211F_TX_DELAY; + + phy_write(phydev, 0x11, reg); + /* restore to default page 0 */ + phy_write(phydev, RTL8211F_PAGE_SELECT, 0x0); return 0; } -- 2.10.2 ^ permalink raw reply related [flat|nested] 6+ messages in thread
[parent not found: <20161125131201.19994-3-martin.blumenstingl-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH 2/2] net: phy: realtek: fix enabling of the TX-delay for RTL8211F [not found] ` <20161125131201.19994-3-martin.blumenstingl-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> @ 2016-11-27 5:55 ` Florian Fainelli 0 siblings, 0 replies; 6+ messages in thread From: Florian Fainelli @ 2016-11-27 5:55 UTC (permalink / raw) To: Martin Blumenstingl, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8, davem-fT/PcQaiUtIeIZ0/mPfg9Q, sean.wang-NuS5LvNUpcJWk0Htik3J/w, netdev-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA Cc: linux-amlogic-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, jbrunet-rdvid1DuHRBWk0Htik3J/w On 11/25/2016 05:12 AM, Martin Blumenstingl wrote: > The old logic always enabled the TX-delay when the phy-mode was set to > PHY_INTERFACE_MODE_RGMII. There are dedicated phy-modes which tell the > PHY driver to enable the RX and/or TX delays: > - PHY_INTERFACE_MODE_RGMII should disable the RX and TX delay in the > PHY (if required, the MAC should add the delays in this case) > - PHY_INTERFACE_MODE_RGMII_ID should enable RX and TX delay in the PHY > - PHY_INTERFACE_MODE_RGMII_TXID should enable the TX delay in the PHY > - PHY_INTERFACE_MODE_RGMII_RXID should enable the RX delay in the PHY > (currently not supported by RTL8211F) > > With this patch we enable the TX delay for PHY_INTERFACE_MODE_RGMII_ID > and PHY_INTERFACE_MODE_RGMII_TXID. > Additionally we now explicity disable the TX-delay, which seems to be > enabled automatically after a hard-reset of the PHY (by triggering it's > reset pin) to get a consistent state (as defined by the phy-mode). > > This fixes a compatibility problem with some SoCs where the TX-delay was > also added by the MAC. With the TX-delay being applied twice the TX > clock was off and TX traffic was broken or very slow (<10Mbit/s) on > 1000Mbit/s links. > > Signed-off-by: Martin Blumenstingl <martin.blumenstingl-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> Reviewed-by: Florian Fainelli <f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> -- Florian -- 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-11-28 17:07 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-11-25 13:11 [PATCH 0/2] net: phy: realtek: fix RTL8211F TX-delay handling Martin Blumenstingl [not found] ` <20161125131201.19994-1-martin.blumenstingl-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> 2016-11-25 13:12 ` [PATCH 1/2] Documentation: devicetree: clarify usage of the RGMII phy-modes Martin Blumenstingl [not found] ` <20161125131201.19994-2-martin.blumenstingl-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> 2016-11-27 5:53 ` Florian Fainelli 2016-11-28 17:07 ` [PATCH 0/2] net: phy: realtek: fix RTL8211F TX-delay handling David Miller 2016-11-25 13:12 ` [PATCH 2/2] net: phy: realtek: fix enabling of the TX-delay for RTL8211F Martin Blumenstingl [not found] ` <20161125131201.19994-3-martin.blumenstingl-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> 2016-11-27 5:55 ` Florian Fainelli
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).