Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1278657pxb; Thu, 24 Mar 2022 16:45:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwK8rKLyoz2dWcQpQtJlwcufy1B3Tju881bI8C6otB480kIGig3hZ9o0mzSbCrqQSQHJUNt X-Received: by 2002:a63:4e0d:0:b0:381:4606:ec9e with SMTP id c13-20020a634e0d000000b003814606ec9emr5828320pgb.345.1648165503506; Thu, 24 Mar 2022 16:45:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648165503; cv=none; d=google.com; s=arc-20160816; b=OhHMSJ4m6DsP0g138EARafn3PQdlB6t3Bq4JiCVi3mJWtNVbvvOl9jdWpWTNMZftgV oAvw+HSVaqN3i5LUURJS9Elu4QR5o5JGI9XJ82Odlw1m3mYGbAt31vYXHuqIsT4eWH9T RiBQSnzHX20vBh0sLTvnfJ6b7kTe86Jhp4DuAzRAo3r2To4/b6VC3H6Gi+1BFz4D86/d 1lGEcXT3qVyGGqopPnu5tq+JVoJWNV5iavUqYYW3Nh69WBpLg2NF84H7NAbVEqfWWFnc 5chhF1Qm50U6X1zppZU3Qi2yWI/KDgH14CPixuDSc+/s1QH5l5dPpyc8u5PgiOah9lfi ggzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=pyn2uk6hP/JZdZoC6sjuiFzoIRCFMcZz+lk7gUqAIQ8=; b=GD+sf3v/qymG55sgMAqlXZTW/ohvX6H1p8yDl6I9s66ZB2hAwFxBOIau/uHc7gGNGe iPq7b30rWenWinZxl1q4voBW+LMlllm+skHdaJFFW/fCNsQGrGOIT05LcCfuwpxSoFxT moVQRoOb9wMxuIb2lambDUwO310etrW/LyYcnzIe8/cdsHG35Rkxj8L7ITOg95TunRN2 VVzl07aQuud5dthKumi5vOP8o1kr3Aumim6Jl45m7x7fQji3IftoAErSJ5KE9MB90dTc c5dw0LPqSB8LOT+dqGN3cTvhbnTYfynoHA5vPEP22gltvwp2wvo6ZxplrU/yeIrkfYJQ YGaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=y1S0yMfa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s22-20020a170902989600b00153b2d16553si648449plp.347.2022.03.24.16.44.49; Thu, 24 Mar 2022 16:45:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=y1S0yMfa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344049AbiCWUJA (ORCPT + 99 others); Wed, 23 Mar 2022 16:09:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239934AbiCWUI7 (ORCPT ); Wed, 23 Mar 2022 16:08:59 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27F7385659; Wed, 23 Mar 2022 13:07:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=pyn2uk6hP/JZdZoC6sjuiFzoIRCFMcZz+lk7gUqAIQ8=; b=y1S0yMfayT0AsXhV77kRxe2Mjw wae+OJHLzDoysrWCDvY5BE6oJoECoZfmYZhY0B17FjBQ1iC31lUKuSqO9zEwR1mUA/DpHGqOgj1eQ +75SN+DgjGcmeXFctJwJncr7lI2bLnnvu8exZi4rgymCIisWX5pD5MNp96Ic8mRAS2Pk=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1nX7GI-00CKrc-Si; Wed, 23 Mar 2022 21:07:18 +0100 Date: Wed, 23 Mar 2022 21:07:18 +0100 From: Andrew Lunn To: Michael Walle Cc: Heiner Kallweit , Russell King , Jakub Kicinski , Paolo Abeni , "David S . Miller" , Xu Liang , Alexandre Belloni , Florian Fainelli , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC net-next 4/5] net: phy: introduce is_c45_over_c22 flag Message-ID: References: <20220323183419.2278676-1-michael@walle.cc> <20220323183419.2278676-5-michael@walle.cc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220323183419.2278676-5-michael@walle.cc> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 23, 2022 at 07:34:18PM +0100, Michael Walle wrote: > The GPY215 driver supports indirect accesses to c45 over the c22 > registers. In its probe function phy_get_c45_ids() is called and the > author descibed their use case as follows: > > The problem comes from condition "phydev->c45_ids.mmds_present & > MDIO_DEVS_AN". > > Our product supports both C22 and C45. > > In the real system, we found C22 was used by customers (with indirect > access to C45 registers when necessary). > > So it is pretty clear that the intention was to have a method to use the > c45 features over a c22-only MDIO bus. The purpose of calling > phy_get_c45_ids() is to populate the .c45_ids for a PHY which wasn't > probed as a c45 one. Thus, first rename the phy_get_c45_ids() function > to reflect its actual meaning and second, add a new flag which indicates > that this is actually a c45 PHY but behind a c22 bus. The latter is > important for phylink because phylink will treat c45 in a special way by > checking the .is_c45 property. But in our case this isn't set. Thinking out loud... 1) We have a C22 only bus. Easy, C45 over C22 should be used. 2) We have a C45 only bus. Easy, C45 should be used, and it will of probed that way. 3) We have a C22 and C45 bus, but MDIOBUS_NO_CAP. It will probe C22, but ideally we want to swap to C45. 4) We have a C22 and C45 bus, MDIOBUS_C22_C45. It will probe C22, but ideally we want to swap to C45. > @@ -99,7 +99,7 @@ static int gpy_probe(struct phy_device *phydev) > int ret; > > if (!phydev->is_c45) { > - ret = phy_get_c45_ids(phydev); > + ret = phy_get_c45_ids_by_c22(phydev); > if (ret < 0) > return ret; > } If we are inside the if, we know we probed C22. We have to achieve two things: 1) Get the c45 ids, 2) Figure out if C45 works, or if C45 over C22 is needed. I don't see how we are getting this second bit of information, if we are explicitly using c45 over c22. This _by_c22 is also making me think of the previous patch, where we look at the bus capabilities. We are explicitly saying here was want c45 over c22, and the PHY driver should know the PHY is capable of it. So we don't need to look at the capabilities, just do it. Andrew