netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jisheng Zhang <jszhang@kernel.org>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Russell King <linux@armlinux.org.uk>,
	Florian Fainelli <florian.fainelli@broadcom.com>,
	Jakub Kicinski <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org
Subject: Re: [RFC] mdio demux multiplexer driver
Date: Mon, 18 Aug 2025 23:39:35 +0800	[thread overview]
Message-ID: <aKNJN4sBfi_YAjrF@xhacker> (raw)
In-Reply-To: <2391ae0e-bfb2-4370-aac3-563fc5e70cf9@lunn.ch>

On Sat, Aug 16, 2025 at 04:52:25PM +0200, Andrew Lunn wrote:
> > > So, why not KISS. Hard code the MMIO reg so MAC0 is connected to the
> > > PHYs, and MAC1 just uses a phy-handle pointing to the PHYs on MAC0s
> > > MDIO bus.
> > 
> > Previously, I went with this solution. But then I met an issue -- who
> > does the harcoding? bootloader or linux kernel?
> 
> Linux. The bootloader can do it as well, e.g. for TFTP booting, but
> Linux should not rely on the bootloader.

+1

> 
> > Linux? This is what this email thread ask for comment -- How does
> > linux model this?
> > 
> > Another issue is: the hardcoding maybe different on different boards.
> > E.g If only MAC1 is used, we need to hardcode the MMIO reg to let
> > MAC1 MDIO master own the single MDIO DATA and CLK line.
> 
> Both Ethernet and MDIO hardware exists, even if it is not used. I
> would separate the drivers. Have a MAC driver and an MDIO driver. List
> them as separate entities in DT. Always probe the MDIO0 driver. It can
> set the MUX registers. Don't probe MDIO1 driver. Even if it does
> probe, you know MDIO0 is one to be used, so MDIO1 can still set the
> MUX to point to MDIO0.
> 
> How messy is the address space? Are the MDIO registers in the middle
> of the MAC registers? Is this a standard, off the shelf MAC/MDIO IP?
> stmmac? Or something currently without a driver? If you are dealing

stmmac :(  And the MMIO reg doesn't sit together with MAC IP's.
As can be seen, the stmmac mdio registers sit in the middle of the
MAC regs. And current stmmac still tries to register a mdio driver for
the MDIO bus master. And to be honest, it's not the stmmac make things
messy, but the two MDIO masters sharing the single clk and data lines
makes the mess. Modeling the mmio as a demux seems a just so so but
not perfect solution.

> with a driver which already exists, it gets a bit messy.

  reply	other threads:[~2025-08-18 15:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-13  0:58 [RFC] mdio demux multiplexer driver Jisheng Zhang
2025-08-15  3:51 ` Andrew Lunn
2025-08-16  5:26   ` Jisheng Zhang
2025-08-16 14:52     ` Andrew Lunn
2025-08-18 15:39       ` Jisheng Zhang [this message]
2025-08-18 16:21         ` Russell King (Oracle)
2025-08-18 16:27         ` Andrew Lunn
2025-08-20 15:44           ` Jisheng Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aKNJN4sBfi_YAjrF@xhacker \
    --to=jszhang@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=florian.fainelli@broadcom.com \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).