From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C7C2C3DA78 for ; Mon, 16 Jan 2023 00:01:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231714AbjAPAB2 (ORCPT ); Sun, 15 Jan 2023 19:01:28 -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: Precedence: bulk List-ID: X-Mailing-List: netdev@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