From: Richard Leitner <hidden> Date: 2017-12-11 12:17:31
From: Richard Leitner <redacted>
This patch series fixes the use of the SMSC LAN8710/20 with a Freescale ETH
when the refclk is generated by the FSL.
This patchset depends on the "phylib: Add device reset GPIO support" patch
submitted by Geert Uytterhoeven/Sergei Shtylyov, which was merged to
net-next as commit bafbdd527d56 ("phylib: Add device reset GPIO support").
Changes v5:
- fix reset delay calculation (max_t instead of min_t)
Changes v4:
- simplify dts parsing
- simplify reset delay evaluation and execution
- fec: ensure to only reset once during fec_enet_open()
- remove dependency notes from commit message
- add reviews and acks
Changes v3:
- use phylib to hard-reset the PHY
- implement reset delays in phylib
- add new phylib API & flag (PHY_RST_AFTER_CLK_EN) to determine if
a PHY is affected
Changes v2:
- simplify and fix fec_reset_phy function to support multiple calls
- include: linux: phy: harmonize phy_id{,_mask} type
- reset the phy instead of not turning the clock on and off
(which would have caused a power consumption regression)
Richard Leitner (4):
phylib: Add device reset delay support
phylib: add reset after clk enable support
net: phy: smsc: LAN8710/20: add PHY_RST_AFTER_CLK_EN flag
net: fec: add phy_reset_after_clk_enable() support
Documentation/devicetree/bindings/net/phy.txt | 10 ++++++++++
drivers/net/ethernet/freescale/fec_main.c | 20 ++++++++++++++++++++
drivers/net/phy/mdio_device.c | 13 +++++++++++--
drivers/net/phy/phy_device.c | 24 ++++++++++++++++++++++++
drivers/net/phy/smsc.c | 2 +-
drivers/of/of_mdio.c | 4 ++++
include/linux/mdio.h | 2 ++
include/linux/phy.h | 2 ++
8 files changed, 74 insertions(+), 3 deletions(-)
--
2.11.0
--
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
From: Richard Leitner <hidden> Date: 2017-12-11 12:17:35
From: Richard Leitner <richard.leitner@skidata.com>
Some PHYs need a minimum time after the reset gpio was asserted and/or
deasserted. To ensure we meet these timing requirements add two new
optional devicetree parameters for the phy: reset-delay-us and
reset-post-delay-us.
Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Documentation/devicetree/bindings/net/phy.txt | 10 ++++++++++
drivers/net/phy/mdio_device.c | 13 +++++++++++--
drivers/of/of_mdio.c | 4 ++++
include/linux/mdio.h | 2 ++
4 files changed, 27 insertions(+), 2 deletions(-)
@@ -55,6 +55,12 @@ Optional Properties: - reset-gpios: The GPIO phandle and specifier for the PHY reset signal.+- reset-delay-us: Delay after the reset was asserted in microseconds.+ If this property is missing the delay will be skipped.++- reset-post-delay-us: Delay after the reset was deasserted in microseconds.+ If this property is missing the delay will be skipped.+ Example: ethernet-phy@0 {
@@ -77,6 +77,10 @@ static int of_mdiobus_register_phy(struct mii_bus *mdio,if(of_property_read_bool(child,"broken-turn-around"))mdio->phy_ignore_ta_mask|=1<<addr;+of_property_read_u32(child,"reset-delay-us",&phy->mdio.reset_delay);+of_property_read_u32(child,"reset-post-delay-us",+&phy->mdio.reset_post_delay);+/* Associate the OF node with the device structure so it*canbelookeduplater*/of_node_get(child);
From: Richard Leitner <hidden> Date: 2017-12-11 12:17:41
From: Richard Leitner <richard.leitner@skidata.com>
Some PHYs (for example the SMSC LAN8710/LAN8720) doesn't allow turning
the refclk on and off again during operation (according to their
datasheet). Nonetheless exactly this behaviour was introduced for power
saving reasons by commit e8fcfcd5684a ("net: fec: optimize the clock management to save power").
Therefore add support for the phy_reset_after_clk_enable function from
phylib to mitigate this issue.
Generally speaking this issue is only relevant if the ref clk for the
PHY is generated by the SoC and therefore the PHY is configured to
"REF_CLK In Mode". In our specific case (PCB) this problem does occur at
about every 10th to 50th POR of an LAN8710 connected to an i.MX6SOLO
SoC. The typical symptom of this problem is a "swinging" ethernet link.
Similar issues were reported by users of the NXP forum:
https://community.nxp.com/thread/389902https://community.nxp.com/message/309354
With this patch applied the issue didn't occur for at least a few
hundret PORs of our board.
Fixes: e8fcfcd5684a ("net: fec: optimize the clock management to save power")
Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
---
drivers/net/ethernet/freescale/fec_main.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
@@ -2844,6 +2847,17 @@ fec_enet_open(struct net_device *ndev)if(ret)gotoclk_enable;+/* During the first fec_enet_open call the PHY isn't probed at this+*point.Thereforethephy_reset_after_clk_enable()callwithin+*fec_enet_clk_enable()fails.Asweneedthisresetinordertobe+*surethePHYisworkingcorrectlywecheckifweneedtoresetagain+*laterwhenthePHYisprobed+*/+if(ndev->phydev&&ndev->phydev->drv)+reset_again=false;+else+reset_again=true;+/* I should reset the ring buffers here, but I don't yet know*asimplewaytodothat.*/
@@ -2860,6 +2874,12 @@ fec_enet_open(struct net_device *ndev)if(ret)gotoerr_enet_mii_probe;+/* Call phy_reset_after_clk_enable() again if it failed during+*phy_reset_after_clk_enable()beforebecausethePHYwasn'tprobed.+*/+if(reset_again)+phy_reset_after_clk_enable(ndev->phydev);+if(fep->quirks&FEC_QUIRK_ERR006687)imx6q_cpuidle_fec_irqs_used();
From: Richard Leitner <hidden> Date: 2017-12-11 12:17:44
From: Richard Leitner <richard.leitner@skidata.com>
The Microchip/SMSC LAN8710/LAN8720 PHYs need (according to their
datasheet [1]) a continuous REF_CLK when configured to "REF_CLK In Mode".
Therefore set the PHY_RST_AFTER_CLK_EN flag for those PHYs to let the
ETH driver reset them after the REF_CLK is enabled.
[1] http://ww1.microchip.com/downloads/en/DeviceDoc/00002165B.pdf
Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
drivers/net/phy/smsc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Richard Leitner <hidden> Date: 2017-12-11 12:18:40
From: Richard Leitner <richard.leitner@skidata.com>
Some PHYs need the refclk to be a continuous clock. Therefore they don't
allow turning it off and on again during operation. Nonetheless such a
clock switching is performed by some ETH drivers (namely FEC [1]) for
power saving reasons. An example for an affected PHY is the
SMSC/Microchip LAN8720 in "REF_CLK In Mode".
In order to provide a uniform method to overcome this problem this patch
adds a new phy_driver flag (PHY_RST_AFTER_CLK_EN) and corresponding
function phy_reset_after_clk_enable() to the phylib. These should be
used to trigger reset of the PHY after the refclk is switched on again.
[1] commit e8fcfcd5684a ("net: fec: optimize the clock management to save power")
Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
drivers/net/phy/phy_device.c | 24 ++++++++++++++++++++++++
include/linux/phy.h | 2 ++
2 files changed, 26 insertions(+)
From: Andrew Lunn <andrew@lunn.ch> Date: 2017-12-11 13:40:59
On Mon, Dec 11, 2017 at 01:16:57PM +0100, Richard Leitner wrote:
From: Richard Leitner <richard.leitner@skidata.com>
Some PHYs need a minimum time after the reset gpio was asserted and/or
deasserted. To ensure we meet these timing requirements add two new
optional devicetree parameters for the phy: reset-delay-us and
reset-post-delay-us.
Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
From: Andy Duan <hidden> Date: 2017-12-13 02:22:11
From: Richard Leitner <dev-M/VWbR8SM2SsTnJN9+BGXg@public.gmane.org> Sent: Monday, December 11, 2017 8:17 PM
This patch series fixes the use of the SMSC LAN8710/20 with a Freescale ETH
when the refclk is generated by the FSL.
This patchset depends on the "phylib: Add device reset GPIO support" patch
submitted by Geert Uytterhoeven/Sergei Shtylyov, which was merged to net-
next as commit bafbdd527d56 ("phylib: Add device reset GPIO support").
Changes v5:
- fix reset delay calculation (max_t instead of min_t)
Changes v4:
- simplify dts parsing
- simplify reset delay evaluation and execution
- fec: ensure to only reset once during fec_enet_open()
- remove dependency notes from commit message
- add reviews and acks
Changes v3:
- use phylib to hard-reset the PHY
- implement reset delays in phylib
- add new phylib API & flag (PHY_RST_AFTER_CLK_EN) to determine if
a PHY is affected
Changes v2:
- simplify and fix fec_reset_phy function to support multiple calls
- include: linux: phy: harmonize phy_id{,_mask} type
- reset the phy instead of not turning the clock on and off
(which would have caused a power consumption regression)
Richard Leitner (4):
phylib: Add device reset delay support
phylib: add reset after clk enable support
net: phy: smsc: LAN8710/20: add PHY_RST_AFTER_CLK_EN flag
net: fec: add phy_reset_after_clk_enable() support
Documentation/devicetree/bindings/net/phy.txt | 10 ++++++++++
drivers/net/ethernet/freescale/fec_main.c | 20 ++++++++++++++++++++
drivers/net/phy/mdio_device.c | 13 +++++++++++--
drivers/net/phy/phy_device.c | 24 ++++++++++++++++++++++++
drivers/net/phy/smsc.c | 2 +-
drivers/of/of_mdio.c | 4 ++++
include/linux/mdio.h | 2 ++
include/linux/phy.h | 2 ++
8 files changed, 74 insertions(+), 3 deletions(-)
--
2.11.0
The series look fine better. Thanks.
Acked-by: Fugang Duan <redacted>
--
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
From: David Miller <davem@davemloft.net> Date: 2017-12-13 16:23:27
From: Richard Leitner <redacted>
Date: Mon, 11 Dec 2017 13:16:56 +0100
From: Richard Leitner <richard.leitner@skidata.com>
This patch series fixes the use of the SMSC LAN8710/20 with a Freescale ETH
when the refclk is generated by the FSL.
This patchset depends on the "phylib: Add device reset GPIO support" patch
submitted by Geert Uytterhoeven/Sergei Shtylyov, which was merged to
net-next as commit bafbdd527d56 ("phylib: Add device reset GPIO support").
Changes v5:
- fix reset delay calculation (max_t instead of min_t)
Changes v4:
- simplify dts parsing
- simplify reset delay evaluation and execution
- fec: ensure to only reset once during fec_enet_open()
- remove dependency notes from commit message
- add reviews and acks
Changes v3:
- use phylib to hard-reset the PHY
- implement reset delays in phylib
- add new phylib API & flag (PHY_RST_AFTER_CLK_EN) to determine if
a PHY is affected
Changes v2:
- simplify and fix fec_reset_phy function to support multiple calls
- include: linux: phy: harmonize phy_id{,_mask} type
- reset the phy instead of not turning the clock on and off
(which would have caused a power consumption regression)
From: Rob Herring <robh@kernel.org> Date: 2017-12-15 22:18:02
On Mon, Dec 11, 2017 at 01:16:57PM +0100, Richard Leitner wrote:
quoted hunk
From: Richard Leitner <richard.leitner@skidata.com>
Some PHYs need a minimum time after the reset gpio was asserted and/or
deasserted. To ensure we meet these timing requirements add two new
optional devicetree parameters for the phy: reset-delay-us and
reset-post-delay-us.
Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Documentation/devicetree/bindings/net/phy.txt | 10 ++++++++++
drivers/net/phy/mdio_device.c | 13 +++++++++++--
drivers/of/of_mdio.c | 4 ++++
include/linux/mdio.h | 2 ++
4 files changed, 27 insertions(+), 2 deletions(-)
@@ -55,6 +55,12 @@ Optional Properties: - reset-gpios: The GPIO phandle and specifier for the PHY reset signal.+- reset-delay-us: Delay after the reset was asserted in microseconds.+ If this property is missing the delay will be skipped.++- reset-post-delay-us: Delay after the reset was deasserted in microseconds.+ If this property is missing the delay will be skipped.
I think these names could be clearer as to exactly what they mean.
Looking at existing properties with "reset-delay" there's a mixture of
definitions whether it is the assert time or the time after deassert.
So I'd call these "reset-assert-us" and "reset-deassert-us".
Rob
From: Richard Leitner <richard.leitner@skidata.com> Date: 2017-12-18 07:40:51
Hi Rob,
On 12/15/2017 11:17 PM, Rob Herring wrote:
On Mon, Dec 11, 2017 at 01:16:57PM +0100, Richard Leitner wrote:
quoted
From: Richard Leitner <redacted>
Some PHYs need a minimum time after the reset gpio was asserted and/or
deasserted. To ensure we meet these timing requirements add two new
optional devicetree parameters for the phy: reset-delay-us and
reset-post-delay-us.
Signed-off-by: Richard Leitner <redacted>
Reviewed-by: Geert Uytterhoeven <redacted>
---
Documentation/devicetree/bindings/net/phy.txt | 10 ++++++++++
drivers/net/phy/mdio_device.c | 13 +++++++++++--
drivers/of/of_mdio.c | 4 ++++
include/linux/mdio.h | 2 ++
4 files changed, 27 insertions(+), 2 deletions(-)
@@ -55,6 +55,12 @@ Optional Properties: - reset-gpios: The GPIO phandle and specifier for the PHY reset signal.+- reset-delay-us: Delay after the reset was asserted in microseconds.+ If this property is missing the delay will be skipped.++- reset-post-delay-us: Delay after the reset was deasserted in microseconds.+ If this property is missing the delay will be skipped.
I think these names could be clearer as to exactly what they mean.
Looking at existing properties with "reset-delay" there's a mixture of
definitions whether it is the assert time or the time after deassert.
So I'd call these "reset-assert-us" and "reset-deassert-us".
Ok, that would be fine with me, but are you sure that we should omit the
"-delay" term completely?
What would be the best approach to post this change (as the patchset was
already merged to net-next)? A separate patch or a v6 of the complete
patchset?
Rob
regards;Richard.L
--
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
From: Rob Herring <robh@kernel.org> Date: 2017-12-19 17:12:39
On Mon, Dec 18, 2017 at 1:30 AM, Richard Leitner
[off-list ref] wrote:
Hi Rob,
On 12/15/2017 11:17 PM, Rob Herring wrote:
quoted
On Mon, Dec 11, 2017 at 01:16:57PM +0100, Richard Leitner wrote:
quoted
From: Richard Leitner <redacted>
Some PHYs need a minimum time after the reset gpio was asserted and/or
deasserted. To ensure we meet these timing requirements add two new
optional devicetree parameters for the phy: reset-delay-us and
reset-post-delay-us.
Signed-off-by: Richard Leitner <redacted>
Reviewed-by: Geert Uytterhoeven <redacted>
---
Documentation/devicetree/bindings/net/phy.txt | 10 ++++++++++
drivers/net/phy/mdio_device.c | 13 +++++++++++--
drivers/of/of_mdio.c | 4 ++++
include/linux/mdio.h | 2 ++
4 files changed, 27 insertions(+), 2 deletions(-)
@@ -55,6 +55,12 @@ Optional Properties: - reset-gpios: The GPIO phandle and specifier for the PHY reset signal.+- reset-delay-us: Delay after the reset was asserted in microseconds.+ If this property is missing the delay will be skipped.++- reset-post-delay-us: Delay after the reset was deasserted in microseconds.+ If this property is missing the delay will be skipped.
I think these names could be clearer as to exactly what they mean.
Looking at existing properties with "reset-delay" there's a mixture of
definitions whether it is the assert time or the time after deassert.
So I'd call these "reset-assert-us" and "reset-deassert-us".
Ok, that would be fine with me, but are you sure that we should omit the
"-delay" term completely?
These are just minimum assertion and deassertion times. I think that's
clear enough.
What would be the best approach to post this change (as the patchset was
already merged to net-next)? A separate patch or a v6 of the complete
patchset?
A patch on top of this.
Rob
--
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