Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp1258315rdf; Sat, 4 Nov 2023 12:39:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFizagsBMedEeptYaxUY4o1kcramt0oi9vpY2nZ6sJnpwWS54MLmD42y7Hj+9OmSu13lIBy X-Received: by 2002:a05:6a20:734f:b0:12e:4d86:c017 with SMTP id v15-20020a056a20734f00b0012e4d86c017mr29043287pzc.10.1699126746021; Sat, 04 Nov 2023 12:39:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699126746; cv=none; d=google.com; s=arc-20160816; b=UuJqEMXY9kVRVoJ70xJCat7aofnMYbDqDYLpbXWjYI4wy4KXXgRJBR8yILDPJjTguT V/IunYTnVyu6PbMtJQE16v9Xwmj8YFA4E9wJAhXNWcKJyZ2o/xgESkBkbOfZWhTwuu0l InuD/pw6TEsgb6y8aYuQ30uAktPrQVf2ThYwXehAdDZeedfaQBRVts6bqj7swc/Ud5Wl 6vLOntbyf1Kd3hmkt2fvcezNIwsupeqTwLr04NK2kPKNcEwHjeX+aqXcjRLmWfn4q9Ym R7X3ueoEfPLCI5jT1i/jrH8NwMs/GVzz+UOCg766wO1Mci0R6eVi6//P/X/ZYMO/oDxK IWDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=YDdZpyV4rBTcY/SQHR710W7PYNxHIXtIFLliRXNGxTk=; fh=BJOxn7PaDBQMkdoUZwx3280F25DeBtc9xlL6eCtJtjA=; b=b89QNoUEnxF0lZ7AaWXEJ8xFC8zpnoP7xmS4SGpp4GZvNPuynvtt2Y8a5LhoqRnSVS 1iEY7WitzLNy7anM6cVryJ3OwtrBMYLcVKM1r4/0X5adsytPaxyvFet9DNyKI46/+TKs ZngR/DBoHhAdbHbsNTNYjMxJESsDemEk71mrwGoTFZQ5OMURJtH3PBjUIFCqvWKsxDNE zkaaNrIVEPjZUOW5CwTVim22KwqqO6+YokEruEQYhfrYiESUmyCN6u0ZaKQLrPR0SdFv 3SU0K2S7RpnmDNl96+uIaadlXfIM8Dsch3XUWcy+Ilr1RNc4zuGEPEcbXmzPXFWT/kYJ MzfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=ZqJsEIfh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id bw42-20020a056a0204aa00b005b92f57afe7si4711619pgb.641.2023.11.04.12.39.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Nov 2023 12:39:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=ZqJsEIfh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 356688062DE8; Sat, 4 Nov 2023 12:39:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229735AbjKDTfu (ORCPT + 99 others); Sat, 4 Nov 2023 15:35:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229533AbjKDTft (ORCPT ); Sat, 4 Nov 2023 15:35:49 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C0B7194; Sat, 4 Nov 2023 12:35:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=YDdZpyV4rBTcY/SQHR710W7PYNxHIXtIFLliRXNGxTk=; b=ZqJsEIfhRjAeEcU6uK4McjbleV GrzIJ2KeztdvLxMqay3XLapZUbW9H2HbDQPHpgxbUs2GzK8VPBNccMQn3p6AwSoNbaf58Xlyz5jq/ 5pr4Vu2xBemAbEAPRee1atdaGJrdWRR/WjC7nZRj6tap7mHgOSWmM0uhbkAdtDWl/ayNwqGIngZwg bwWjt/YJwr8kCWyxUrtv3KtJp4DP4x7jdzjGP4YLqcKsPCMk2wsc6j9wtjIgjZdKdn/83ZK8Zzeke a8G2HMmGKRQgG/Oy0b/ZYvluLJWz0nPQSr7gSyyycWFLHIK9nAuWdvBa3dKv9ETXnrTqlHin9eRCA 2EAjgquw==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:42578) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qzMQf-0006ZZ-1C; Sat, 04 Nov 2023 19:35:33 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1qzMQf-00048X-5m; Sat, 04 Nov 2023 19:35:33 +0000 Date: Sat, 4 Nov 2023 19:35:32 +0000 From: "Russell King (Oracle)" To: Luo Jie Cc: andrew@lunn.ch, hkallweit1@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: phy: at803x: add QCA8084 ethernet phy support Message-ID: References: <20231103123538.15735-1-quic_luoj@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231103123538.15735-1-quic_luoj@quicinc.com> Sender: Russell King (Oracle) X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sat, 04 Nov 2023 12:39:03 -0700 (PDT) On Fri, Nov 03, 2023 at 08:35:37PM +0800, Luo Jie wrote: > Add qca8084 PHY support, which is four-port PHY with maximum > link capability 2.5G, the features of each port is almost same > as QCA8081 and slave seed config is not needed. > > There are some initialization configurations needed. > 1. Configuring qca8084 related initializations including > MSE detect threshold and ADC clock edge invert. > 2. Add the additional configurations for the CDT feature. > > Signed-off-by: Luo Jie > --- > drivers/net/phy/at803x.c | 40 +++++++++++++++++++++++++++++++++++++--- > 1 file changed, 37 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c > index 37fb033e1c29..4124eb76d835 100644 > --- a/drivers/net/phy/at803x.c > +++ b/drivers/net/phy/at803x.c > @@ -176,6 +176,8 @@ > #define AT8030_PHY_ID_MASK 0xffffffef > > #define QCA8081_PHY_ID 0x004dd101 > +#define QCA8081_PHY_MASK 0xffffff00 > +#define QCA8084_PHY_ID 0x004dd180 ... > @@ -2207,8 +2240,9 @@ static struct phy_driver at803x_driver[] = { > .resume = qca83xx_resume, > }, { > /* Qualcomm QCA8081 */ > - PHY_ID_MATCH_EXACT(QCA8081_PHY_ID), > - .name = "Qualcomm QCA8081", > + .phy_id = QCA8081_PHY_ID, > + .phy_id_mask = QCA8081_PHY_MASK, > + .name = "Qualcomm QCA808X", ... > @@ -2241,7 +2275,7 @@ static struct mdio_device_id __maybe_unused atheros_tbl[] = { > { PHY_ID_MATCH_EXACT(QCA8327_A_PHY_ID) }, > { PHY_ID_MATCH_EXACT(QCA8327_B_PHY_ID) }, > { PHY_ID_MATCH_EXACT(QCA9561_PHY_ID) }, > - { PHY_ID_MATCH_EXACT(QCA8081_PHY_ID) }, > + { QCA8081_PHY_ID, QCA8081_PHY_MASK}, So, in summary from the above, what you're doing is using the pair of QCA8081_PHY_ID, QCA8081_PHY_MASK to match not only QCA8081 but also QCA8084. This is confusing. Are there any other parts that QCA808X would correspond with which would not be compatible with the above? E.g. QCA8082, QCA8083, QCA8088 etc. If there are, then the correct approach would be to list them separately in atheros_tbl, and also have separate driver entries in at803x_driver so it's unambiguous. If we keep this approach, then I would suggest: #define QCA808X_PHY_ID 0x004dd100 #define QCA808X_PHY_MASK GENMASK(31, 8) to make it explicit that this phy ID/mask pair is matching several devices, rather than re-using the QCA8081_PHY_ID definition. The next point - what about the revision field which occupies bits 3:0 in these: > static bool qca808x_has_fast_retrain_or_slave_seed(struct phy_device *phydev) > { > + if (phydev->phy_id == QCA8084_PHY_ID) > + return false; > + ... > @@ -1767,6 +1781,20 @@ static int qca808x_config_init(struct phy_device *phydev) > { > int ret; > > + if (phydev->phy_id == QCA8084_PHY_ID) { > + /* Invert ADC clock edge */ ... > @@ -1958,6 +1986,11 @@ static int qca808x_cable_test_start(struct phy_device *phydev) > phy_write_mmd(phydev, MDIO_MMD_PCS, 0x807a, 0xc060); > phy_write_mmd(phydev, MDIO_MMD_PCS, 0x807e, 0xb060); > > + if (phydev->phy_id == QCA8084_PHY_ID) { Do these need to be exact matches, or should the revision field be ignored? If so, consider using phy_id_compare(), or if you end up with separate driver entries, consider using phydev_id_compare(). Thanks. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!