All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] net: stmmac: enable EEE in MII, GMII or RGMII only
@ 2017-12-05 10:28 ` Jerome Brunet
  0 siblings, 0 replies; 6+ messages in thread
From: Jerome Brunet @ 2017-12-05 10:28 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue
  Cc: Jerome Brunet, netdev, linux-amlogic, linux-kernel

Note in the databook - Section 4.4 - EEE :
" The EEE feature is not supported when the MAC is configured to use the
TBI, RTBI, SMII, RMII or SGMII single PHY interface. Even if the MAC
supports multiple PHY interfaces, you should activate the EEE mode only
when the MAC is operating with GMII, MII, or RGMII interface."

Applying this restriction solves a stability issue observed on Amlogic
gxl platforms operating with RMII interface and the internal PHY.

Fixes: 83bf79b6bb64 ("stmmac: disable at run-time the EEE if not supported")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---

Hi Peppe, Alexandre,

As quickly explained in the log above, we are having some stability issue on
Amlogic gxl platform: synopsys MAC + internal PHY over RMII. We found out that
these issues are caused by EEE. Forcefully disabling this feature solves our
problem. We are now looking for the more appropriate way to address the
problem.

I only had access to a snip of databook. I have no idea if the restriction
explained above applies to all the revision of Synopsys MAC controller ?
Or maybe the restriction is more generic and we should check for the
interface type in phy_init_eee() instead ?

Could you please share your opinion on this matter ?

Thanks
Jerome

 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index f63c2ddced3c..8e8add8c6ed3 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -364,9 +364,18 @@ static void stmmac_eee_ctrl_timer(struct timer_list *t)
 bool stmmac_eee_init(struct stmmac_priv *priv)
 {
 	struct net_device *ndev = priv->dev;
+	int interface = priv->plat->interface;
 	unsigned long flags;
 	bool ret = false;
 
+	if ((interface != PHY_INTERFACE_MODE_MII) &&
+	    (interface != PHY_INTERFACE_MODE_GMII) &&
+	    (interface != PHY_INTERFACE_MODE_RGMII) &&
+	    (interface != PHY_INTERFACE_MODE_RGMII_ID) &&
+	    (interface != PHY_INTERFACE_MODE_RGMII_TXID) &&
+	    (interface != PHY_INTERFACE_MODE_RGMII_RXID))
+		goto out;
+
 	/* Using PCS we cannot dial with the phy registers at this stage
 	 * so we do not support extra feature like EEE.
 	 */
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [RFC PATCH] net: stmmac: enable EEE in MII, GMII or RGMII only
@ 2017-12-05 10:28 ` Jerome Brunet
  0 siblings, 0 replies; 6+ messages in thread
From: Jerome Brunet @ 2017-12-05 10:28 UTC (permalink / raw)
  To: linus-amlogic

Note in the databook - Section 4.4 - EEE :
" The EEE feature is not supported when the MAC is configured to use the
TBI, RTBI, SMII, RMII or SGMII single PHY interface. Even if the MAC
supports multiple PHY interfaces, you should activate the EEE mode only
when the MAC is operating with GMII, MII, or RGMII interface."

Applying this restriction solves a stability issue observed on Amlogic
gxl platforms operating with RMII interface and the internal PHY.

Fixes: 83bf79b6bb64 ("stmmac: disable at run-time the EEE if not supported")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---

Hi Peppe, Alexandre,

As quickly explained in the log above, we are having some stability issue on
Amlogic gxl platform: synopsys MAC + internal PHY over RMII. We found out that
these issues are caused by EEE. Forcefully disabling this feature solves our
problem. We are now looking for the more appropriate way to address the
problem.

I only had access to a snip of databook. I have no idea if the restriction
explained above applies to all the revision of Synopsys MAC controller ?
Or maybe the restriction is more generic and we should check for the
interface type in phy_init_eee() instead ?

Could you please share your opinion on this matter ?

Thanks
Jerome

 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index f63c2ddced3c..8e8add8c6ed3 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -364,9 +364,18 @@ static void stmmac_eee_ctrl_timer(struct timer_list *t)
 bool stmmac_eee_init(struct stmmac_priv *priv)
 {
 	struct net_device *ndev = priv->dev;
+	int interface = priv->plat->interface;
 	unsigned long flags;
 	bool ret = false;
 
+	if ((interface != PHY_INTERFACE_MODE_MII) &&
+	    (interface != PHY_INTERFACE_MODE_GMII) &&
+	    (interface != PHY_INTERFACE_MODE_RGMII) &&
+	    (interface != PHY_INTERFACE_MODE_RGMII_ID) &&
+	    (interface != PHY_INTERFACE_MODE_RGMII_TXID) &&
+	    (interface != PHY_INTERFACE_MODE_RGMII_RXID))
+		goto out;
+
 	/* Using PCS we cannot dial with the phy registers at this stage
 	 * so we do not support extra feature like EEE.
 	 */
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [RFC PATCH] net: stmmac: enable EEE in MII, GMII or RGMII only
  2017-12-05 10:28 ` Jerome Brunet
@ 2017-12-05 18:03   ` Andrew Lunn
  -1 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2017-12-05 18:03 UTC (permalink / raw)
  To: Jerome Brunet
  Cc: Giuseppe Cavallaro, Alexandre Torgue, netdev, linux-amlogic,
	linux-kernel

>  bool stmmac_eee_init(struct stmmac_priv *priv)
>  {
>  	struct net_device *ndev = priv->dev;
> +	int interface = priv->plat->interface;
>  	unsigned long flags;
>  	bool ret = false;
>  
> +	if ((interface != PHY_INTERFACE_MODE_MII) &&
> +	    (interface != PHY_INTERFACE_MODE_GMII) &&
> +	    (interface != PHY_INTERFACE_MODE_RGMII) &&
> +	    (interface != PHY_INTERFACE_MODE_RGMII_ID) &&
> +	    (interface != PHY_INTERFACE_MODE_RGMII_TXID) &&
> +	    (interface != PHY_INTERFACE_MODE_RGMII_RXID))
> +		goto out;

phy_interface_mode_is_rgmii() will make this smaller.

      Andrew

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [RFC PATCH] net: stmmac: enable EEE in MII, GMII or RGMII only
@ 2017-12-05 18:03   ` Andrew Lunn
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2017-12-05 18:03 UTC (permalink / raw)
  To: linus-amlogic

>  bool stmmac_eee_init(struct stmmac_priv *priv)
>  {
>  	struct net_device *ndev = priv->dev;
> +	int interface = priv->plat->interface;
>  	unsigned long flags;
>  	bool ret = false;
>  
> +	if ((interface != PHY_INTERFACE_MODE_MII) &&
> +	    (interface != PHY_INTERFACE_MODE_GMII) &&
> +	    (interface != PHY_INTERFACE_MODE_RGMII) &&
> +	    (interface != PHY_INTERFACE_MODE_RGMII_ID) &&
> +	    (interface != PHY_INTERFACE_MODE_RGMII_TXID) &&
> +	    (interface != PHY_INTERFACE_MODE_RGMII_RXID))
> +		goto out;

phy_interface_mode_is_rgmii() will make this smaller.

      Andrew

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC PATCH] net: stmmac: enable EEE in MII, GMII or RGMII only
  2017-12-05 10:28 ` Jerome Brunet
@ 2017-12-14 12:41   ` Arnaud Patard (Rtp)
  -1 siblings, 0 replies; 6+ messages in thread
From: Arnaud Patard @ 2017-12-14 12:41 UTC (permalink / raw)
  To: Jerome Brunet
  Cc: Giuseppe Cavallaro, Alexandre Torgue, netdev, linux-amlogic,
	linux-kernel

Jerome Brunet <jbrunet@baylibre.com> writes:

> Note in the databook - Section 4.4 - EEE :
> " The EEE feature is not supported when the MAC is configured to use the
> TBI, RTBI, SMII, RMII or SGMII single PHY interface. Even if the MAC
> supports multiple PHY interfaces, you should activate the EEE mode only
> when the MAC is operating with GMII, MII, or RGMII interface."
>
> Applying this restriction solves a stability issue observed on Amlogic
> gxl platforms operating with RMII interface and the internal PHY.

I was having the issue on my libretech AML-S905X-CC / potato board. With
this patch, I've not been able to trigger it at all. Without it and with
my test case, I was able to trigger the hang several times reliably.

Any hope to see this merged ?

>
> Fixes: 83bf79b6bb64 ("stmmac: disable at run-time the EEE if not supported")
> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>

Tested-by: Arnaud Patard <arnaud.patard@rtp-net.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [RFC PATCH] net: stmmac: enable EEE in MII, GMII or RGMII only
@ 2017-12-14 12:41   ` Arnaud Patard (Rtp)
  0 siblings, 0 replies; 6+ messages in thread
From: Arnaud Patard (Rtp) @ 2017-12-14 12:41 UTC (permalink / raw)
  To: linus-amlogic

Jerome Brunet <jbrunet@baylibre.com> writes:

> Note in the databook - Section 4.4 - EEE :
> " The EEE feature is not supported when the MAC is configured to use the
> TBI, RTBI, SMII, RMII or SGMII single PHY interface. Even if the MAC
> supports multiple PHY interfaces, you should activate the EEE mode only
> when the MAC is operating with GMII, MII, or RGMII interface."
>
> Applying this restriction solves a stability issue observed on Amlogic
> gxl platforms operating with RMII interface and the internal PHY.

I was having the issue on my libretech AML-S905X-CC / potato board. With
this patch, I've not been able to trigger it at all. Without it and with
my test case, I was able to trigger the hang several times reliably.

Any hope to see this merged ?

>
> Fixes: 83bf79b6bb64 ("stmmac: disable at run-time the EEE if not supported")
> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>

Tested-by: Arnaud Patard <arnaud.patard@rtp-net.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-12-14 12:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-05 10:28 [RFC PATCH] net: stmmac: enable EEE in MII, GMII or RGMII only Jerome Brunet
2017-12-05 10:28 ` Jerome Brunet
2017-12-05 18:03 ` Andrew Lunn
2017-12-05 18:03   ` Andrew Lunn
2017-12-14 12:41 ` Arnaud Patard
2017-12-14 12:41   ` Arnaud Patard (Rtp)

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.