Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Jan 2012 09:08:14 -0800
From:      Adrian Chadd <adrian@freebsd.org>
To:        Stefan Bethke <stb@lassitu.de>
Cc:        freebsd-net@freebsd.org, Marius Strobl <marius@freebsd.org>, freebsd-arch@freebsd.org
Subject:   Re: Extending sys/dev/mii
Message-ID:  <CAJ-Vmomp9XMsXoDBc5jcj1g6_qR2rdpcV3oiDQEuQPpiPL7ZxQ@mail.gmail.com>
In-Reply-To: <8D025847-4BE4-4B2C-87D7-97E72CC9D325@lassitu.de>
References:  <8D025847-4BE4-4B2C-87D7-97E72CC9D325@lassitu.de>

next in thread | previous in thread | raw e-mail | index | archive | help
I'm including -net here so we can try and pull in further feedback
from network-cluey people.

On 4 January 2012 08:03, Stefan Bethke <stb@lassitu.de> wrote:
> As discussed recently, ray@, adrian@ and myself are trying to get a frame=
work and utility into the tree that allows the use and configuration of eth=
ernet switch chips. =A0The switch controllers we've looked at so far share =
a number of features, in particular they use 802.3 MII, MDIO and PHYs to im=
plement and configure the ports they offer. =A0In addition to being a switc=
h, some of them also offer one of the built-in PHYs to the ethernet control=
ler as a classical PHY.

[snip]

> I'd like to extend miibus in such a way that the one-to-one mapping betwe=
en MDIO and MII is broken up. =A0For that, I propose to add a new bus drive=
r "mdiobus" (with appropriate resource management) that uses methods simila=
r to miibus_if.m readreg and writereg to access an ethernet controllers' MD=
IO master. =A0miibus then attaches to it as a child, claims one or more PHY=
 addresses and attaches PHYs to itself (as currently implemented).

This sounds like a good idea. I wonder what's stopping us from doing that. =
:)

> There's one issue that I don't have a proposal for yet: in one platform (=
AR7241), we have PHY4 of the SoC talking via MII to arge0's MAC, while it i=
s being controlled via the switch controller's MDIO master, and the switch =
controller being attached to arge1's MDIO. =A0If we want to attach an miibu=
s for PHY4, we'd have to defer attachment of arge0 until arge1 has been pro=
bed and can provide the MDIO attachment (and transitively the switch and it=
's mdio). =A0Note that we also have boards without a switch, but the two PH=
Ys still being attached to only a single MDIO. =A0One possible way would be=
 for the MDIO driver to be separate from the ethernet driver, so that the n=
ormal newbus dependency resolution can be used to ensure that mdio1 is atta=
ched before arge0 is probed. =A0For the time being, I've worked around this=
 through hackery in if_arge.c.

juli@ proposed something quite similar a few weeks ago. Now that I'm a
little more clued up on this whole area, I now understand why she
suggested it.

I'm happy with "hacky" being in if_arge for now (I mean, there already
_is_ ..) but this work seems like the right path to take to bring
sanity to this whole setup in the longer term.

Thanks for tackling this!


Adrian



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-Vmomp9XMsXoDBc5jcj1g6_qR2rdpcV3oiDQEuQPpiPL7ZxQ>