* [PATCH v2 1/2] ARM: dts: imx6ul-14x14-evk: Add ksz8081 phy properties
2017-05-31 10:29 [PATCH v2 0/2] ARM: imx6ul-14x14-evk: Fix suspend over nfs by phy Leonard Crestez
@ 2017-05-31 10:29 ` Leonard Crestez
2017-05-31 21:52 ` Florian Fainelli
2017-05-31 10:29 ` [PATCH v2 net 2/2] net: phy: micrel: Restore led_mode and clk_sel on resume Leonard Crestez
2017-06-01 19:03 ` [PATCH v2 0/2] ARM: imx6ul-14x14-evk: Fix suspend over nfs by phy David Miller
2 siblings, 1 reply; 6+ messages in thread
From: Leonard Crestez @ 2017-05-31 10:29 UTC (permalink / raw)
To: Florian Fainelli, David S. Miller, Andrew Lunn, Shawn Guo
Cc: Andy Duan, Johan Hovold, Alexandre Belloni, Philipp Zabel,
Fabio Estevam, netdev, linux-arm-kernel, linux-kernel
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 <leonard.crestez@nxp.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
---
arch/arm/boot/dts/imx6ul-14x14-evk.dts | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/arm/boot/dts/imx6ul-14x14-evk.dts b/arch/arm/boot/dts/imx6ul-14x14-evk.dts
index f18e1f1..d2be8aa 100644
--- a/arch/arm/boot/dts/imx6ul-14x14-evk.dts
+++ b/arch/arm/boot/dts/imx6ul-14x14-evk.dts
@@ -120,10 +120,16 @@
ethphy0: ethernet-phy@2 {
reg = <2>;
+ micrel,led-mode = <1>;
+ clocks = <&clks IMX6UL_CLK_ENET_REF>;
+ clock-names = "rmii-ref";
};
ethphy1: ethernet-phy@1 {
reg = <1>;
+ micrel,led-mode = <1>;
+ clocks = <&clks IMX6UL_CLK_ENET2_REF>;
+ clock-names = "rmii-ref";
};
};
};
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] ARM: dts: imx6ul-14x14-evk: Add ksz8081 phy properties
2017-05-31 10:29 ` [PATCH v2 1/2] ARM: dts: imx6ul-14x14-evk: Add ksz8081 phy properties Leonard Crestez
@ 2017-05-31 21:52 ` Florian Fainelli
0 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2017-05-31 21:52 UTC (permalink / raw)
To: Leonard Crestez, David S. Miller, Andrew Lunn, Shawn Guo
Cc: Andy Duan, Johan Hovold, Alexandre Belloni, Philipp Zabel,
Fabio Estevam, netdev, linux-arm-kernel, linux-kernel
On 05/31/2017 03:29 AM, Leonard Crestez wrote:
> 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 <leonard.crestez@nxp.com>
> Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 net 2/2] net: phy: micrel: Restore led_mode and clk_sel on resume
2017-05-31 10:29 [PATCH v2 0/2] ARM: imx6ul-14x14-evk: Fix suspend over nfs by phy Leonard Crestez
2017-05-31 10:29 ` [PATCH v2 1/2] ARM: dts: imx6ul-14x14-evk: Add ksz8081 phy properties Leonard Crestez
@ 2017-05-31 10:29 ` Leonard Crestez
2017-05-31 21:52 ` Florian Fainelli
2017-06-01 19:03 ` [PATCH v2 0/2] ARM: imx6ul-14x14-evk: Fix suspend over nfs by phy David Miller
2 siblings, 1 reply; 6+ messages in thread
From: Leonard Crestez @ 2017-05-31 10:29 UTC (permalink / raw)
To: Florian Fainelli, David S. Miller, Andrew Lunn, Shawn Guo
Cc: Andy Duan, Johan Hovold, Alexandre Belloni, Philipp Zabel,
Fabio Estevam, netdev, linux-arm-kernel, linux-kernel
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 <leonard.crestez@nxp.com>
---
drivers/net/phy/micrel.c | 42 ++++++++++++++++++++++++++++--------------
1 file changed, 28 insertions(+), 14 deletions(-)
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 6a5fd18..b9252b8d8 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -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;
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 net 2/2] net: phy: micrel: Restore led_mode and clk_sel on resume
2017-05-31 10:29 ` [PATCH v2 net 2/2] net: phy: micrel: Restore led_mode and clk_sel on resume Leonard Crestez
@ 2017-05-31 21:52 ` Florian Fainelli
0 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2017-05-31 21:52 UTC (permalink / raw)
To: Leonard Crestez, David S. Miller, Andrew Lunn, Shawn Guo
Cc: Andy Duan, Johan Hovold, Alexandre Belloni, Philipp Zabel,
Fabio Estevam, netdev, linux-arm-kernel, linux-kernel
On 05/31/2017 03:29 AM, Leonard Crestez wrote:
> 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 <leonard.crestez@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/2] ARM: imx6ul-14x14-evk: Fix suspend over nfs by phy
2017-05-31 10:29 [PATCH v2 0/2] ARM: imx6ul-14x14-evk: Fix suspend over nfs by phy Leonard Crestez
2017-05-31 10:29 ` [PATCH v2 1/2] ARM: dts: imx6ul-14x14-evk: Add ksz8081 phy properties Leonard Crestez
2017-05-31 10:29 ` [PATCH v2 net 2/2] net: phy: micrel: Restore led_mode and clk_sel on resume Leonard Crestez
@ 2017-06-01 19:03 ` David Miller
2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2017-06-01 19:03 UTC (permalink / raw)
To: leonard.crestez
Cc: f.fainelli, andrew, shawnguo, fugang.duan, johan,
alexandre.belloni, p.zabel, fabio.estevam, netdev,
linux-arm-kernel, linux-kernel
From: Leonard Crestez <leonard.crestez@nxp.com>
Date: Wed, 31 May 2017 13:29:28 +0300
> 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 between
> config_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.
Series applied.
^ permalink raw reply [flat|nested] 6+ messages in thread