From patchwork Mon Aug 9 10:22:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wong Vee Khee X-Patchwork-Id: 12426155 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77BF9C432BE for ; Mon, 9 Aug 2021 10:19:09 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1629C61076 for ; Mon, 9 Aug 2021 10:19:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1629C61076 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5wzTQV5jrOFR6b6XbkuEyYDV8jL3wPs553klodHm6zI=; b=rjhS8qx7WkKDvm 66dyc8dB9kY04mCwXKXwQLTrjS8guaPcb4OyqWC3lWmVutd4z3QYcJRZnA5K57K5NXCborC7jOnGG iNYgg5Zea4a0eUlX8Z15ubSlsKv8Tl4ZEs36lZWmvxKp2MlYyvxX0tsliFe2hDGS8kosjjsUdrpcP p+bsy2Ca+R5NdV9+veJqpHR/j2rBYiq/pfMyxrELB89cjU4s6o8vPL+XnlYP/T/1dVWCHEMPU6f4M 4ZYdcYt+VmA9v5+hqH5Dv+KAQibSGoCH8UIilk5Oaxo5aVy5mUQ1y7RUKI8+E2UWLNmul010RDJ/a XkCAdSzNs1+UI/iOtOVQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mD2LS-000B5X-FR; Mon, 09 Aug 2021 10:17:22 +0000 Received: from mga01.intel.com ([192.55.52.88]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mD2LJ-000B4b-2R for linux-arm-kernel@lists.infradead.org; Mon, 09 Aug 2021 10:17:14 +0000 X-IronPort-AV: E=McAfee;i="6200,9189,10070"; a="236654023" X-IronPort-AV: E=Sophos;i="5.84,307,1620716400"; d="scan'208";a="236654023" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Aug 2021 03:17:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,307,1620716400"; d="scan'208";a="505146806" Received: from linux.intel.com ([10.54.29.200]) by fmsmga004.fm.intel.com with ESMTP; 09 Aug 2021 03:17:09 -0700 Received: from glass.png.intel.com (glass.png.intel.com [10.158.65.69]) by linux.intel.com (Postfix) with ESMTP id 7A3A2580922; Mon, 9 Aug 2021 03:17:05 -0700 (PDT) From: Wong Vee Khee To: Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S . Miller" , Jakub Kicinski , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Heiner Kallweit , Russell King Cc: Voon Weifeng , Wong Vee Khee , Michael Sit Wei Hong , Vladimir Oltean , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/2] net: pcs: xpcs: enable skip xPCS soft reset Date: Mon, 9 Aug 2021 18:22:28 +0800 Message-Id: <20210809102229.933748-2-vee.khee.wong@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210809102229.933748-1-vee.khee.wong@linux.intel.com> References: <20210809102229.933748-1-vee.khee.wong@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210809_031713_183683_7AC4C1E8 X-CRM114-Status: GOOD ( 22.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Michael Sit Wei Hong Unlike any other platforms, Intel AlderLake-S uses Synopsys SerDes where all the SerDes PLL configurations are controlled by the xPCS at the BIOS level. If the driver perform a xPCS soft reset on initialization, these settings will be switched back to the power on reset values. This changes the xpcs_create function to take in an additional argument to check if the platform request to skip xPCS soft reset during device initialization. Cc: Vladimir Oltean Signed-off-by: Michael Sit Wei Hong Signed-off-by: Wong Vee Khee --- drivers/net/dsa/sja1105/sja1105_mdio.c | 2 +- .../net/ethernet/stmicro/stmmac/stmmac_mdio.c | 4 +++- drivers/net/pcs/pcs-xpcs.c | 16 ++++++++++++---- include/linux/pcs/pcs-xpcs.h | 3 ++- include/linux/stmmac.h | 1 + 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/net/dsa/sja1105/sja1105_mdio.c b/drivers/net/dsa/sja1105/sja1105_mdio.c index 19aea8fb76f6..73b43a5da68a 100644 --- a/drivers/net/dsa/sja1105/sja1105_mdio.c +++ b/drivers/net/dsa/sja1105/sja1105_mdio.c @@ -437,7 +437,7 @@ static int sja1105_mdiobus_pcs_register(struct sja1105_private *priv) goto out_pcs_free; } - xpcs = xpcs_create(mdiodev, priv->phy_mode[port]); + xpcs = xpcs_create(mdiodev, priv->phy_mode[port], false); if (IS_ERR(xpcs)) { rc = PTR_ERR(xpcs); goto out_pcs_free; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index a5d150c5f3d8..803a4e61105b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -401,12 +401,14 @@ int stmmac_xpcs_setup(struct mii_bus *bus) { struct net_device *ndev = bus->priv; struct mdio_device *mdiodev; + bool skip_xpcs_soft_reset; struct stmmac_priv *priv; struct dw_xpcs *xpcs; int mode, addr; priv = netdev_priv(ndev); mode = priv->plat->phy_interface; + skip_xpcs_soft_reset = priv->plat->skip_xpcs_soft_reset; /* Try to probe the XPCS by scanning all addresses. */ for (addr = 0; addr < PHY_MAX_ADDR; addr++) { @@ -414,7 +416,7 @@ int stmmac_xpcs_setup(struct mii_bus *bus) if (IS_ERR(mdiodev)) continue; - xpcs = xpcs_create(mdiodev, mode); + xpcs = xpcs_create(mdiodev, mode, skip_xpcs_soft_reset); if (IS_ERR_OR_NULL(xpcs)) { mdio_device_free(mdiodev); continue; diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index 63fda3fc40aa..c7a3aa862079 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -1081,7 +1081,8 @@ static const struct phylink_pcs_ops xpcs_phylink_ops = { }; struct dw_xpcs *xpcs_create(struct mdio_device *mdiodev, - phy_interface_t interface) + phy_interface_t interface, + bool skip_reset) { struct dw_xpcs *xpcs; u32 xpcs_id; @@ -1113,9 +1114,16 @@ struct dw_xpcs *xpcs_create(struct mdio_device *mdiodev, xpcs->pcs.ops = &xpcs_phylink_ops; xpcs->pcs.poll = true; - ret = xpcs_soft_reset(xpcs, compat); - if (ret) - goto out; + if (!skip_reset) { + dev_info(&xpcs->mdiodev->dev, "%s: xPCS soft reset\n", + __func__); + ret = xpcs_soft_reset(xpcs, compat); + if (ret) + goto out; + } else { + dev_info(&xpcs->mdiodev->dev, + "%s: skip xpcs soft reset\n", __func__); + } return xpcs; } diff --git a/include/linux/pcs/pcs-xpcs.h b/include/linux/pcs/pcs-xpcs.h index add077a81b21..0c05a63f3446 100644 --- a/include/linux/pcs/pcs-xpcs.h +++ b/include/linux/pcs/pcs-xpcs.h @@ -36,7 +36,8 @@ void xpcs_validate(struct dw_xpcs *xpcs, unsigned long *supported, int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns, int enable); struct dw_xpcs *xpcs_create(struct mdio_device *mdiodev, - phy_interface_t interface); + phy_interface_t interface, + bool xpcs_reset); void xpcs_destroy(struct dw_xpcs *xpcs); #endif /* __LINUX_PCS_XPCS_H */ diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index a6f03b36fc4f..0f901773c5e4 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -268,5 +268,6 @@ struct plat_stmmacenet_data { int msi_rx_base_vec; int msi_tx_base_vec; bool use_phy_wol; + bool skip_xpcs_soft_reset; }; #endif