Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp4643025rwb; Tue, 8 Aug 2023 11:23:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEVoJ8GU6wmBOw4ugs/KWWi0twUf8MXtdbgMlJdPZOl0nt4tzctLfh29qqO56GiMXXA5IUw X-Received: by 2002:a17:90a:ff11:b0:268:1376:d501 with SMTP id ce17-20020a17090aff1100b002681376d501mr387211pjb.5.1691518988671; Tue, 08 Aug 2023 11:23:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691518988; cv=none; d=google.com; s=arc-20160816; b=YnodT8anFaIW/hnw+CoCVjmM4p46Ut4BUoPSCi04yymkmAkDzqPAK/VAs25ySLnM8o 2JGx9/zcOCfpLPsva5s3NU94CDCm9u/aRCL9xZGrUEr7CdVE3A8yyx9uPdb6C0U5AcGs l+sFWzXAUbT57P3eqOCGEC552x/JmjsfP8popbBfGOd4FsZcTqGG4jOejlNp/3EzSZcX rrGvL9cy9O+HmemLUwBmplOADiAnZZQf8FnSWY1Vw78+bubCjmRShIZfJ6VLExCASynd lp8OTQIgPpk1arvb2Q2uJ13kMmLVolqlFhJk75bjrBbXt19zWWW0oEa1Gcf8rSv52zrv AmDg== 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=1eMz8Kx1EHbpbcwhOQKyLVqRjaGKTaNj4sW/uynWnl8=; fh=nI3b4SlJdz3Junwgb1a7zmtwOCWnveCjWRHUGNK0fMk=; b=06VjxPOwCm95iA1rus1PLwRHqwkpRPY8NTGkZQxxwage/c6PXThIsK+CD9sjEa0bn3 DSrNPrtCUG0XG9k7IAmhE0gG2qYZfQlxgTWCi8zixWlVfnCGmBq8be+4nNRSTatDto28 H8fpg3LRfA120chIg+mO4Iuc8TY4QyjA4vU+j+79jMpq8umijNIUOfGEgEddcUX7Cqpn 2LHbRT/M5yG82avC/CLStWmt/u8OIB8OVIvhHY0MIAqQWd+775hUMNQzKwGtUzw4vo3x uqvOpEvmZ5udQRDevFMacWOHHqXDyaeKuUqXFbEXzF767vr3w1J1wQeZ18Qq3N3v8ChG SStw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=nejMPi3V; 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 q12-20020a170903204c00b001bbb8a61d3dsi4711715pla.562.2023.08.08.11.22.57; Tue, 08 Aug 2023 11:23:08 -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=nejMPi3V; 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 S235250AbjHHSHo (ORCPT + 99 others); Tue, 8 Aug 2023 14:07:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235396AbjHHSHM (ORCPT ); Tue, 8 Aug 2023 14:07:12 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 151A861B2F; Tue, 8 Aug 2023 10:07:32 -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=1eMz8Kx1EHbpbcwhOQKyLVqRjaGKTaNj4sW/uynWnl8=; b=nejMPi3VM7ofMENIN8bhAEJL07 R1JLkq+Z0e+Vvd3amNjdds5KLa/IkvIBpX/KZhrsGzbSHj/Jpm8DHhBojZxbdLdU2XbGa8Ca9S0Cs WFv1W+lkAfog6/kxtpgQlcebGAxCSMz4Gni1CCitszWFXF4f8IxW2G0nJ4D4I9d5w4tw=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1qTNeM-003TSm-VY; Tue, 08 Aug 2023 16:25:30 +0200 Date: Tue, 8 Aug 2023 16:25:30 +0200 From: Andrew Lunn To: Bartosz Golaszewski Cc: "Russell King (Oracle)" , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Andrew Halaney , Alex Elder , Srini Kandagatla , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Bartosz Golaszewski Subject: Re: [PATCH 0/2] net: stmmac: allow sharing MDIO lines Message-ID: <65b53003-23cf-40fa-b9d7-f0dbb45a4cb2@lunn.ch> References: <20230807193102.6374-1-brgl@bgdev.pl> <54421791-75fa-4ed3-8432-e21184556cde@lunn.ch> 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,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED 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 Tue, Aug 08, 2023 at 10:13:09AM +0200, Bartosz Golaszewski wrote: > > > Ok so upon some further investigation, the actual culprit is in stmmac > > > platform code - it always tries to register an MDIO bus - independent > > > of whether there is an actual mdio child node - unless the MAC is > > > marked explicitly as having a fixed-link. > > > > > > When I fixed that, MAC1's probe is correctly deferred until MAC0 has > > > created the MDIO bus. > > > > > > Even so, isn't it useful to actually reference the shared MDIO bus in some way? > > > > > > If the schematics look something like this: > > > > > > -------- ------- > > > | MAC0 |--MDIO-----| PHY | > > > -------- | | ------- > > > | | > > > -------- | | ------- > > > | MAC1 |-- ----| PHY | > > > -------- ------- > > > > > > Then it would make sense to model it on the device tree? > > > > So I think what you're saying is that MAC0 and MAC1's have MDIO bus > > masters, and the hardware designer decided to tie both together to > > a single set of clock and data lines, which then go to two PHYs. > > The schematics I have are not very clear on that, but now that you > mention this, it's most likely the case. I hope not. That would be very broken. As Russell pointed out, MDIO is not multi-master. You need to check with the hardware designer if the schematics are not clear. > Good point, but it's worse than that: when MAC0 is unbound, it will > unregister the MDIO bus and destroy all PHY devices. These are not > refcounted so they will literally go from under MAC1. Not sure how > this can be dealt with? unbinding is not a normal operation. So i would just live with it, and if root decides to shoot herself in the foot, that is her choice. Andrew