From: Bruno Thomsen <firstname.lastname@example.org> To: netdev <email@example.com> Cc: Bruno Thomsen <firstname.lastname@example.org>, Andrew Lunn <email@example.com>, Fabio Estevam <firstname.lastname@example.org>, Florian Fainelli <email@example.com>, Russell King - ARM Linux <firstname.lastname@example.org>, Heiner Kallweit <email@example.com>, Lars Alex Pedersen <firstname.lastname@example.org>, Bruno Thomsen <email@example.com> Subject: [PATCH v2 0/4 net-next] Improve MDIO Ethernet PHY reset Date: Thu, 30 Jul 2020 21:57:45 +0200 [thread overview] Message-ID: <firstname.lastname@example.org> (raw) This patch series is a result of trying to upstream a new device tree for a TQMa7D based board. Initial this DTS used some deprecated PHY reset properties on the FEC device; NXP Ethernet MAC also known as Freescale Fast Ethernet Controller. When switching from FEC properties: "phy-reset-gpios" "phy-reset-duration" "phy-reset-post-delay" To MDIO PHY properties: "reset-gpios" "reset-assert-us" "reset-deassert-us" The result was that no Ethernet PHY device was detected on boot. This issue could be worked around by disabling PHY type ID auto- detection by using "ethernet-phy-id0022.1560" as compatible string and not "ethernet-phy-ieee802.3-c22". Upstreaming a DTS with this workaround was not accepted, so I digged into the MDIO reset flow and found that it had a few missing parts compared to the deprecated FEC reset function. After some more testing and logic analyzer traces it was revealed that the failed PHY communication was due to missing initial device reset. I was suggested in a earlier mail thread to use MDIO bus reset as that was performed before auto-detection, but current device tree binding was limited to reset assert in usec. Microchip/Micrel Ethernet PHYs recommended reset circuit, figure 7-12, is a little "slow" after reset deassert as that is left to a RC circuit with a tau of ~100ms; using a 10k PU resistor together with a 10uF decoupling capacitor. The diode in serie of the reset signal converts the GPIO push-pull output into a open-drain output. So a post reset delay in the range of 500-1000ms is needed, depending on component tolerances and general hardware design margins. In the first version of this patch series I reused the "reset-delay-us" property for reset deassert in usec as that would cause 50/50% duty-cycle, but that would always apply. The solution in this patch series is to add a new MDIO bus property, so post reset delay is optional and configured separately. MDIO bus properties: "reset-delay-us" "reset-post-delay-us" (new) I have not marked this with "Fixes:" as no single commit is the cause and historically this code has only supported MDIO devices that need reset after auto-detection. The patch series also uses a new flexible sleep helper function that was introduced in 5.8-rc1, so the driver uses the optimal sleep function depending on value loaded from device tree. Future work in this area could add new properties on the MDIO device, so reset points are configurable, e.g. no reset, before/after auto-detection or both.  https://email@example.com/  https://firstname.lastname@example.org/  https://elixir.bootlin.com/linux/v5.7.8/source/Documentation/devicetree/bindings/net/fsl-fec.txt#L44  https://elixir.bootlin.com/linux/v5.8-rc4/source/Documentation/devicetree/bindings/net/mdio.yaml#L78  https://lore.kernel.org/netdev/CAOMZO5DtYDomD8FDCZDwYCSr2AwNT81Ay4==aDxXyBxtyvPiJA@mail.gmail.com/  https://email@example.com/  https://elixir.bootlin.com/linux/v5.8-rc4/source/Documentation/devicetree/bindings/net/mdio.yaml#L36  http://ww1.microchip.com/downloads/en/DeviceDoc/00002202C.pdf Bruno Thomsen (4): dt-bindings: net: mdio: add reset-post-delay-us property net: mdiobus: use flexible sleeping for reset-delay-us net: mdiobus: add reset-post-delay-us handling net: mdio device: use flexible sleeping in reset function Documentation/devicetree/bindings/net/mdio.yaml | 7 +++++++ drivers/net/phy/mdio_bus.c | 4 +++- drivers/net/phy/mdio_device.c | 2 +- drivers/of/of_mdio.c | 2 ++ include/linux/phy.h | 2 ++ 5 files changed, 15 insertions(+), 2 deletions(-) base-commit: 490ed0b908d371cd9ab63fc142213e5d02d810ee -- 2.26.2
next reply other threads:[~2020-07-30 19:58 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-07-30 19:57 Bruno Thomsen [this message] 2020-07-30 19:57 ` [PATCH v2 1/4 net-next] dt-bindings: net: mdio: add reset-post-delay-us property Bruno Thomsen 2020-08-02 16:46 ` Andrew Lunn 2020-08-02 20:16 ` Florian Fainelli 2020-07-30 19:57 ` [PATCH v2 2/4 net-next] net: mdiobus: use flexible sleeping for reset-delay-us Bruno Thomsen 2020-08-02 16:46 ` Andrew Lunn 2020-08-02 20:17 ` Florian Fainelli 2020-07-30 19:57 ` [PATCH v2 3/4 net-next] net: mdiobus: add reset-post-delay-us handling Bruno Thomsen 2020-08-02 16:47 ` Andrew Lunn 2020-08-02 20:18 ` Florian Fainelli 2020-07-30 19:57 ` [PATCH v2 4/4 net-next] net: mdio device: use flexible sleeping in reset function Bruno Thomsen 2020-08-02 16:48 ` Andrew Lunn 2020-08-02 20:19 ` Florian Fainelli 2020-08-03 22:01 ` [PATCH v2 0/4 net-next] Improve MDIO Ethernet PHY reset David Miller
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 \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --subject='Re: [PATCH v2 0/4 net-next] Improve MDIO Ethernet PHY reset' \ /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
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.