ARM: imx6ul-14x14-evk: Fix suspend over nfs by phy
Subsystems (5)
v2 cover ARM: imx6ul-14x14-evk: Fix suspend over nfs by phy
Right now attempting doing suspend/resume while root is mounted over NFS hangs on imx6ul-14x14-evk. This is happening because ksz8081 phy fixups are lost on resume.
Fix this by using equivalent devicetree properties instead of a phy fixup and handling those properties on resume in the micrel driver.
In theory it might now be possible to remove the phy fixup from mach-imx6ul entirely but it is possible that this would break other imx6ul boards which use the same phy. The solution would be to patch their dts but it's not clear how to identify affected boards.
This code is shared with imx6ull-14x14-evk but 6ull suspend needs an unrelated patch: https://lkml.org/lkml/2017/5/30/584
This is something of a corner case so there is no CC: stable.
Changes since v1: https://lkml.org/lkml/2017/5/30/672
* Split a kszphy_config_reset function for stuff shared betweenconfig_init and resume. Calling config_init directly could be an option but on some HW variants it does extra stuff like parsing devicetree options. That would not be appropriate for resume code.
Leonard Crestez (2):
ARM: dts: imx6ul-14x14-evk: Add ksz8081 phy properties
net: phy: micrel: Restore led_mode and clk_sel on resume
arch/arm/boot/dts/imx6ul-14x14-evk.dts | 6 +++++ drivers/net/phy/micrel.c | 42 ++++++++++++++++++++++------------ 2 files changed, 34 insertions(+), 14 deletions(-)
Signature · 1 line
2.7.4
PATCH v2 1/2 ARM: dts: imx6ul-14x14-evk: Add ksz8081 phy properties
Right now mach-imx6ul registers a fixup for the ksz8081 phy. The same register values can be set through the micrel phy driver by using dts properties.
This seems preferable and allows cleanly fixing suspend/resume.
--- arch/arm/boot/dts/imx6ul-14x14-evk.dts | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/boot/dts/imx6ul-14x14-evk.dts +6 -0
@@ -120,10 +120,16 @@ ethphy0: ethernet-phy at 2 { reg = <2>; + micrel,led-mode = <1>; + clocks = <&clks IMX6UL_CLK_ENET_REF>; + clock-names = "rmii-ref"; }; ethphy1: ethernet-phy at 1 { reg = <1>; + micrel,led-mode = <1>; + clocks = <&clks IMX6UL_CLK_ENET2_REF>; + clock-names = "rmii-ref"; }; }; };
Signature · 1 line
2.7.4
Re: [PATCH v2 1/2] ARM: dts: imx6ul-14x14-evk: Add ksz8081 phy properties
Quoted 8 lines · Leonard Crestez
Right now mach-imx6ul registers a fixup for the ksz8081 phy. The same register values can be set through the micrel phy driver by using dts properties.
This seems preferable and allows cleanly fixing suspend/resume.
Signed-off-by Leonard Crestez <[email protected]>Reviewed-by Fabio Estevam <[email protected]>
Signature · 1 line
Florian
PATCH v2 2/2 net: phy: micrel: Restore led_mode and clk_sel on resume
In reply to Leonard CrestezThese bits seem to be lost after a suspend/resume cycle so just set them again. Do this by splitting the handling of these bits into a function that is also called on resume.
This patch fixes ethernet suspend/resume on imx6ul-14x14-evk boards.
--- drivers/net/phy/micrel.c | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-)
drivers/net/phy/micrel.c +28 -14
@@ -268,23 +268,12 @@ static int kszphy_nand_tree_disable(struct phy_device *phydev)return ret; } -static int kszphy_config_init (struct phy_device *phydev) +/* Some config bits need to be set again on resume, handle them here. */ +static int kszphy_config_reset (struct phy_device *phydev) {struct kszphy_priv *priv = phydev->priv; -const struct kszphy_type *type;int ret; -if (!priv) -return 0 ; - - type = priv->type; - -if (type->has_broadcast_disable) -kszphy_broadcast_disable (phydev); - -if (type->has_nand_tree_disable) -kszphy_nand_tree_disable (phydev); -if (priv->rmii_ref_clk_sel) { ret =kszphy_rmii_clk_sel (phydev, priv->rmii_ref_clk_sel_val);if (ret) {
@@ -295,11 +284,30 @@ static int kszphy_config_init(struct phy_device *phydev) }if (priv->led_mode >=0 ) -kszphy_setup_led (phydev, type->led_mode_reg, priv->led_mode); +kszphy_setup_led (phydev, priv->type->led_mode_reg, priv->led_mode);return 0 ; } +static int kszphy_config_init (struct phy_device *phydev) +{ +struct kszphy_priv *priv = phydev->priv; +const struct kszphy_type *type; + +if (!priv) +return 0 ; + + type = priv->type; + +if (type->has_broadcast_disable) +kszphy_broadcast_disable (phydev); + +if (type->has_nand_tree_disable) +kszphy_nand_tree_disable (phydev); + +return kszphy_config_reset (phydev); +} +static int ksz8041_config_init (struct phy_device *phydev) {struct device_node *of_node = phydev->mdio.dev.of_node;
@@ -700,8 +708,14 @@ static int kszphy_suspend(struct phy_device *phydev)static int kszphy_resume (struct phy_device *phydev) { +int ret; +genphy_resume (phydev); + ret =kszphy_config_reset (phydev); +if (ret) +return ret; +/* Enable PHY Interrupts */ if (phy_interrupt_is_valid (phydev)) { phydev->interrupts =PHY_INTERRUPT_ENABLED ;
Signature · 1 line
2.7.4
Re: [PATCH v2 net 2/2] net: phy: micrel: Restore led_mode and clk_sel on resume
Quoted 7 lines · Leonard Crestez
These bits seem to be lost after a suspend/resume cycle so just set them again. Do this by splitting the handling of these bits into a function that is also called on resume.
This patch fixes ethernet suspend/resume on imx6ul-14x14-evk boards.
Signed-off-by Leonard Crestez <[email protected]>
Signature · 1 line
Florian
David Miller
maintainerFrom: Leonard Crestez <[email protected]>
Date: Wed, 31 May 2017 13:29:28 +0300
Quoted 15 lines
Right now attempting doing suspend/resume while root is mounted over NFS hangs on imx6ul-14x14-evk. This is happening because ksz8081 phy fixups are lost on resume.
Fix this by using equivalent devicetree properties instead of a phy fixup and handling those properties on resume in the micrel driver.
In theory it might now be possible to remove the phy fixup from mach-imx6ul entirely but it is possible that this would break other imx6ul boards which use the same phy. The solution would be to patch their dts but it's not clear how to identify affected boards.
This code is shared with imx6ull-14x14-evk but 6ull suspend needs an unrelated patch: https://lkml.org/lkml/2017/5/30/584
Quoted 7 lines
This is something of a corner case so there is no CC: stable.
Changes since v1: https://lkml.org/lkml/2017/5/30/672
* Split akszphy_config_resetfunction for stuff shared betweenconfig_initand resume. Callingconfig_initdirectly could be an option but on some HW variants it does extra stuff like parsing devicetree options. That would not be appropriate for resume code.
Series applied.