Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3705885pxf; Mon, 5 Apr 2021 20:49:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6fdAnZ+GnhyqJ3D+0SkzA8KWk3ARbvweHk9uZkI6FXVRDnLoEpta6R9HdKrfEu3R1lLY8 X-Received: by 2002:a92:1e12:: with SMTP id e18mr21761192ile.47.1617680979702; Mon, 05 Apr 2021 20:49:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617680979; cv=none; d=google.com; s=arc-20160816; b=1Eejc8AxubhDHLJ64H/w2+SdS+zqOXSNBDUqHcTDIjp2gmyACfXjGmBB4AvQyNF2+G dP2Dp1cRiPeSCJzLSS19Tgizoc1aS7dXjAxOzwyLbSL9TDnuIS6weUV+/qW8cBe/5nMz 6r+qYNrKjjl1EBqdnJLBNCIXKAYVJe/uTfWos5gm0T+a4wLOf/7rcekYvcWLD9IYlOjp Roghy4iC2F0oSnHmaw6qgQsQaIV/s8smtLx6sl3y+cjE9nhan68tXZBQ/qu1ffd3cF2y MeXlEEFAWTIK8TtfAsyj26tDEM09RPNnTiCWJxl35Xe7VImQ1oBMEuWwdE8Ejt+UiHX8 c46w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from:ironport-sdr :ironport-sdr; bh=jEZ8e+g47f79kns2Q1EjNAxr0A7yxUJc36yazU7gYyc=; b=AUnE+Z3GVyGYzg2p3FI2wbpd8ziMFc1cGrSvA/tVBEn/0CpfmxIcRd7TSx84TdzfB0 wnHTJs9Vj+5bt9WvKbF2jctNRqaaUW5v1tAwWSnzNdb4VrWs05M9gkZA2UuyQdWoZQvU a60Yj/6gk6LDvCKv0RPFjmHYMSN7QqvzNOVjPcfJKvrq2d5sRdGJ3/AcwmrK6KUNHV0x Y2pNdNqQAxgfBaJIrQROIUXz/HNnfGVNyVfIqj+UGe7GL5oRbAC3nP3Q7NPHfBSCxpId hVvxCd2Id9zvK6EQ1RJyApU+vyJioI0pbiy36qxV2S8sOzTy1uDG7chBdYNF3l310na1 1WAA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i21si17511219iov.29.2021.04.05.20.49.27; Mon, 05 Apr 2021 20:49:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242410AbhDEQeK (ORCPT + 99 others); Mon, 5 Apr 2021 12:34:10 -0400 Received: from mga04.intel.com ([192.55.52.120]:57217 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242379AbhDEQeJ (ORCPT ); Mon, 5 Apr 2021 12:34:09 -0400 IronPort-SDR: LDx/x2FlNKcJpYVLGW0m1qdMJnTFCEBBpCNB1Msmt0srZHx/aGUP/dk15e29Rj/ogJLmJdehLQ oD3DNb9Y+NfQ== X-IronPort-AV: E=McAfee;i="6000,8403,9945"; a="190703885" X-IronPort-AV: E=Sophos;i="5.81,307,1610438400"; d="scan'208";a="190703885" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Apr 2021 09:34:01 -0700 IronPort-SDR: qrZggW1wuGgXboJhW4PVAuqiPs1PMOZsICrSO1BpPpXNTL9B3/KYDgzLEcgC9jz8pRc++nyiDq vCdbH4607gfQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,307,1610438400"; d="scan'208";a="612200825" Received: from climb.png.intel.com ([10.221.118.165]) by fmsmga005.fm.intel.com with ESMTP; 05 Apr 2021 09:33:58 -0700 From: Voon Weifeng To: "David S . Miller" , Maxime Coquelin Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jose Abreu , Jakub Kicinski , Giuseppe Cavallaro , Alexandre Torgue , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Ong Boon Leong , Voon Weifeng , Wong Vee Khee Subject: [PATCH net-next] net: intel: Enable SERDES PHY rx clk for PSE Date: Tue, 6 Apr 2021 00:33:57 +0800 Message-Id: <20210405163357.30902-1-weifeng.voon@intel.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org EHL PSE SGMII mode requires to ungate the SERDES PHY rx clk for power up sequence and vice versa. Signed-off-by: Voon Weifeng --- drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c | 10 ++++++++++ drivers/net/ethernet/stmicro/stmmac/dwmac-intel.h | 1 + 2 files changed, 11 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c index add95e20548d..a4fec5fe0779 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c @@ -153,6 +153,11 @@ static int intel_serdes_powerup(struct net_device *ndev, void *priv_data) return data; } + /* PSE only - ungate SGMII PHY Rx Clock */ + if (intel_priv->is_pse) + mdiobus_modify(priv->mii, serdes_phy_addr, SERDES_GCR0, + 0, SERDES_PHY_RX_CLK); + return 0; } @@ -168,6 +173,11 @@ static void intel_serdes_powerdown(struct net_device *ndev, void *intel_data) serdes_phy_addr = intel_priv->mdio_adhoc_addr; + /* PSE only - gate SGMII PHY Rx Clock */ + if (intel_priv->is_pse) + mdiobus_modify(priv->mii, serdes_phy_addr, SERDES_GCR0, + SERDES_PHY_RX_CLK, 0); + /* move power state to P3 */ data = mdiobus_read(priv->mii, serdes_phy_addr, SERDES_GCR0); diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.h b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.h index e723096c0b15..542acb8ce467 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.h +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.h @@ -14,6 +14,7 @@ /* SERDES defines */ #define SERDES_PLL_CLK BIT(0) /* PLL clk valid signal */ +#define SERDES_PHY_RX_CLK BIT(1) /* PSE SGMII PHY rx clk */ #define SERDES_RST BIT(2) /* Serdes Reset */ #define SERDES_PWR_ST_MASK GENMASK(6, 4) /* Serdes Power state*/ #define SERDES_PWR_ST_SHIFT 4 -- 2.17.1