From nobody Fri Sep 13 07:07:47 2024 X-Original-To: freebsd-net@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4X4lkl0w6dz5W9GC for ; Fri, 13 Sep 2024 07:07:59 +0000 (UTC) (envelope-from freebsd-net@dino.sk) Received: from cm0.netlabit.sk (mailhost.netlabit.sk [84.245.65.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4X4lkj5jN1z4Q6q for ; Fri, 13 Sep 2024 07:07:57 +0000 (UTC) (envelope-from freebsd-net@dino.sk) Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of freebsd-net@dino.sk designates 84.245.65.72 as permitted sender) smtp.mailfrom=freebsd-net@dino.sk Received: from zeta.dino.sk ([84.245.95.254]) (AUTH: LOGIN milan, TLS: TLSv1.3,256bits,TLS_AES_256_GCM_SHA384) by cm0.netlabit.sk with ESMTPSA id 0000000001496D47.0000000066E3E4C5.0000902C; Fri, 13 Sep 2024 09:07:49 +0200 Date: Fri, 13 Sep 2024 09:07:47 +0200 From: Milan Obuch To: freebsd-net@freebsd.org Subject: Re: Ethernet device with shared mdio Message-ID: <20240913090747.48062204@zeta.dino.sk> In-Reply-To: References: X-Mailer: Claws Mail 3.21.0 (GTK+ 2.24.33; amd64-portbld-freebsd13.3) List-Id: Networking and TCP/IP with FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-net List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-net@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spamd-Bar: -- X-Spamd-Result: default: False [-2.33 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_SHORT(-0.03)[-0.025]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_COUNT_ONE(0.00)[1]; ASN(0.00)[asn:5578, ipnet:84.245.64.0/18, country:SK]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; MLMMJ_DEST(0.00)[freebsd-net@freebsd.org]; MID_RHS_MATCH_FROMTLD(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; R_DKIM_NA(0.00)[]; TO_DN_NONE(0.00)[]; DMARC_NA(0.00)[dino.sk]; TO_MATCH_ENVRCPT_ALL(0.00)[]; ARC_NA(0.00)[] X-Rspamd-Queue-Id: 4X4lkj5jN1z4Q6q On Fri, 6 Sep 2024 18:03:39 +0000 Mike Belanger wrote: > The following device tree specifies a shared mdio. > The ffec driver uses miibus. > When there is a shared mdio, one of the device instances will not be > able to properly configure the PHY, as it needs to use the other > devices resource to read/write the PHY. > > &fec1 {pinctrl-names = "default"; > pinctrl-0 = <&pinctrl_fec1>; > phy-mode = "rgmii-id"; > phy-handle = <ðphy0>; > fsl,magic-packet; > status = "okay"; > > mdio { > #address-cells = <1>; > #size-cells = <0>; > > ethphy0: ethernet-phy@0 { > compatible = "ethernet-phy-ieee802.3-c22"; reg = <0>; > }; > > ethphy1: ethernet-phy@1 { > compatible = "ethernet-phy-ieee802.3-c22"; reg = <1>; > }; > }; > }; > > &fec2 { > pinctrl-names = "default"; > pinctrl-0 = <&pinctrl_fec2>; > phy-mode = "rgmii-txid"; > phy-handle = <ðphy1>; > phy-supply = <®_fec2_supply>; > nvmem-cells = <&fec_mac1>; > nvmem-cell-names = "mac-address"; > rx-internal-delay-ps = <2000>; > fsl,magic-packet; > status = "okay"; > }; > > Does FreeBSD have any plans for supporting hardware that specifies a > shared mdio in the dtb? Just knowing the general approach being > considered would be helpful. > I can't speak for FreeBSD project, I just can share my experience with similar case. It is described in my post to hackers mailing list (see https://lists.freebsd.org/archives/freebsd-hackers/2021-December/000649.html for details), unfortunately, no response received. Another attempt to get some attention a week later on net mailing list was done, see https://lists.freebsd.org/archives/freebsd-net/2021-December/001114.html for the post, with no response either. As you see, my case was similar, just the mdio block was attached to second controller. This makes it a bit more problematic - you can't use mdio controller before being initialized, naturally. I was not able to use miiproxy approach as noted in my post to hackers mailing list, additionally, miiproxy was removed from the tree with MIPS arch some time later. I resolved the issue by modifying cgem driver and mii layer. This was just a proof of concept with some hacks, but I was able to use both ports with proper link state change detection. I did not continue the work because vendor changed hardware design and there was no shared mdio anymore. If you are interested I can dig for the sources, big part of my changes would not be necessary, just the idea of decoupling MDIO and MII interfaces still applies, I think. By the way, which board are you working on? Is it accessible for general audience? Regards, Milan