Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp4735071rwb; Tue, 8 Aug 2023 13:01:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGqm/DtF0treCX6lqidHo9z+97dJiwJ2InwNvATBMgYSvJXloOsPnYRWiNKsTy7TtFlq6gM X-Received: by 2002:a17:902:9697:b0:1bc:7c8b:5f0d with SMTP id n23-20020a170902969700b001bc7c8b5f0dmr758422plp.3.1691524866995; Tue, 08 Aug 2023 13:01:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691524866; cv=none; d=google.com; s=arc-20160816; b=hwF+6/xDDFBkd5b7rdH4R1RromkBjBJfPR+RFySzC5YymQAY3zBPUkSgu+UnmvSltA W58n4vCCxE7omtkzD7N+gnZnZafstRKUXcwJd5OmztW9h3Vgu0VhLB4jXvzyHCOduNQg sJjL+Pn7Wu3U8+z99kKOMPE4ZJBfNl8qLPHzHcapAwGBRMikL4tPg+523PPTPxohBhdg 5T+yE+HnuPTE5H5OU9w5AUhNMoMLEchEdJWSfLAqFouw74M4Uj/M1338biEJwcwMAlp3 ZcKU4r/9d66c0uGfs416ro0T9MIQsJunA/Liv4XzxBQDrQq5mfAGT6r3/ShRt8T/jN8v XDGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=TONQWGBEefR53xCwNIMqBbfwJkoHzB+BW3pjEzAo/Vk=; fh=o53WsX3EoK5eGRPS6fgK0RxIdtGT9DBxq3U8EBKg5z8=; b=nKD56Dakd7KsiqbJ9hE8dykRk1kHrET+OByCmyZcLZcn7NjbwrhgeqX8YjM0bmrPOY x5E/8VTo+/lasG9wYA2qP/0aU3OFZqKoQNpv3R5P8L7sSf4J05DnDn8mfF8Y/RdhD7ly sdEnr36GTj+qgeRXooASI09NXKeHFLDfLLclOotobxNqo2XtrZWGKuZ1+6quXaX/lblh mXBmJNA7J2Zt1ByIkkgitwA925fIWHkA4pIQBM+s4uRM3G8+mSunK6buZhqPGzmf2iJ4 37eQFweeqiT/t3eaFfxBFLSlXmFp8E8rVrj66oKkKJ6FeEXLW17xizWqGCpuj2qTq8hT If+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=Q5Mw52YT; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c10-20020a170903234a00b001b89b63b877si7878527plh.446.2023.08.08.13.00.54; Tue, 08 Aug 2023 13:01:06 -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=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=Q5Mw52YT; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235675AbjHHT0T (ORCPT + 99 others); Tue, 8 Aug 2023 15:26:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234239AbjHHTZz (ORCPT ); Tue, 8 Aug 2023 15:25:55 -0400 Received: from pandora.armlinux.org.uk (unknown [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE70B80BD; Tue, 8 Aug 2023 11:50:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=TONQWGBEefR53xCwNIMqBbfwJkoHzB+BW3pjEzAo/Vk=; b=Q5Mw52YTP2WyavImCS6k7amT0W ruy8Pus8OBffBbQ8/CgYtJD0ZV11Fj+/f4kIj3dKJkbRYTU2+XNBkmlbUJmWQ8UJpidfHO1P9AC8v gv5TeBrL2JBmgbXN2KEmHy9mBzxoLrL9hxcz/aaKIIjIP0flNOIAupgt4w8NvxYuKAAdk76MGO5G0 TIWAYziNRfQj38Uuf8JG0FY8Hiyo6cWhw9npHZsgtejfaoa4NresaJyvrzUoyLv+yky01EeywoZDN NDEFGKezpRxCpRW0EnhoXrRmiLUw6aeDmtogJQVCuiy8cDlMAwfqZvW0/YLBKLfeDwJMeSgkS0FEk 3P5szoTw==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:51866) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qTMjH-0007zl-33; Tue, 08 Aug 2023 14:26:31 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1qTMjF-00088c-F4; Tue, 08 Aug 2023 14:26:29 +0100 Date: Tue, 8 Aug 2023 14:26:29 +0100 From: "Russell King (Oracle)" To: Bartosz Golaszewski Cc: Andrew Lunn , "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: References: <20230807193102.6374-1-brgl@bgdev.pl> <54421791-75fa-4ed3-8432-e21184556cde@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: Russell King (Oracle) X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,RDNS_NONE, SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=no 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. In that case, I would strongly advise only registering one MDIO bus, and avoid registering the second one - thereby preventing any issues caused by both MDIO bus masters trying to talk at the same time. The PHYs should be populated in firmware on just one of the buses. You will also need to ensure that whatever registers the bus does make sure that the clocks necessary for communicating on the bus are under control of the MDIO bus code and not the ethernet MAC code. We've run into problems in the past where this has not been the case, and it means - taking your example above - that when MAC1 wants to talk to its PHY, if MAC0 isn't alive it can't. So just be aware of the clocking situation and make sure that your MDIO bus code is managing the clocks necessary for the MDIO bus master to work. In regard to sharing of the MDIO bus signals between two bus masters, I do not believe that is permissible - there's no collision detection in hardware like there is on I?C. So having two MDIO bus masters talking at the same time would end up corrupting the MDC (clock) and MDIO (data) signals if both were active at the same time. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!