From patchwork Wed Jun 19 18:45:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13704443 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 2F0ECC27C53 for ; Wed, 19 Jun 2024 18:46:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Of1uWBxSEjvKTQJleea6ZxhN8mHuCcwxXxdGI9uF93A=; b=typt2HfNcerThPx5bZGwifiizS 3KIt/0kukQVwfgXxpME98gCJKaAsjOBFrJAt8rHIIVS4dK1wykyMhk1KsBUdPwNZBHTRuPPVif16V doBaTxDb3h917L56tWmd1GLjG5Dx31Zl/yAZS/pN3fDE25JKdSbVEOI5fCFNr1g+Eev8sRLnrTR57 TLTlApwfR9xsZZXyJOkVcyCDx4wApGBFrGZy/DpQU4AkcQ7FMfllGjA5I88KpfkFZEct3nNQxtjNm scqbXsuLxO2Cngu/nwMn/NOB9hnfKeFHjaSh/nlx6jxGpOtgw6zoZdBKnuLPczG5TqQhmYPRY3sS4 aDSJFh9Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sK0Jx-00000002QWr-36QI; Wed, 19 Jun 2024 18:46:13 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sK0Jp-00000002QRZ-12PT for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2024 18:46:06 +0000 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-421eab59723so934095e9.3 for ; Wed, 19 Jun 2024 11:46:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1718822763; x=1719427563; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Of1uWBxSEjvKTQJleea6ZxhN8mHuCcwxXxdGI9uF93A=; b=Fe0HTH7RsqDdbWz7tgB+LxoHQgKDrTXKIi1+wnY7efGE584ljGVz34LIPQbRtARBCV kPkbs5F1wIHLBfsj4N2snvJnpHSRonWqhzEN1Ly6KZ8/aS06Yq6nL3Ra2l4N63eDxMbW 5x+HA41k6SBqcFabHL1JZqDXGny6HSmv/1Z3ojcykX8y7JWr2KtVwXs5nxR2F98LJkNs 21oR+lN+zuYfFfyf3eGXyD5b2batvOSkZjz0JMp16FujHJ2SPiPAUBteooLVV6NPNA02 eFhIXD6p2X8va0eS0uDJx/Z3G1UeCa7YFwxdSBVQIBYuS+DjwTPUL8l9b4h1BkSV6WK9 9BWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718822763; x=1719427563; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Of1uWBxSEjvKTQJleea6ZxhN8mHuCcwxXxdGI9uF93A=; b=vfRe2L9ZSjyMnGF7mAVqg26tO7YS/avEUpHCvNdwxlXBrkkW0SrpJmY+cwqDwuNyoM IVDblkU7JiRQ16krLhoxnJn/vvF79WXSP/ffpKf5AdlFFM0cZUk61bzLkuODblZLOiKK f2D6ZAkENB/3H07jEhvDkGKn5MWnuyeKgzCr5sqifBqUoSH6TRTeGs321mJivOSVOCrl FGAa8OLUb15dNBEgAzDWmBIMBNZNDmmId+Z7c1u4kbRXsfiDPJ+khHmp5wXTjbEOwK2A 0aaH2vqXSlJnwaQkbwr3Sg04vFtj9ZGkdZq7a57KVdGdpYE2jSaY2WV0m1nwBOIrWjdF /rXQ== X-Forwarded-Encrypted: i=1; AJvYcCWIHJE1idovgwzjDp1/+IWhOdmFUIIiRzp6ZXqMPxjhUt1DY2gTA9lddxv0JDN/R3v2sEE2P3WXhuWx+KtcYpomJDLwagZYBsvdE90bEuBLoTUGjQM= X-Gm-Message-State: AOJu0Yz2FssPCqgSRfG72Njwq7eRH9plblsgg38hox2WcR3bJ5EBVZc7 qf1PYPOdYsG70J9EIEyDqifmla7zlylqGetbkKo39fFd8OhZOK2I5ixAHITs01A= X-Google-Smtp-Source: AGHT+IG94KmlBI+1kAFW/XzI6UK2YpoCtdBNr/zZ39tySmt8Nx0B1Rz4PfJT6D+Bu6Uwl7ILTiqtkg== X-Received: by 2002:a7b:cc13:0:b0:424:784c:b13b with SMTP id 5b1f17b1804b1-424784cb209mr15137645e9.13.1718822763293; Wed, 19 Jun 2024 11:46:03 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:dc:7e00:991f:deb8:4c5d:d73d]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36098c8c596sm7594156f8f.14.2024.06.19.11.46.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 11:46:02 -0700 (PDT) From: Bartosz Golaszewski To: Vinod Koul , Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Andrew Lunn , Heiner Kallweit , Russell King Cc: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH net-next 1/8] net: phy: add support for overclocked SGMII Date: Wed, 19 Jun 2024 20:45:42 +0200 Message-ID: <20240619184550.34524-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240619184550.34524-1-brgl@bgdev.pl> References: <20240619184550.34524-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_114605_317428_F9F07ACC X-CRM114-Status: GOOD ( 17.20 ) 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: Bartosz Golaszewski The Aquantia AQR115C PHY supports the Overlocked SGMII mode. In order to support it in the driver, extend the PHY core with the new mode bits and pieces. Signed-off-by: Bartosz Golaszewski --- drivers/net/phy/phy-core.c | 1 + drivers/net/phy/phylink.c | 13 ++++++++++++- include/linux/phy.h | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/phy-core.c b/drivers/net/phy/phy-core.c index 15f349e5995a..7cf87cae11f0 100644 --- a/drivers/net/phy/phy-core.c +++ b/drivers/net/phy/phy-core.c @@ -138,6 +138,7 @@ int phy_interface_num_ports(phy_interface_t interface) case PHY_INTERFACE_MODE_RXAUI: case PHY_INTERFACE_MODE_XAUI: case PHY_INTERFACE_MODE_1000BASEKX: + case PHY_INTERFACE_MODE_OCSGMII: return 1; case PHY_INTERFACE_MODE_QSGMII: case PHY_INTERFACE_MODE_QUSGMII: diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 02427378acfd..ce07d41a233f 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -128,6 +128,7 @@ static const phy_interface_t phylink_sfp_interface_preference[] = { PHY_INTERFACE_MODE_5GBASER, PHY_INTERFACE_MODE_2500BASEX, PHY_INTERFACE_MODE_SGMII, + PHY_INTERFACE_MODE_OCSGMII, PHY_INTERFACE_MODE_1000BASEX, PHY_INTERFACE_MODE_100BASEX, }; @@ -180,6 +181,7 @@ static unsigned int phylink_interface_signal_rate(phy_interface_t interface) switch (interface) { case PHY_INTERFACE_MODE_SGMII: case PHY_INTERFACE_MODE_1000BASEX: /* 1.25Mbd */ + case PHY_INTERFACE_MODE_OCSGMII: return 1250; case PHY_INTERFACE_MODE_2500BASEX: /* 3.125Mbd */ return 3125; @@ -231,6 +233,7 @@ static int phylink_interface_max_speed(phy_interface_t interface) return SPEED_1000; case PHY_INTERFACE_MODE_2500BASEX: + case PHY_INTERFACE_MODE_OCSGMII: return SPEED_2500; case PHY_INTERFACE_MODE_5GBASER: @@ -515,6 +518,10 @@ static unsigned long phylink_get_capabilities(phy_interface_t interface, caps |= MAC_1000HD | MAC_1000FD; fallthrough; + case PHY_INTERFACE_MODE_OCSGMII: + caps |= MAC_2500FD; + fallthrough; + case PHY_INTERFACE_MODE_REVRMII: case PHY_INTERFACE_MODE_RMII: case PHY_INTERFACE_MODE_SMII: @@ -929,6 +936,7 @@ static int phylink_parse_mode(struct phylink *pl, case PHY_INTERFACE_MODE_10GKR: case PHY_INTERFACE_MODE_10GBASER: case PHY_INTERFACE_MODE_XLGMII: + case PHY_INTERFACE_MODE_OCSGMII: caps = ~(MAC_SYM_PAUSE | MAC_ASYM_PAUSE); caps = phylink_get_capabilities(pl->link_config.interface, caps, RATE_MATCH_NONE); @@ -1357,7 +1365,8 @@ static void phylink_mac_initial_config(struct phylink *pl, bool force_restart) case MLO_AN_INBAND: link_state = pl->link_config; - if (link_state.interface == PHY_INTERFACE_MODE_SGMII) + if (link_state.interface == PHY_INTERFACE_MODE_SGMII || + link_state.interface == PHY_INTERFACE_MODE_OCSGMII) link_state.pause = MLO_PAUSE_NONE; break; @@ -3640,6 +3649,7 @@ void phylink_mii_c22_pcs_decode_state(struct phylink_link_state *state, break; case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_OCSGMII: case PHY_INTERFACE_MODE_QSGMII: phylink_decode_sgmii_word(state, lpa); break; @@ -3715,6 +3725,7 @@ int phylink_mii_c22_pcs_encode_advertisement(phy_interface_t interface, adv |= ADVERTISE_1000XPSE_ASYM; return adv; case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_OCSGMII: case PHY_INTERFACE_MODE_QSGMII: return 0x0001; default: diff --git a/include/linux/phy.h b/include/linux/phy.h index e6e83304558e..73da0983d631 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -128,6 +128,7 @@ extern const int phy_10gbit_features_array[1]; * @PHY_INTERFACE_MODE_10GKR: 10GBASE-KR - with Clause 73 AN * @PHY_INTERFACE_MODE_QUSGMII: Quad Universal SGMII * @PHY_INTERFACE_MODE_1000BASEKX: 1000Base-KX - with Clause 73 AN + * @PHY_INTERFACE_MODE_OCSGMII: Overclocked SGMII * @PHY_INTERFACE_MODE_MAX: Book keeping * * Describes the interface between the MAC and PHY. @@ -168,6 +169,7 @@ typedef enum { PHY_INTERFACE_MODE_10GKR, PHY_INTERFACE_MODE_QUSGMII, PHY_INTERFACE_MODE_1000BASEKX, + PHY_INTERFACE_MODE_OCSGMII, PHY_INTERFACE_MODE_MAX, } phy_interface_t; @@ -289,6 +291,8 @@ static inline const char *phy_modes(phy_interface_t interface) return "100base-x"; case PHY_INTERFACE_MODE_QUSGMII: return "qusgmii"; + case PHY_INTERFACE_MODE_OCSGMII: + return "ocsgmii"; default: return "unknown"; } From patchwork Wed Jun 19 18:45:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13704442 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 778A5C27C53 for ; Wed, 19 Jun 2024 18:46:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=SJn78QxgCMJZC/Bt30akmrrLqCYwQcxiOnm8hqmwEKA=; b=FR1bevYE1icJL+EuZfR6NjihWL Jny95Fhtk6PMn+kejpjHbzj51CH+I3m6SZn2uXPbC0QEsX6n7xj1zUSdEUbDfPdQAfrI3Gb2EkoDk yL+nDES9Oepm75MahYopvAKtKSxsqHlr9Uywi0mUGrCt4S67PbLYvIry5uOyM2A9j1V78QzQSn9TT E6RpXfQjPyjh1QJEOiLBQEhmlK49lsUfWOgSfOmeDsN1vhJiotYVZqXmMbVYZgCGVN+2AAe8T2bgG 2CYPIqnb7Unq0BQC+aZjuPzMrI9BWTYtZgWxwKdfE7g7kJQO6zryl41YAiJyafKa6aXppSULBWEjf +aWf3M/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sK0Jy-00000002QXK-2dkT; Wed, 19 Jun 2024 18:46:14 +0000 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sK0Jq-00000002QRu-0uvA for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2024 18:46:07 +0000 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-36336aa7ca1so79142f8f.1 for ; Wed, 19 Jun 2024 11:46:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1718822764; x=1719427564; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SJn78QxgCMJZC/Bt30akmrrLqCYwQcxiOnm8hqmwEKA=; b=ETk8dMrl5BGvOZdw/zycRb0zY/24CqFplvj/68gpc45OVp5mmLvCklp2YzXz3kJB8J OwVeCoCpUP+twB1Rto7fEHrlzm0p0CkDBWY6I+i8Rup0n0uFH6doCO2ctozUcfvU67HI rNeLfmid5kZYi+SYX3YWwZbGiqpSkM9mCcRM18s4vSviFYajtgGx0UQFXQJBTQcwMccO /Zn73eBZtpWRDjFZfTymZmODF8tXajVUnxTJ4Hleg68Lx2W68kzsvxkyyFKtTq/sbijc CmLxdIGQ616inMxx9K0jKqyZGn8OMdRrGD5qjaQ/L0f7Rqw+SHY/gR911tk4f3IC1xGt pk8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718822764; x=1719427564; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SJn78QxgCMJZC/Bt30akmrrLqCYwQcxiOnm8hqmwEKA=; b=po8xeD2ldd+19jLR3sZokdNK9tH5htAnIq2PUV/AI73o8hg5NF3wGBS6tNmgYR5v8i 4nYlSBEWItTBveUfyRDj4Ky6HeM6Au5Zj4OdiA5IayIrnWYJCsNt6sPhy8Qi1tMywvQn 3eP1JJVT46CF3nh66qHyA8nl5ZgMlg7yF00oTDWHc0aHsnhi3v68DmFBsAwCsC9BXuWv 0wbunk7IT+0VPj0oAJAmLAWJUKsAOQbvn5qfvIrgtMzRAgbRhxcftEhLE47kmdJ1X+jC JjxnJMHxomfyjtxjqEGbU0tjuqN/XHA2RlDKF3wQRApXddD7UpAfoIHEv05i7aEeVLoz woIg== X-Forwarded-Encrypted: i=1; AJvYcCXbXGE0cd3wf4GMWrAX6TTYfRKCIM8NBAMlt+dqLNuF9P7/XD/0fSbcrj7OAcSSp/tH3xzjob2acyfU0qLBOX1qEagCpNByzUxdJcVf88qg06jEtwA= X-Gm-Message-State: AOJu0Yyc9UE+4iwG4qtmAIwlKZ0MzcV1/e5J8u3gEKQBas6Lc9vw+g8i gzYVqJh/jOk9DR5s46O8+0J25TRSFG7gTBiTxhuzhGGD8jufIFmuB9d3cZqm+vw= X-Google-Smtp-Source: AGHT+IGvNKdudrDJsFCz+vta1snIK9cUncMqGFnepCueFTkJUGgeHU0mX5Ge8h1gAZtVNK+LZc9FoA== X-Received: by 2002:a05:6000:1363:b0:362:dbc2:9486 with SMTP id ffacd0b85a97d-36319c6f86emr2312112f8f.68.1718822764283; Wed, 19 Jun 2024 11:46:04 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:dc:7e00:991f:deb8:4c5d:d73d]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36098c8c596sm7594156f8f.14.2024.06.19.11.46.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 11:46:03 -0700 (PDT) From: Bartosz Golaszewski To: Vinod Koul , Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Andrew Lunn , Heiner Kallweit , Russell King Cc: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH net-next 2/8] net: stmmac: qcom-ethqos: add support for 2.5G overlocked SGMII mode Date: Wed, 19 Jun 2024 20:45:43 +0200 Message-ID: <20240619184550.34524-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240619184550.34524-1-brgl@bgdev.pl> References: <20240619184550.34524-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_114606_306208_778AC86E X-CRM114-Status: GOOD ( 11.75 ) 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: Bartosz Golaszewski Add support for 2.5G speed in Overclocked SGMII mode to the QCom ethqos driver. Signed-off-by: Bartosz Golaszewski --- .../net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index 80eb72bc6311..dac91bc72070 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -665,6 +665,14 @@ static int ethqos_configure_sgmii(struct qcom_ethqos *ethqos) return val; } +static void qcom_ethqos_speed_mode_2500(struct net_device *ndev, void *data) +{ + struct stmmac_priv *priv = netdev_priv(ndev); + + priv->plat->max_speed = 2500; + priv->plat->phy_interface = PHY_INTERFACE_MODE_OCSGMII; +} + static int ethqos_configure(struct qcom_ethqos *ethqos) { return ethqos->configure_func(ethqos); @@ -787,6 +795,9 @@ static int qcom_ethqos_probe(struct platform_device *pdev) case PHY_INTERFACE_MODE_RGMII_TXID: ethqos->configure_func = ethqos_configure_rgmii; break; + case PHY_INTERFACE_MODE_OCSGMII: + plat_dat->speed_mode_2500 = qcom_ethqos_speed_mode_2500; + fallthrough; case PHY_INTERFACE_MODE_SGMII: ethqos->configure_func = ethqos_configure_sgmii; break; From patchwork Wed Jun 19 18:45:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13704444 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 6B513C2BD09 for ; Wed, 19 Jun 2024 18:46:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=i2ZaP1GIFake6LOudA2QCXAqpH6bV7MuTKm6aVLhChY=; b=g2aptkqkbmdIsYLzvsHoiLzEvz TNxbtEObEPH2RfEExRxjrKe7DVXnmnks5YjlDxBbBMWmPH8DaZPeP0AysM6MHdewwuQDlxh0vcV6X 70Bw+K37mJW7FFXKFt43+Uldqiz36mo3wR9aRC+aAUIqqrThOPau3a4pFnJtQq9vgE/NtvBCsNGoC ehGbpsoVC1UmIhqO42Z54mF98Y9fYIcPjEN4ljdMpxnqNOuljGUGDqCV0jeexWq9k8sG6l00tcNLJ AenR5+NqVbs6vmFuFH1addunzO0B3H8oyTCzeFd6PNd/pn9n6lNKKflnBY/mLURoqiPHI2To9FsUt PrJuvODw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sK0Jz-00000002QXu-1QcC; Wed, 19 Jun 2024 18:46:15 +0000 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sK0Jr-00000002QSI-23nR for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2024 18:46:09 +0000 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-3629c517da9so105893f8f.2 for ; Wed, 19 Jun 2024 11:46:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1718822765; x=1719427565; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=i2ZaP1GIFake6LOudA2QCXAqpH6bV7MuTKm6aVLhChY=; b=yp9kRno6y1tm9LJKOCcvJXZohdhEMcAcKSYvyl6TGBeMGPHaDTYRL84hG3EZGFWQ5Z XLF1Yw/PZoW8j7U46ZeHML2Jn/oDAsZJOMulEKEp0e7c8SHyN6ezdSP+4kLMjkva7QaS yaitR1e7LyX++4k1VndF32QMRwcY/tiDGZGOTsSLGPLSP/CtfA+gaaoQmo18MGpzMYcC +gKTokCKMcuDI8bHetp+VDoF4uWP/YyTCLUP2e2IXQgJM/RE19EQeuRZAN/Lhi+lOzlW Ocpvhb3MofM67xWQIkn1GyqQyRj+DKaoeV+5+FQOKK8PPxIbR9EkBW7MDqmJYrHt67wS seTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718822765; x=1719427565; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=i2ZaP1GIFake6LOudA2QCXAqpH6bV7MuTKm6aVLhChY=; b=XAH/SvKM/WO1M7cK+2htFZyskyZo/la4maL2C8I2KmCuM8+ews9lfKQviLZXezWq9q Zbt16a1X9V2zotlHPoy0qwdmhtCwU7Q8GkUPKh3veLJA8P2Zo1QGgKEN+FX708aaptTj 42uscpJaX9HHbgpd9+18fi7xECpuAXWjdFu1pnWDo4byyb+wAjhCsbeF9M3aLdVddc7R 2WNZnfVxw5b97PHSILoS9ituLMEep9ZmzHVHCzR0m7vpTfM7zwRUVFdo/bCCp0+5aGHv 6/LguvRdlfVuDlXt2NgF5if8v3QwiugyiCE4yD2MLXheGGqqbLoYAyh0wlydFNQ/pBgt zYtw== X-Forwarded-Encrypted: i=1; AJvYcCX/8GH5h0oFVsTzw6kU1rrp/lPCS4SgfxgVFtLQKvt84IlL0r7l8lALNI3nenyGM1lc9sXjPU71HtBWOisavKXktY9csRbhg/dgKS0h6d90eq5FmYI= X-Gm-Message-State: AOJu0YwPM33H4YLRBT6vUxPDRDk1fdD3e+/tUiHgaRuQAxMNoGNsCTlm eaZsRpNYThujdL3AEMgYZwwATPGUkJ70YWqhOOnHeHRMjMWsuRy6k/ezvRqcl7E= X-Google-Smtp-Source: AGHT+IFHpgEdcFxPeHRNEDbOoGGaHbIDTAIRX4vjn/KLZAdtQ8VVBfo3vmxuKjBv7nIHdarP5mwF1w== X-Received: by 2002:a5d:590c:0:b0:35f:1eba:cf66 with SMTP id ffacd0b85a97d-363199905dbmr3314238f8f.61.1718822765554; Wed, 19 Jun 2024 11:46:05 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:dc:7e00:991f:deb8:4c5d:d73d]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36098c8c596sm7594156f8f.14.2024.06.19.11.46.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 11:46:04 -0700 (PDT) From: Bartosz Golaszewski To: Vinod Koul , Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Andrew Lunn , Heiner Kallweit , Russell King Cc: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH net-next 3/8] net: phy: aquantia: add missing include guards Date: Wed, 19 Jun 2024 20:45:44 +0200 Message-ID: <20240619184550.34524-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240619184550.34524-1-brgl@bgdev.pl> References: <20240619184550.34524-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_114607_593882_8326FB9B X-CRM114-Status: UNSURE ( 9.85 ) X-CRM114-Notice: Please train this message. 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: Bartosz Golaszewski The header is missing the include guards so add them. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andrew Lunn --- drivers/net/phy/aquantia/aquantia.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/phy/aquantia/aquantia.h b/drivers/net/phy/aquantia/aquantia.h index c0e1fd9d7152..b8502793962e 100644 --- a/drivers/net/phy/aquantia/aquantia.h +++ b/drivers/net/phy/aquantia/aquantia.h @@ -6,6 +6,9 @@ * Author: Heiner Kallweit */ +#ifndef AQUANTIA_H +#define AQUANTIA_H + #include #include @@ -198,3 +201,5 @@ int aqr_phy_led_hw_control_set(struct phy_device *phydev, u8 index, int aqr_phy_led_active_low_set(struct phy_device *phydev, int index, bool enable); int aqr_phy_led_polarity_set(struct phy_device *phydev, int index, unsigned long modes); + +#endif /* AQUANTIA_H */ From patchwork Wed Jun 19 18:45:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13704445 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 4415FC2BB85 for ; Wed, 19 Jun 2024 18:46:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4DXl1d4Y8Fq/VGE/ZlCIrTHLlhnzc/4anlmd+PrIAuk=; b=Ii3DkFgRya73lAyhbJSMN88/YL cS3VdIQObmE9CuAS8bUIOSqQUh5lVZ+Bg6/KCxl67V/JIV/q1cvMTw7Aup+P9b6a/wQ/rOWkOuy6F t2CBt4xfuD1lDDYR+JIMrOOt8BmDlzT+DNcUtDfYvyvcrKOuQneqXlDZmFQOHtPZYZFw4my7Xgg4a 0kYYN+seCXq+8J/186sKNcNu5iPqxEfOT+uMvlct00oO4oHvuwvDgD8FPB3L/5rhNGA0A+O0AZM1r ofPCGN+XWRMKmpVYOnAG8gTFQgK45Cw0EK6KAjAbP4bR+zCF1N88f+KX7W0odLFbHT5eCjXA1V9d9 ClXSk83A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sK0K0-00000002QYj-14iA; Wed, 19 Jun 2024 18:46:16 +0000 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sK0Js-00000002QT3-1sU0 for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2024 18:46:10 +0000 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-3609565a1bdso78649f8f.1 for ; Wed, 19 Jun 2024 11:46:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1718822766; x=1719427566; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4DXl1d4Y8Fq/VGE/ZlCIrTHLlhnzc/4anlmd+PrIAuk=; b=d6JBEabZoErz11Y/aOHVqe73qOqAyNcumnVjIQIqugeNwWuMNMkA4d02pZhVab5LXZ fXt1hmabT+bOekBqmc25kWHQa9VG0qqDxko0ApKDyiTTom0qfvK6qyeHlCCMyI2dFWyE 2bh3d001XKl/qkGHfy/TOWcJCkvtZR48e0vkIkiNvKPLR37JTiwpWL6Dexfbu/AEhkmM cmD5INyaIJFHJN7OFlf+xIb1ETTf0hpHm2DOnvRMt35a6AlJ3Lyh7FHwf20HJaSEg4Ob b78k6KCw4Dc3JJdDzc4bsxeseVq740+zU+CdlO/BphKpCMnN78u1WeIn6w2x8xr2XGL2 cQxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718822766; x=1719427566; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4DXl1d4Y8Fq/VGE/ZlCIrTHLlhnzc/4anlmd+PrIAuk=; b=UHX4gdaXkdHAaztIxf6MTMMNC39pmrOUVkUG5SsOJ3yl4D38492dPxlkMFGuiZNbZh OS5wMJNCufwMEQkxMOdJRhpOeWe1UJI9dPa/SQ86wId+wesr3ktNu/OR+dqG0QmyVnF3 ygrWqTByfUQr1+Iq82hw6Np9ZMagRlzvsUIKLvZjHp4PXOnO7G//oNriaMrlIIw8s/sy fuhxCJQ6OcY7W8OgfOKFsGhTVgLr2l1J+0jkx+xPjPcna/PciRsdm7o5qdHpIHaM1adD 3yPFmrMkKRGskKC0JtB1KRCgYkqBLYpytlRbCaqoa3GZaJ28bQVVKZNvg42Fc+P6BaDr 67yA== X-Forwarded-Encrypted: i=1; AJvYcCURb4w81nOtsaZtrckXHDKzhFucfXidk/G/SAMT7NCZA/Kfjm9qtYnWtY2z33nYl3S9/M9S1S/Ai6iQRTpE7zNoVUlFoiROkrWNDjruMBvAzn60yUM= X-Gm-Message-State: AOJu0Yyq+GxjTN/MAsWTftibROxDBi7LPl9guOPit3sNOflvF42i+3Hu dBq/BcDNGtsFhWnt0lt9FC1XRRnx0bj9/vl3k/6+6kwxgBK9S+BqzNacqhe0UdM= X-Google-Smtp-Source: AGHT+IFnMG2uKDWMS0ODk8knrpOgQWkYuhtlFvM28oyZAff20pv5uomTc+TbnoChW8iQa/KMF1tSDw== X-Received: by 2002:a5d:5269:0:b0:362:4b65:1cd2 with SMTP id ffacd0b85a97d-36317d7311fmr2276902f8f.38.1718822766449; Wed, 19 Jun 2024 11:46:06 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:dc:7e00:991f:deb8:4c5d:d73d]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36098c8c596sm7594156f8f.14.2024.06.19.11.46.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 11:46:06 -0700 (PDT) From: Bartosz Golaszewski To: Vinod Koul , Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Andrew Lunn , Heiner Kallweit , Russell King Cc: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH net-next 4/8] net: phy: aquantia: add support for aqr115c Date: Wed, 19 Jun 2024 20:45:45 +0200 Message-ID: <20240619184550.34524-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240619184550.34524-1-brgl@bgdev.pl> References: <20240619184550.34524-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_114608_674945_F62CF532 X-CRM114-Status: GOOD ( 16.78 ) 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: Bartosz Golaszewski Add support for a new model to the Aquantia driver. This PHY supports Overlocked SGMII mode with 2.5G speeds. Signed-off-by: Bartosz Golaszewski --- drivers/net/phy/aquantia/aquantia_main.c | 41 ++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/aquantia/aquantia_main.c b/drivers/net/phy/aquantia/aquantia_main.c index 6c14355744b7..11da460698b0 100644 --- a/drivers/net/phy/aquantia/aquantia_main.c +++ b/drivers/net/phy/aquantia/aquantia_main.c @@ -29,6 +29,7 @@ #define PHY_ID_AQR113 0x31c31c40 #define PHY_ID_AQR113C 0x31c31c12 #define PHY_ID_AQR114C 0x31c31c22 +#define PHY_ID_AQR115C 0x31c31c33 #define PHY_ID_AQR813 0x31c31cb2 #define MDIO_PHYXS_VEND_IF_STATUS 0xe812 @@ -111,7 +112,6 @@ static u64 aqr107_get_stat(struct phy_device *phydev, int index) int len_h = stat->size - len_l; u64 ret; int val; - val = phy_read_mmd(phydev, MDIO_MMD_C22EXT, stat->reg); if (val < 0) return U64_MAX; @@ -368,7 +368,7 @@ static int aqr107_read_status(struct phy_device *phydev) phydev->interface = PHY_INTERFACE_MODE_RXAUI; break; case MDIO_PHYXS_VEND_IF_STATUS_TYPE_OCSGMII: - phydev->interface = PHY_INTERFACE_MODE_2500BASEX; + phydev->interface = PHY_INTERFACE_MODE_OCSGMII; break; default: phydev->interface = PHY_INTERFACE_MODE_NA; @@ -721,6 +721,18 @@ static int aqr113c_config_init(struct phy_device *phydev) return aqr107_fill_interface_modes(phydev); } +static int aqr115c_config_init(struct phy_device *phydev) +{ + /* Check that the PHY interface type is compatible */ + if (phydev->interface != PHY_INTERFACE_MODE_SGMII && + phydev->interface != PHY_INTERFACE_MODE_OCSGMII) + return -ENODEV; + + phy_set_max_speed(phydev, SPEED_2500); + + return 0; +} + static int aqr107_probe(struct phy_device *phydev) { int ret; @@ -999,6 +1011,30 @@ static struct phy_driver aqr_driver[] = { .led_hw_control_get = aqr_phy_led_hw_control_get, .led_polarity_set = aqr_phy_led_polarity_set, }, +{ + PHY_ID_MATCH_MODEL(PHY_ID_AQR115C), + .name = "Aquantia AQR115C", + .probe = aqr107_probe, + .get_rate_matching = aqr107_get_rate_matching, + .config_init = aqr115c_config_init, + .config_aneg = aqr_config_aneg, + .config_intr = aqr_config_intr, + .handle_interrupt = aqr_handle_interrupt, + .read_status = aqr107_read_status, + .get_tunable = aqr107_get_tunable, + .set_tunable = aqr107_set_tunable, + .suspend = aqr107_suspend, + .resume = aqr107_resume, + .get_sset_count = aqr107_get_sset_count, + .get_strings = aqr107_get_strings, + .get_stats = aqr107_get_stats, + .link_change_notify = aqr107_link_change_notify, + .led_brightness_set = aqr_phy_led_brightness_set, + .led_hw_is_supported = aqr_phy_led_hw_is_supported, + .led_hw_control_set = aqr_phy_led_hw_control_set, + .led_hw_control_get = aqr_phy_led_hw_control_get, + .led_polarity_set = aqr_phy_led_polarity_set, +}, { PHY_ID_MATCH_MODEL(PHY_ID_AQR813), .name = "Aquantia AQR813", @@ -1042,6 +1078,7 @@ static struct mdio_device_id __maybe_unused aqr_tbl[] = { { PHY_ID_MATCH_MODEL(PHY_ID_AQR113) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR113C) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR114C) }, + { PHY_ID_MATCH_MODEL(PHY_ID_AQR115C) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR813) }, { } }; From patchwork Wed Jun 19 18:45:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13704447 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id F35E6C2BD05 for ; Wed, 19 Jun 2024 18:46:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=m8OMC48GmXgiPxob9K29Y+tXmIST97gKgb0MYszQ6f4=; b=WffOSnIzGC7MtcSSSdahb9zxPw +VS0awxpop16Wfd0Bz36fZH3G4CA+U4y2gg1JLQX63kC4sHIS8b+JRWFZrxfcNSswjWL6n4PsblqO eZLnDJuGz94xSjf/AP+0vQRsrz46jEtCcIXIxGfJ6ZfxgFlMSUUxbqBWidU1ttcYbShAoYVqa7yq/ q/btfoimiJEQBuMtIYRiYCh6r99xmhR83A82xmtXXVVFiK1PJ5uR8by2nzLN6LYpvUlGNo4dgAKz/ 1CO/FhJoiTfS/8xC6YMVnhW7iWEwk4LLSeUHMMZ3R0NNAcpD33fIn9F5VC9/ctRQ2DNGJzVN+mL3+ H9HkslnQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sK0K1-00000002QZc-1h11; Wed, 19 Jun 2024 18:46:17 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sK0Jt-00000002QTy-1Su9 for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2024 18:46:10 +0000 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-362f62ae4c5so76167f8f.1 for ; Wed, 19 Jun 2024 11:46:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1718822767; x=1719427567; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=m8OMC48GmXgiPxob9K29Y+tXmIST97gKgb0MYszQ6f4=; b=tYrTVtC8m645M7w/N+UThRmh2m1lKNfC1Drme2xpSUqmhCt+BwA2xGj+Y+NPFHVYFo kgImLp7fivDqA1yfGJsimyn1WsZ/pkStsffo1/MxGtSV7cOdLRkOtztoHZx1xhwqqy5v rEIod3Tz3Bm0sQQH8BpdROKYQov07Rim7uM/vsYeLhULcfUCErAIruBOetm3zBGowPet n4tGFQReSFS7RQf4IeZ0qpUD+Jg1LMasxMIwY3CtuhkB4HNara4KRInZtyTg2EJOmyLt e9xvHMDCcDMDsSw/DLsXmoUVS0n8I+3s6Cdk9vS1bbKxv0GN1U+Kg1p17QUXyph21ZG6 GhcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718822767; x=1719427567; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m8OMC48GmXgiPxob9K29Y+tXmIST97gKgb0MYszQ6f4=; b=ilkTDeacsBGOb6vXWCVL+DGog/v7ogGOaJKtGnWNED6A/lrFBofs/Su75yu6m+gxLp 9yJIcLpYrd0RbEemhkzn9IG0HZIA19bp9LeyokF4qpsUD+q3ltjIPXHxDqaV3WKBBufp qF6l54MNueE+Ntb7xCajDPjxiN8tjw4dSHb+SGKt3X3vMcgF1URQvjOzLGKU47qCVt6c bSNf4s3Fq0SOqsbaeGORYpkmfb/Qi65bUbmXo+mkXzpZecZrCFxbj9ggBUG7vekz/ahT C3P8bRvGIpFCFYemVMt0AW0Hy0vPuXA/l4Ja0dRBYpxdxb7RZTBsfbHuVaR+UAqkfvOh ivFg== X-Forwarded-Encrypted: i=1; AJvYcCVcO71oNs5FUxCzQoTxYO+Z1lqcv73I9BoUpliWK/ZSbRbT0xhtM7lngMCsjALlanCLSQkhOFdLFRJMfC8XGwPiX5QcHIAEAs2EHNMlFwCtHof5Fdo= X-Gm-Message-State: AOJu0Yww6mT9uJNYgNxjBUqqAgeiuRck9ek+wFHFgcXK9aPH/AJXdNIg 1Y1478VT/ijPh/1fX3iR+rSkStHLqTazW98drHHbeATEOj34alpNqrq5zTRrSfs= X-Google-Smtp-Source: AGHT+IHPbftWUm712EVMDPWc9/FAfLxNDa5SAVUKIsk+n79gLzuNi7krxSeOn0v4Ewzob/JdZzx81g== X-Received: by 2002:a5d:6d4c:0:b0:360:7856:fa62 with SMTP id ffacd0b85a97d-3609ea6c58emr6800607f8f.15.1718822767356; Wed, 19 Jun 2024 11:46:07 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:dc:7e00:991f:deb8:4c5d:d73d]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36098c8c596sm7594156f8f.14.2024.06.19.11.46.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 11:46:07 -0700 (PDT) From: Bartosz Golaszewski To: Vinod Koul , Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Andrew Lunn , Heiner Kallweit , Russell King Cc: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH net-next 5/8] net: phy: aquantia: wait for FW reset before checking the vendor ID Date: Wed, 19 Jun 2024 20:45:46 +0200 Message-ID: <20240619184550.34524-6-brgl@bgdev.pl> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240619184550.34524-1-brgl@bgdev.pl> References: <20240619184550.34524-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_114609_505117_76AD55CD X-CRM114-Status: GOOD ( 15.64 ) 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: Bartosz Golaszewski Checking the firmware register before it boots makes no sense, it will report 0 even if FW is loaded. Always wait for FW to boot before continuing. Signed-off-by: Bartosz Golaszewski --- drivers/net/phy/aquantia/aquantia.h | 1 + drivers/net/phy/aquantia/aquantia_firmware.c | 4 ++++ drivers/net/phy/aquantia/aquantia_main.c | 6 +++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/aquantia/aquantia.h b/drivers/net/phy/aquantia/aquantia.h index b8502793962e..2465345081f8 100644 --- a/drivers/net/phy/aquantia/aquantia.h +++ b/drivers/net/phy/aquantia/aquantia.h @@ -201,5 +201,6 @@ int aqr_phy_led_hw_control_set(struct phy_device *phydev, u8 index, int aqr_phy_led_active_low_set(struct phy_device *phydev, int index, bool enable); int aqr_phy_led_polarity_set(struct phy_device *phydev, int index, unsigned long modes); +int aqr_wait_reset_complete(struct phy_device *phydev); #endif /* AQUANTIA_H */ diff --git a/drivers/net/phy/aquantia/aquantia_firmware.c b/drivers/net/phy/aquantia/aquantia_firmware.c index 0c9640ef153b..524627a36c6f 100644 --- a/drivers/net/phy/aquantia/aquantia_firmware.c +++ b/drivers/net/phy/aquantia/aquantia_firmware.c @@ -353,6 +353,10 @@ int aqr_firmware_load(struct phy_device *phydev) { int ret; + ret = aqr_wait_reset_complete(phydev); + if (ret) + return ret; + /* Check if the firmware is not already loaded by pooling * the current version returned by the PHY. If 0 is returned, * no firmware is loaded. diff --git a/drivers/net/phy/aquantia/aquantia_main.c b/drivers/net/phy/aquantia/aquantia_main.c index 11da460698b0..eab779db225c 100644 --- a/drivers/net/phy/aquantia/aquantia_main.c +++ b/drivers/net/phy/aquantia/aquantia_main.c @@ -441,7 +441,7 @@ static int aqr107_set_tunable(struct phy_device *phydev, * The chip also provides a "reset completed" bit, but it's cleared after * read. Therefore function would time out if called again. */ -static int aqr107_wait_reset_complete(struct phy_device *phydev) +int aqr_wait_reset_complete(struct phy_device *phydev) { int val; @@ -494,7 +494,7 @@ static int aqr107_config_init(struct phy_device *phydev) WARN(phydev->interface == PHY_INTERFACE_MODE_XGMII, "Your devicetree is out of date, please update it. The AQR107 family doesn't support XGMII, maybe you mean USXGMII.\n"); - ret = aqr107_wait_reset_complete(phydev); + ret = aqr_wait_reset_complete(phydev); if (!ret) aqr107_chip_info(phydev); @@ -522,7 +522,7 @@ static int aqcs109_config_init(struct phy_device *phydev) phydev->interface != PHY_INTERFACE_MODE_2500BASEX) return -ENODEV; - ret = aqr107_wait_reset_complete(phydev); + ret = aqr_wait_reset_complete(phydev); if (!ret) aqr107_chip_info(phydev); From patchwork Wed Jun 19 18:45:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13704446 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 2C2E3C27C53 for ; Wed, 19 Jun 2024 18:46:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=IuxLK+Kt4TA0IWlhERRNrzNbAxkSoJre0Y5sVJZCXq0=; b=zCDZwbFIpSwr356ASAQjNJMkU8 aHck13FDT3GE952uklSi9vOzag9AmTXXQPbiTC2QnqW+k56Z3NDcigLYjxH/7J//sNED3xJF0Sq6b WlOJWJsROEAfvcIwwd3Np7NpRNrfRsJGJoqHdJJWAWIYVamJRL1fd51V/xcGbltIXow37iKogwLdU pKGta9bL6zFmmCwUVunrTqHfQ7jX+jZfrclSGPwy2r3OJXPARoI3LFsd+Vnd6PUddCbmQggj9HmZd tLmbludkNlHY/iBexAjGXerD7kBdTiUWq4YqTnCMP8dRRYyunNNUz2HIU3kJdEQwSoOxM83nP1WPS CMrbu6hw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sK0K3-00000002QbS-3iBo; Wed, 19 Jun 2024 18:46:19 +0000 Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sK0Ju-00000002QUm-39wY for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2024 18:46:12 +0000 Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2ec3c0dada3so1003011fa.0 for ; Wed, 19 Jun 2024 11:46:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1718822768; x=1719427568; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IuxLK+Kt4TA0IWlhERRNrzNbAxkSoJre0Y5sVJZCXq0=; b=12J8kqAMRP4XwcyYw+bgRAtoeIA163PAenXTPdwQwgLR7pAVZNZNSDf/cVgrbzixpe q8OjpfKswJo6LixLLp2gusjyZpRJcitHnEe42ouYsSFt5RVJRJrmRasQtA1lR93TH0oa POdexRy8OGR7puS6v0+MNPPXAz7mHM19oVWuFMGxageSiG9Azdp1G/kiKLY1qmfLSg0l I9nowRlqTr5EsA5b9/kwAsSwnAYGIDB6X0tygzSjyT9ubgdp0pr9CTkVH0rjghr75uwK dHToJ1eJlSm63ga6zbqcmwfF8F7gSci/VZ1VYHzjPuo4hjVVaQ1qSQCbNyClzRkEbNaU P0nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718822768; x=1719427568; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IuxLK+Kt4TA0IWlhERRNrzNbAxkSoJre0Y5sVJZCXq0=; b=BHAE/ICX7wpktE34V/IoBoTo+b6b/tOYDlLCHDNDWXKEDxzCd2X7KjidcitNyvYSmX VSs16rsGkxdYiEcPfrT9LJAt+tVbjr30x3pFIJ/dsf32ETJ76J3V0J4ATuZXOtMCAuBC Qgh1RlCyrVHvGqcXpSw1f+S9blZkThWxaA+sqekCxTd2jiE3HiqOVgz2pQmjO4W+M8+K 7Yc7ZNNgy+ZHZrld72azmbLeZscTsva3p0A146pBJgKMUwbBTQnrygkxyWJCLzqfyHak rakj25zPh8XxFaXOZV78f6hgQECHNRQ8Tk7OYKijQj/uc2TyuRDn+30YaJzVIiU5W2RU NhvQ== X-Forwarded-Encrypted: i=1; AJvYcCW4pKucGj2riyFDyCZLR6/4n547EtSwqO/WBisSOJbNGiRJYPphS3zu9QgeBCISU8TJ8x7Yt24vEGMrxTEXX4zfrRHeqz8QZI/S42NJ0wpKx/ULCfs= X-Gm-Message-State: AOJu0YxzTTJHV8mjz/Ifrx0ozd0JRos3RLeXM4fHfAPMtup1SekSAYvU lb08b0LhSQZke/u2RwZnhduNzqwM5XGLdzTRLQB0Q4f1zYyFVQATyvg+WhY/Ufk= X-Google-Smtp-Source: AGHT+IE2yoi8eN59Efp4Zw4hc/t75lfTyLZp0Zgl91poYr5lN48FBw2FLHnhRe8TwdlAiWGWq9mpew== X-Received: by 2002:a2e:9d05:0:b0:2ec:efb:8b66 with SMTP id 38308e7fff4ca-2ec3cfe12acmr21926691fa.53.1718822768357; Wed, 19 Jun 2024 11:46:08 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:dc:7e00:991f:deb8:4c5d:d73d]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36098c8c596sm7594156f8f.14.2024.06.19.11.46.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 11:46:08 -0700 (PDT) From: Bartosz Golaszewski To: Vinod Koul , Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Andrew Lunn , Heiner Kallweit , Russell King Cc: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH net-next 6/8] net: stmmac: provide the link_up() callback Date: Wed, 19 Jun 2024 20:45:47 +0200 Message-ID: <20240619184550.34524-7-brgl@bgdev.pl> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240619184550.34524-1-brgl@bgdev.pl> References: <20240619184550.34524-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_114610_846706_201AB0C4 X-CRM114-Status: GOOD ( 11.18 ) 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: Bartosz Golaszewski Provide drivers with means to react to link-up events in the form of another platform callback. Signed-off-by: Bartosz Golaszewski --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +++ include/linux/stmmac.h | 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 5ddbb0d44373..644bc8a24661 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1006,6 +1006,9 @@ static void stmmac_mac_link_up(struct phylink_config *config, struct stmmac_priv *priv = netdev_priv(to_net_dev(config->dev)); u32 old_ctrl, ctrl; + if (priv->plat->link_up) + priv->plat->link_up(priv->dev, priv->plat->bsp_priv); + if ((priv->plat->flags & STMMAC_FLAG_SERDES_UP_AFTER_PHY_LINKUP) && priv->plat->serdes_powerup) priv->plat->serdes_powerup(priv->dev, priv->plat->bsp_priv); diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 9c54f82901a1..9dc54d6d65ae 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -271,6 +271,7 @@ struct plat_stmmacenet_data { void (*dump_debug_regs)(void *priv); int (*pcs_init)(struct stmmac_priv *priv); void (*pcs_exit)(struct stmmac_priv *priv); + void (*link_up)(struct net_device *ndev, void *priv); struct phylink_pcs *(*select_pcs)(struct stmmac_priv *priv, phy_interface_t interface); void *bsp_priv; From patchwork Wed Jun 19 18:45:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13704449 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 5295CC27C79 for ; Wed, 19 Jun 2024 18:46:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=DQB6Cx2g3Hd80tsoqIkz/xMhmvkJf1bvi8aoKUzsHuk=; b=FkM3oGV1NzCPhM8FPEljmquUpD bBTM8B3bYjrMM5+U52g7jddafbzzxjPwrl7KF1gizGZR6SXEjNsVefEvJ8R+MuudTkq2+G35JQZ8E +mRWXHNkmbLrh4FD965cPBWk+I2ohnhHb+x1Iy6h5RJXmdd6w6MzpgmszgF175zjCyFpd6OH5/QZx KyBiYTfnJM7W5LWjlSU5IMLqY6wFroppSyUkZcd3z5HSk5KyutE0/YqqUXjl51kriD73GilVrlLKI GgLfGM2sf2Be175GgGQIRuVhphvTKzcNlVhh+J8SnJyHDQqvBCOEc0xr/39UM7yxSugIeGPy0CNSx 7FipcOXg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sK0K5-00000002Qdc-3u1K; Wed, 19 Jun 2024 18:46:21 +0000 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sK0Jv-00000002QVE-1tBG for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2024 18:46:12 +0000 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-42172ab4b60so1204065e9.0 for ; Wed, 19 Jun 2024 11:46:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1718822769; x=1719427569; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DQB6Cx2g3Hd80tsoqIkz/xMhmvkJf1bvi8aoKUzsHuk=; b=1mLhl+vRyzcCsiIfXZa48JSVjwf36kauCfeDKEQ2mxvR619tZxZgJhZw5Zw/YpJJAW tS6aWMTUHfkq+G0HGQwsoCmx+s8r849HP+gTVhTdnXKHLxe2Brpf35vyeK+9K9aOlLvD t/ij0OyH0syW2PzNfubGtfytFs6MVA6992ZAs2BFqvOnHcuLBWPKKNL5xKvVhEg8G5me IECscbwlboYsIKv/wBcQRgX6xLXnt0BQ356uPN1q+0aCiQ+uLwtJ7FxKjPfAJb2HX6mi hCydJ+vncquAAflSzrt97DdRCEBWz2Sin1G/FP3WZSbpgq01588deiSqoDSTO3FmQAp8 uiUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718822769; x=1719427569; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DQB6Cx2g3Hd80tsoqIkz/xMhmvkJf1bvi8aoKUzsHuk=; b=Z6Wob0oExiqHbjzE5hMWOBJzP8Pdjjb/WbxCHapB4F3YxWiGmccjvqhD6ESTZZlHFY w4hKBfq0qew1vDLU5ckpHFknMFJ5/ZNJwW3ezmlLlrfmUflhQf6LahsiphL1Q0enKnFT sLvJ3iFUZAs1GHXO8/vWUUh2S3+vvj1F3FFVMBmUBIOg7BNsCn973S5adp6YBTySZNXk ue6wlkRtdPjP7XBqP7Dqn4KrtW2ld19ZMa997yVLSq7OiifTIeXEPYHGer+LWP4h4tXi bN/COgdwgOMv10gb4V4rfbDjJ9kKac1tAYA87X67AHOGGURN9gx5j/Ku9kX4GrJf6pHW gXXA== X-Forwarded-Encrypted: i=1; AJvYcCV0fVMYy8TUsm0TqRkr0VByJNkZhuS8WyxnLBFLuVvsnN0VFo4EvtPH33OboU8cbfwo7XOGW3rQmd6N6w27qcFyHCuOtBHbE/GNd26VkQS983nS6uM= X-Gm-Message-State: AOJu0YygQ/NzHCcWI5OmRxHvHJ2VwX7JI0DyTMrVvMzCsYzL99ES7Tmd IdRS628epP1s+p/09ec08S5CXRTZOVAI5Zx8I0PuD37CmxjIqJJmarAOFMgvij0= X-Google-Smtp-Source: AGHT+IFc10tmtmw3xb52p2cInNEHf/dEPq+PJZ9vw9EtMnLBEOS8Dh29bqwtYNyT87EfbHfTnNwe9A== X-Received: by 2002:a5d:4902:0:b0:35f:2002:3033 with SMTP id ffacd0b85a97d-36317d75626mr2704226f8f.37.1718822769540; Wed, 19 Jun 2024 11:46:09 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:dc:7e00:991f:deb8:4c5d:d73d]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36098c8c596sm7594156f8f.14.2024.06.19.11.46.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 11:46:09 -0700 (PDT) From: Bartosz Golaszewski To: Vinod Koul , Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Andrew Lunn , Heiner Kallweit , Russell King Cc: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH net-next 7/8] net: stmmac: provide the open() callback Date: Wed, 19 Jun 2024 20:45:48 +0200 Message-ID: <20240619184550.34524-8-brgl@bgdev.pl> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240619184550.34524-1-brgl@bgdev.pl> References: <20240619184550.34524-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_114611_518122_EE3CE738 X-CRM114-Status: GOOD ( 12.18 ) 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: Bartosz Golaszewski Provide drivers with means of injecting additional code into the stmmac_open() function. Signed-off-by: Bartosz Golaszewski --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +++ include/linux/stmmac.h | 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 644bc8a24661..5f628176d994 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3953,6 +3953,9 @@ static int __stmmac_open(struct net_device *dev, if (ret < 0) return ret; + if (priv->plat->open) + priv->plat->open(dev, priv->plat->bsp_priv); + if ((!priv->hw->xpcs || xpcs_get_an_mode(priv->hw->xpcs, mode) != DW_AN_C73)) { ret = stmmac_init_phy(dev); diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 9dc54d6d65ae..59991b38cadb 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -262,6 +262,7 @@ struct plat_stmmacenet_data { void (*serdes_powerdown)(struct net_device *ndev, void *priv); void (*speed_mode_2500)(struct net_device *ndev, void *priv); void (*ptp_clk_freq_config)(struct stmmac_priv *priv); + void (*open)(struct net_device *ndev, void *priv); int (*init)(struct platform_device *pdev, void *priv); void (*exit)(struct platform_device *pdev, void *priv); struct mac_device_info *(*setup)(void *priv); From patchwork Wed Jun 19 18:45:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13704448 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 75E69C27C53 for ; Wed, 19 Jun 2024 18:46:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=XpAzXcNNxYpTdvfi+BDU0xCxyu40usRKC5CFcQJxaNM=; b=qN8d0iZts8Dz/emOA3gRATj9I+ 3MjfZx/7vaLyD2z4zSjBILosP3XUQL8BySZZBVYWPl7Lhj5W3IK1SOza4cOCyiArdP5tSG+ClG3pf qhuoC1HaGNmuO+Y71YlaDHIknW4j7H03yPWYGmcX/eTMWLejOSmgVVQEoM595fN4WQOoI40dfrfCY j5U72vN93Kq6yAW9gfqRsyzIrG/twzgN340mIVQfZiWnHIrTInLC3+TbceCefDdWXgl9dVZtQgvLg 8zfkLTTUAUb/rYzYP1oVJ1uI2hdxNU3/kDf9rJ5o4rHi/G6D2qwtJpgco+GWSVOJ+YFTR6KUvQiVV IoClAzZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sK0K8-00000002Qfc-12sy; Wed, 19 Jun 2024 18:46:24 +0000 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sK0Jv-00000002QVn-34q6 for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2024 18:46:13 +0000 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-362f62ae4c5so76192f8f.1 for ; Wed, 19 Jun 2024 11:46:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1718822770; x=1719427570; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XpAzXcNNxYpTdvfi+BDU0xCxyu40usRKC5CFcQJxaNM=; b=sixc0q4AmC9gGqDAjXW4TQs2pWCW6iJGaruS+ndKVvpNT//W7KO2KB6ElqYFG01MUA YpNTkX/saH0uARS5ZTNR/6P8CKk/lI3qERIfiH9BCTDfYYvTuWKn9cTPho0DF7GTMfhC Pc0MsSHsXv9Zv2PCoumf9iOrTSip4eFjpYHbFht53Qm5k6YCYFhBFJEe6N9khdERWXdR qdi95GFZaadNgxlgN3myK9eoOPUB3Enq4bZNB0V2qLokwt+5Tc5WT01DjoRpCq/tbQ8A aK8XLyl9BkxmelzllJ5KHIU65CWzW7KXOBVP4AIqnNLg2RvBB8qWokwOFsHFxXuYP52M ehpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718822770; x=1719427570; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XpAzXcNNxYpTdvfi+BDU0xCxyu40usRKC5CFcQJxaNM=; b=HgMs72LYqcVsZxSMluoEmPKBWaBV7QKt4uN/3VvO8yB8g0eiPhEcwrelC7y7h7gBPy l0MpASRELry5MARwLYwGPSTXFNIKuKFCAgNCc3HiqAqNHV6dvRJPeQ8ZUzluM5iYjEo5 SjVccny53GnHGdqeCN9wnfiS6J9b5y+SvyFggb8ToQV7VaOOCv5Ys4HdmCO4ZRf871/e h9AkoUFuldbVlsPKg8ViKR0wgVEaGTfeEiSz8jqN/edA5Q0H8q9crr4VeSsA7ulTAZ6q ITYtm+GtZfPQOA1Y6Cgo+AFctnJPgnTBQi//bZdvZHTv/UFVR4YH4aXnfsubvNWfAPjf SA/A== X-Forwarded-Encrypted: i=1; AJvYcCUwDvIN3uq+/Q/EALTHQpkaWyHQ/t77cHQr+4t/unkX27e0qSoucM4pCMGYSyUH07YYdYxL2FiZZvKspi20lNnzdZD7iLbr3GBE4KNlu0E844W+tr0= X-Gm-Message-State: AOJu0YwdqOFhkV2Qdjqu15fyWcPcJlLlWW6jqqy3M1YgXVM24OH+lNI+ Rz2GKmnGzLqCqTgUJVVWhNjS7vAwOFhDxWB4OinUC/C0lOcHqv3Gq6xzAoRbCAU= X-Google-Smtp-Source: AGHT+IHjF8mEpNI/gxyJaJmiFPRUJrocPqa3dz8xJy9EQvsllKfjPZWiH68BZOjcdaFrDoZZqxW6IA== X-Received: by 2002:adf:e390:0:b0:363:10cb:45aa with SMTP id ffacd0b85a97d-36310cb4a2bmr3050189f8f.24.1718822770504; Wed, 19 Jun 2024 11:46:10 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:dc:7e00:991f:deb8:4c5d:d73d]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36098c8c596sm7594156f8f.14.2024.06.19.11.46.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 11:46:10 -0700 (PDT) From: Bartosz Golaszewski To: Vinod Koul , Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Andrew Lunn , Heiner Kallweit , Russell King Cc: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH net-next 8/8] net: stmmac: qcom-ethqos: add a DMA-reset quirk for sa8775p-ride-r3 Date: Wed, 19 Jun 2024 20:45:49 +0200 Message-ID: <20240619184550.34524-9-brgl@bgdev.pl> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240619184550.34524-1-brgl@bgdev.pl> References: <20240619184550.34524-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_114611_814031_246DA226 X-CRM114-Status: GOOD ( 15.46 ) 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: Bartosz Golaszewski On sa8775p-ride the RX clocks from the AQR115C PHY are not available at the time of the DMA reset so we need to loop TX clocks to RX and then disable loopback after link-up. Use the provided callbacks to do it for this board. Signed-off-by: Bartosz Golaszewski --- .../stmicro/stmmac/dwmac-qcom-ethqos.c | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index dac91bc72070..ec43449d0252 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -21,6 +21,7 @@ #define RGMII_IO_MACRO_CONFIG2 0x1C #define RGMII_IO_MACRO_DEBUG1 0x20 #define EMAC_SYSTEM_LOW_POWER_DEBUG 0x28 +#define EMAC_WRAPPER_SGMII_PHY_CNTRL1 0xf4 /* RGMII_IO_MACRO_CONFIG fields */ #define RGMII_CONFIG_FUNC_CLK_EN BIT(30) @@ -79,6 +80,9 @@ #define ETHQOS_MAC_CTRL_SPEED_MODE BIT(14) #define ETHQOS_MAC_CTRL_PORT_SEL BIT(15) +/* EMAC_WRAPPER_SGMII_PHY_CNTRL1 bits */ +#define SGMII_PHY_CNTRL1_SGMII_TX_TO_RX_LOOPBACK_EN BIT(3) + #define SGMII_10M_RX_CLK_DVDR 0x31 struct ethqos_emac_por { @@ -678,6 +682,29 @@ static int ethqos_configure(struct qcom_ethqos *ethqos) return ethqos->configure_func(ethqos); } +static void qcom_ethqos_set_serdes_loopback(struct qcom_ethqos *ethqos, + bool enable) +{ + rgmii_updatel(ethqos, + SGMII_PHY_CNTRL1_SGMII_TX_TO_RX_LOOPBACK_EN, + enable ? SGMII_PHY_CNTRL1_SGMII_TX_TO_RX_LOOPBACK_EN : 0, + EMAC_WRAPPER_SGMII_PHY_CNTRL1); +} + +static void qcom_ethqos_open(struct net_device *pdev, void *priv) +{ + struct qcom_ethqos *ethqos = priv; + + qcom_ethqos_set_serdes_loopback(ethqos, true); +} + +static void qcom_ethqos_link_up(struct net_device *ndev, void *priv) +{ + struct qcom_ethqos *ethqos = priv; + + qcom_ethqos_set_serdes_loopback(ethqos, false); +} + static void ethqos_fix_mac_speed(void *priv, unsigned int speed, unsigned int mode) { struct qcom_ethqos *ethqos = priv; @@ -861,6 +888,12 @@ static int qcom_ethqos_probe(struct platform_device *pdev) if (data->dma_addr_width) plat_dat->host_dma_width = data->dma_addr_width; + if (of_device_is_compatible(np, "qcom,sa8775p-ethqos") && + ethqos->phy_mode == PHY_INTERFACE_MODE_OCSGMII) { + plat_dat->open = qcom_ethqos_open; + plat_dat->link_up = qcom_ethqos_link_up; + } + if (ethqos->serdes_phy) { plat_dat->serdes_powerup = qcom_ethqos_serdes_powerup; plat_dat->serdes_powerdown = qcom_ethqos_serdes_powerdown;