From patchwork Tue Oct 25 08:31:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuseppe CAVALLARO X-Patchwork-Id: 686371 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3t363Z46w9z9t87 for ; Tue, 25 Oct 2016 19:37:46 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758540AbcJYIhh (ORCPT ); Tue, 25 Oct 2016 04:37:37 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:11473 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1758522AbcJYIhb (ORCPT ); Tue, 25 Oct 2016 04:37:31 -0400 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u9P8aUE9022164; Tue, 25 Oct 2016 10:37:29 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-.pphosted.com with ESMTP id 267w85k6e2-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 25 Oct 2016 10:37:29 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 51E1034; Tue, 25 Oct 2016 08:37:28 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas23.st.com [10.75.90.46]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 411061662; Tue, 25 Oct 2016 08:37:28 +0000 (GMT) Received: from localhost (164.130.129.175) by webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.294.0; Tue, 25 Oct 2016 10:37:27 +0200 From: Giuseppe Cavallaro To: CC: Giuseppe Cavallaro , Matus Ujhelyi Subject: [PATCH (net.git)] net: phy: at803x: disable by default the hibernation feature Date: Tue, 25 Oct 2016 10:31:22 +0200 Message-ID: <1477384282-17878-1-git-send-email-peppe.cavallaro@st.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [164.130.129.175] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-10-25_06:, , signatures=0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 Cc: Matus Ujhelyi --- 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; }