Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp4801612rwb; Tue, 17 Jan 2023 05:48:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXvELDQFQe42XVrRTjOownn5NkcTMx1r/UJcmsPQDNjlv15JgbT/TQlysnYFbgx4N5FEOBJ6 X-Received: by 2002:a05:6a20:8f0f:b0:ac:9d6b:c1f0 with SMTP id b15-20020a056a208f0f00b000ac9d6bc1f0mr4483668pzk.40.1673963319840; Tue, 17 Jan 2023 05:48:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673963319; cv=none; d=google.com; s=arc-20160816; b=XtnDhJFvbQO5aWVjdUsPZyDxXyELlGeYYT3QBaXGneQCHnCdVVVHMD4p0YxSBUUijV DZT3kcfMD0JTRkRDf+xoiWQdDOFCIh0QUlytdI/YF1adDt+qR/H4Y68TM2ZOShuCBDFx 7z7DhOtTxeG0NlSb1EXrpORYL6DHkUDoGXDUKJE76YnglisrBsUJ5bMbv1BxNPfi9y6r 9FAlGCzM5hObCPO2x8TwP64bxPmdmyMeos4lgPEId9gJrtRfsF6Wkwr+G5rGrc1RjPcx p/QfDxlPHkAzdHfyMj0klqc96aY5Mkn0RyK2s4sbHjz2RDll50lGHRRgY++k30LVUaee 0TZQ== 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=xrKKSOUVv+ASQt80kkC00NPCfhX4yZY0bkCCioafhDo=; b=Ci1vtMZC6dgOn3zaOfBcI8f30un/7q1Ndh81sY80RT5d89wOHYR8rDI+I4BTv44b7Y RF2P29acydRPQ7jxhD+HHwc0lMVTjS4DTtC2itjA/wu0s85DewvpOLSK4ZJ3HZuowRrx 8pdNVq1ahgv/IfUpbzX9poyv5f2ICOg1fkxi9ofsboICb1Bu2QgxZhvlRDsFgKY0WZe4 HJebszin/tJuv6psw9Si9s6wpXcE9j+oNcK0YsapFXDALrFBo+gAZUHoC1Z0QU7wbZOj oTAiffBi9gx6cpRdbRXq7tfXDJ5q2RYXiFGP4YTefw7XUoY0gNYVqqt0eqGxSqBNoZ9y vxsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=E5vu2qbO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k133-20020a636f8b000000b004ba3656506csi18604968pgc.559.2023.01.17.05.48.32; Tue, 17 Jan 2023 05:48:39 -0800 (PST) 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=E5vu2qbO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229765AbjAQNk4 (ORCPT + 50 others); Tue, 17 Jan 2023 08:40:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229667AbjAQNkx (ORCPT ); Tue, 17 Jan 2023 08:40:53 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CBE912F3F; Tue, 17 Jan 2023 05:40:52 -0800 (PST) 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=xrKKSOUVv+ASQt80kkC00NPCfhX4yZY0bkCCioafhDo=; b=E5vu2qbO2KcNLImk/PiS3FEh6J xpMeJGl7nExRkdFy6cJyubOwiZzWioi2jRzWE0khHLUdxjmJc0/UReSvxmN9H2cMW2O6XpD44OMdX T2mUn8YKXhF1sqm4LIem76swhy+3l+pwxcYVIGyVoXTqSEpSF2MrHDfhDMAOM01oh4B4=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1pHmCd-002KFX-Jd; Tue, 17 Jan 2023 14:40:39 +0100 Date: Tue, 17 Jan 2023 14:40:39 +0100 From: Andrew Lunn To: Lars-Peter Clausen Cc: Pierluigi Passaro , hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, eran.m@variscite.com, nate.d@variscite.com, francesco.f@variscite.com, pierluigi.p@variscite.com Subject: Re: [PATCH] net: mdio: force deassert MDIO reset signal Message-ID: References: <20230115161006.16431-1-pierluigi.p@variscite.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 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 > > So compatible "ethernet-phy-ieee802.3-c45" results in is_c45 being set > > true. The if (is_c45 || is then true, so it does not need to call > > fwnode_get_phy_id(child, &phy_id) so ignores whatever ID is in DT and > > asks the PHY. > > > > Try this, totally untested: > > > > diff --git a/drivers/net/mdio/fwnode_mdio.c b/drivers/net/mdio/fwnode_mdio.c > > index b782c35c4ac1..13be23f8ac97 100644 > > --- a/drivers/net/mdio/fwnode_mdio.c > > +++ b/drivers/net/mdio/fwnode_mdio.c > > @@ -134,10 +134,10 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus, > > if (rc >= 0) > > is_c45 = true; > > - if (is_c45 || fwnode_get_phy_id(child, &phy_id)) > > + if (fwnode_get_phy_id (child, &phy_id)) > > phy = get_phy_device(bus, addr, is_c45); > > else > > - phy = phy_device_create(bus, addr, phy_id, 0, NULL); > > + phy = phy_device_create(bus, addr, phy_id, is_c45, NULL); > > if (IS_ERR(phy)) { > > rc = PTR_ERR(phy); > > goto clean_mii_ts; > > > I think part of the problem is that for C45 there are a few other fields > that get populated by the ID detection, such as devices_in_package and > mmds_present. Is this something we can do after running the PHY drivers > probe function? Or is it too late at that point? As i hinted, it needs somebody to actually debug this and figure out why it does not work. I think what i did above is part of the solution. You need to actually read the ID from the DT, which if you never call fwnode_get_phy_id() you never do. You then need to look at phy_bus_match() and probably remove the return 0; } else { so that C22 style ID matching is performed if matching via c45_ids.device_ids fails. Andrew