Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1439557lqp; Mon, 15 Apr 2024 06:45:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVmrwgFbbFYFn+Ol4o0+B0j/8PusnnSsdBcRNFOu8V02fCzrnG2Al+1BvQhRlFPkJnBJa6gQMBMuMn5EAZO7sMEkCsFgwYvwLeQv1AHHw== X-Google-Smtp-Source: AGHT+IHWOE7XZRvkVlrvK+9CivR7iotqpBjwCbolyHI73cqSpNuRlMKEMBKDpavsS05EptRsNIQ2 X-Received: by 2002:a05:6a21:33a5:b0:1a9:11e6:8e03 with SMTP id yy37-20020a056a2133a500b001a911e68e03mr12745737pzb.40.1713188748712; Mon, 15 Apr 2024 06:45:48 -0700 (PDT) Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id n5-20020a63ee45000000b005e2b0672449si7697691pgk.27.2024.04.15.06.45.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 06:45:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-145280-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@lunn.ch header.s=20171124 header.b=e6xAOPHX; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-145280-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145280-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6535E281617 for ; Mon, 15 Apr 2024 13:43:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A12FC7F7E4; Mon, 15 Apr 2024 13:41:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="e6xAOPHX" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77FD76FE0D; Mon, 15 Apr 2024 13:41:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713188498; cv=none; b=LdRQnuDsizP16QwEobStigf0q0Jcy9r5jqLqT3VVh8VGwvMpDkdqqS7BrssVvCRJy87UpX+YjON25q8UcxPF2SYQiXNdeG/4wqh8e8+bNw+JgugThOWk+OfGtVmJq3HIf8ZcWPlvUIb+48Zy8FxfO0h68T8twXFVfU3y6dgRBw0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713188498; c=relaxed/simple; bh=Ze7Bw+QK8PxSu4QALmqRImY4KEW9tq6PtmBvMgUWpAI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ui4Z0LojJSJFNZZ81TU8lHJmmO78EjLMGmZN/gqOul0uBmHjiJ+KM9HDKYsvs+bWXQjDOU5aSYS7ySGC5ZT7ok4iCe/3Ag0fHouCtxeb1T9ait9lc0b15sz4RTzH2imxbbojuf7sHFBcyyOJJ/Uh2t74Nk8zphxHoQB/18JTIZ0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=e6xAOPHX; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch 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=EHzIPIlvEMFa/Xeg/4PiXPGWOFI3w89WOsdke+JuLoI=; b=e6xAOPHX2IGsvTthzItSh79fgk IJL48VLuZcrMVW7NCuwIzhnjHb2u6oUgRCJDknwJK62XHlZ6f+TYKF6Njrh7imY0UxeMTay8LKXYf FsqUJkDdDRjIhzSW57wjyOs0+5FHNTCiwji0lNzMWNy+zDdblUMs14ymf9SnLF9xk9WI=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1rwMBH-00D2Vj-NX; Mon, 15 Apr 2024 15:15:31 +0200 Date: Mon, 15 Apr 2024 15:15:31 +0200 From: Andrew Lunn To: Parthiban.Veerasooran@microchip.com Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, saeedm@nvidia.com, anthony.l.nguyen@intel.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, corbet@lwn.net, linux-doc@vger.kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, devicetree@vger.kernel.org, Horatiu.Vultur@microchip.com, ruanjinjie@huawei.com, Steen.Hegelund@microchip.com, vladimir.oltean@nxp.com, UNGLinuxDriver@microchip.com, Thorsten.Kummermehr@microchip.com, Pier.Beruto@onsemi.com, Selvamani.Rajagopal@onsemi.com, Nicolas.Ferre@microchip.com, benjamin.bigler@bernformulastudent.ch Subject: Re: [PATCH net-next v3 06/12] net: ethernet: oa_tc6: implement internal PHY initialization Message-ID: <3fc3b5c3-0750-4aff-ab26-240f4bc55236@lunn.ch> References: <20240306085017.21731-1-Parthiban.Veerasooran@microchip.com> <20240306085017.21731-7-Parthiban.Veerasooran@microchip.com> <8c2b95f4-75a7-4d6d-ab9c-9c3498c040d8@lunn.ch> <7ddbe599-187e-401f-b508-4dc62bca8374@lunn.ch> <8de7a4bb-a127-4771-97dd-038f08fcce9d@lunn.ch> <372a45c3-1372-4956-8d42-8e989f86d131@microchip.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, Apr 12, 2024 at 10:43:15AM +0000, Parthiban.Veerasooran@microchip.com wrote: > Hi Andrew, > > After implementing the new APIs oa_tc6_mdiobus_read_c45() and > oa_tc6_mdiobus_write_c45(), I tried testing. But, for some reason these > APIs are never get called by phy_read_mmd() or phy_write_mmd() as those > APIs are checking for phydev->is_c45 flag for calling this new c45 APIs > which is not set in this case. > > If the phydev is found via c22, phylib does not set phydev->is_c45, and > everything ends up going indirect. We don't have a clean separation between C22/C45 register space and C22/C45 MDIO bus protocols. As you said, if the PHY is discovered via C22 bus protocol it assumes it uses C22 protocol. Those PHYs which do support C45, and in particular, features which need C45, all call genphy_c45_pma_read_abilities() in there get_features function to add in C45 features. However, it will continue using C45 over C22 because genphy_c45_pma_read_abilities() only really says the device has C45 registers, not C45 protocol. I can see two different things you can try. 1) set .read_mmd and .write_mmd in the PHY driver to phy_read_mmd() and phy_write_mmd(). That is not great however, since each vendor is likely to have their own PHY driver. 2) Add a helper to set is_c45. This however has side effects you might not want. e.g. auto-neg will be performed via C45, not C22. This might not matter for a T1 PHY where is think auto-neg is not actually used. But i don't see anything in TC6 which limits it to T1, i could well imagine a T2 or T4 PHY being used with full auto-neg. We really do need to separate C45 registers from C45 protocol in the phylib core to cleanly solve this. Andrew