Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2500002rwb; Sun, 15 Jan 2023 16:54:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXvyxnFY1VEOeiNfQNK04ciJ77wDLejRUAYVK0WyesHh88jrChaR+X0aLAQQB0my79zCneGK X-Received: by 2002:a17:903:445:b0:189:5f5c:da1e with SMTP id iw5-20020a170903044500b001895f5cda1emr18476235plb.27.1673830446684; Sun, 15 Jan 2023 16:54:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673830446; cv=none; d=google.com; s=arc-20160816; b=f0hhDATkezxEAeB0reJxtuvdZIWR5iOzi1mgWCM6g+95/rOeSKnNDFork3hdLSlAuO pE0m4Tu8vJuaw64obYXns692huvx3+JDjJl+d2g25JMPIKVoL8Hg3fiZ814bxoX5NaVv SGgA5y4b1orn47kHzQ8EiAp/irGpyB684uD15FhaXaXulx0tQQS9MLeRu4/4mp1Wm+7V /tZJbIruFZR5MmuNTjwKT/3i2ARJUYqbAHVszWHNp374zhcez3vKCld0tQTBB4Roxkmh W6ICikTqeHeitf5+pci8xKzJ6vqsdIF+QFO67fsFN82jmD27NToWk+sgfljBGHCD36F/ Drwg== 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=KEKWkIhhEZt9rbel/ZFoLJLRSd3AM63WjSh8z/u1y6I=; b=dQCSNhkLwkuJXL4W2xIIRA2ACB3yQFUHvvq9yb0LDpOQQ9wJ1bT6Pqojsrk5zgJaxN OJ2XtTibrCj4GItASHtfysOWnYJK0H9RzWVSe+gMxlHuBYrZys8VdiRSt2dyMs1KAszv 8HatZTaHN+3/xwwspBDqq4UBN8GRdr1cYWpnbCDfXY9bdGo7w29WP9nOliuiCLGhM4vC xv0YhspcpbZndN4LcXbqfNQBGwxA/t2UAI/Mx+NIdseaQRPcA3NZyfvqeSrXXg5wueXb 9E9sTQbP+wIKGRf4ri2y9oU1qKm3uYNjOYBmNJl2dKzLyxoNzWpH/BBdedwok5dnhnAt Bhfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b="1/NPADqQ"; 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 k14-20020a170902ce0e00b00176e4ac448esi27663621plg.224.2023.01.15.16.54.00; Sun, 15 Jan 2023 16:54:06 -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="1/NPADqQ"; 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 S231723AbjAPABb (ORCPT + 52 others); Sun, 15 Jan 2023 19:01:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231706AbjAPAB0 (ORCPT ); Sun, 15 Jan 2023 19:01:26 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1714F12F0D; Sun, 15 Jan 2023 16:01:26 -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=KEKWkIhhEZt9rbel/ZFoLJLRSd3AM63WjSh8z/u1y6I=; b=1/NPADqQNItR4p4fkcOk24w3h1 q66wDMD98iLQc0XVfnOCmmaBchPJJWjjxqmy3dbigAc14yh9GPyL4e1R+Io9zBqhEsnVzu3av/jnu r5aWxduK3EFlAVXlo3Hf/ePr8K/44nLqDqbwAPmgU4peF+aWx0gKHr04zmpZ4Fr78GgQ=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1pHCwB-002A7h-4V; Mon, 16 Jan 2023 01:01:19 +0100 Date: Mon, 16 Jan 2023 01:01:19 +0100 From: Andrew Lunn To: Pierluigi Passaro Cc: Pierluigi Passaro , wei.fang@nxp.com, shenwei.wang@nxp.com, xiaoning.wang@nxp.com, linux-imx@nxp.com, 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 Subject: Re: [PATCH v2] net: fec: manage corner deferred probe condition Message-ID: References: <20230115213804.26650-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 On Sun, Jan 15, 2023 at 11:23:51PM +0100, Pierluigi Passaro wrote: > On Sun, Jan 15, 2023 at 10:56 PM Andrew Lunn wrote: > > On Sun, Jan 15, 2023 at 10:38:04PM +0100, Pierluigi Passaro wrote: > > > For dual fec interfaces, external phys can only be configured by fec0. > > > When the function of_mdiobus_register return -EPROBE_DEFER, the driver > > > is lately called to manage fec1, which wrongly register its mii_bus as > > > fec0_mii_bus. > > > When fec0 retry the probe, the previous assignement prevent the MDIO bus > > > registration. > > > Use a static boolean to trace the orginal MDIO bus deferred probe and > > > prevent further registrations until the fec0 registration completed > > > succesfully. > > > > The real problem here seems to be that fep->dev_id is not > > deterministic. I think a better fix would be to make the mdio bus name > > deterministic. Use pdev->id instead of fep->dev_id + 1. That is what > > most mdiobus drivers use. > > > Actually, the sequence is deterministic, fec0 and then fec1, > but sometimes the GPIO of fec0 is not yet available. > The EPROBE_DEFER does not prevent the second instance from being probed. > This is the origin of the problem. Maybe i understood you wrongly, but it sounds like the second instance takes the name space of the first? And when the first probes for the second time, the name space is taken and the registration fails? To me, this is indeterminate behaviour, the name fec0_mii_bus is not determinate. Andrew