Netdev List
 help / color / mirror / Atom feed
* [PATCH (net.git)] net: phy: at803x: disable by default the hibernation feature
@ 2016-10-25  8:31 Giuseppe Cavallaro
  2016-10-25  9:00 ` Andrew Lunn
  2016-10-31 15:03 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Giuseppe Cavallaro @ 2016-10-25  8:31 UTC (permalink / raw)
  To: netdev; +Cc: Giuseppe Cavallaro, Matus Ujhelyi

These PHY chips, by default, enable the hibernation feature
so, if the cable is unplugged the device enters in hibernation
mode after some time. This can generate problems on some cases.
It has been noticed, on some platforms that, if the phy enters
in hibernation, the missing of the rx clock signal can force
a mac to fail when setup some parts that need to be properly
clocked.
For example, while booting a Kernel the SYNP MAC (stmmac) fails
to initialize own DMA engine if the phy entered in hibernation
before.

So, the patch just disables this feature by default when init
the PHY driver.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Matus Ujhelyi <ujhelyi.m@gmail.com>
---
 drivers/net/phy/at803x.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
index f279a89..d60953e 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -52,6 +52,9 @@
 #define AT803X_DEBUG_REG_5			0x05
 #define AT803X_DEBUG_TX_CLK_DLY_EN		BIT(8)
 
+#define	AT803X_DEBUG_REG_B			0x0B
+#define	AT803X_DEBUG_PS_HIB_EN			BIT(15)
+
 #define AT803X_REG_CHIP_CONFIG			0x1f
 #define AT803X_BT_BX_REG_SEL			0x8000
 
@@ -117,6 +120,12 @@ static inline int at803x_enable_tx_delay(struct phy_device *phydev)
 					AT803X_DEBUG_TX_CLK_DLY_EN);
 }
 
+static inline int at803x_disable_hibernation(struct phy_device *phydev)
+{
+	return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_B,
+				     AT803X_DEBUG_PS_HIB_EN, 0);
+}
+
 /* save relevant PHY registers to private copy */
 static void at803x_context_save(struct phy_device *phydev,
 				struct at803x_context *context)
@@ -314,6 +323,9 @@ static int at803x_config_init(struct phy_device *phydev)
 			return ret;
 	}
 
+	/* By default disable the Power Hibernation feature */
+	at803x_disable_hibernation(phydev);
+
 	return 0;
 }
 
-- 
2.7.4

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

end of thread, other threads:[~2016-10-31 15:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-25  8:31 [PATCH (net.git)] net: phy: at803x: disable by default the hibernation feature Giuseppe Cavallaro
2016-10-25  9:00 ` Andrew Lunn
2016-10-26  6:08   ` Giuseppe CAVALLARO
2016-10-31 15:03 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox