netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: "Álvaro Fernández Rojas" <noltari@gmail.com>
Cc: Jonas Gorski <jonas.gorski@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] net: mdio: Add BCM6368 MDIO mux bus controller
Date: Wed, 17 Mar 2021 18:49:27 +0100	[thread overview]
Message-ID: <YFJBJ1IHpkXXaGvc@lunn.ch> (raw)
In-Reply-To: <D39D163A-C6B3-4B66-B650-8FF0A06EF7A2@gmail.com>

> BCM6368 (and newer) SoCs have an integrated ethernet switch controller with dedicated internal phys, but it also supports connecting to external phys not integrated in the internal switch.
> Ports 0-3 are internal, ports 4-7 are external and can be connected to external switches or phys and port 8 is the CPU.
> This MDIO bus device is integrated in the BCM63xx switch registers, which corresponds to the same registers present in drivers/net/dsa/b53/b53_regs.h.
> As you can see in the source code, registers are the same for the internal and external bus. The only difference is that if MDIOC_EXT_MASK (bit 16) is set, the MDIO bus accessed will be the external, and on the contrary, if bit 16 isn’t set, the MDIO bus accessed will be the internal one.
> 
> I don’t know if this answers your question, but I think that adding it as mdiomux is the way to go.

Hi Álvaro

The Marvell mv88e6390 family of switches has a very similar setup. An
internal and an external MDIO bus, one bit difference in a
register. When i wrote the code for that, i decided it was not a mux
as such, but two MDIO busses. So i register two MDIO busses, and rely
on a higher level switch register mutex to prevent parallel operations
on the two busses.

The reason i decided it was not a mux, is that all the other mux
drivers are separate drivers which rely on another MDIO bus
driver. The mux driver gets a handle to the underlying MDIO bus
driver, and and builds on it. Here you have it all combined in one, so
it does not follow the pattern.

So if you want to use a max, please break this up into an MDIO driver,
and a mux driver. Or have one driver which registers two mdio busses,
no mux.

   Andrew

  reply	other threads:[~2021-03-17 17:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-08 18:41 [PATCH 0/2] net: mdio: Add BCM6368 MDIO mux bus controller Álvaro Fernández Rojas
2021-03-08 18:41 ` [PATCH 1/2] dt-bindings: net: Add bcm6368-mdio-mux bindings Álvaro Fernández Rojas
2021-03-08 20:54   ` Andrew Lunn
2021-03-15 13:51     ` Álvaro Fernández Rojas
2021-03-08 18:41 ` [PATCH 2/2] net: mdio: Add BCM6368 MDIO mux bus controller Álvaro Fernández Rojas
2021-03-08 19:57   ` Jakub Kicinski
2021-03-15 13:53     ` Álvaro Fernández Rojas
2021-03-08 21:00   ` Andrew Lunn
2021-03-15 14:02     ` Álvaro Fernández Rojas
2021-03-17 17:49       ` Andrew Lunn [this message]
2021-03-17 21:42         ` Florian Fainelli

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=YFJBJ1IHpkXXaGvc@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=hkallweit1@gmail.com \
    --cc=jonas.gorski@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=noltari@gmail.com \
    --cc=robh+dt@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).