TL-WR1043: switch
Stefan Bethke
stb at lassitu.de
Tue Dec 13 10:40:02 UTC 2011
Am 13.12.2011 um 11:06 schrieb Adrian Chadd:
> The trouble ray is having at the moment is where the switch PHY hangs
> off of arge1, rather than arge0. This means that arge0 gets probed and
> has no PHY; then arge1 gets probed and has the switch PHY. I'd rather
> (for now) just have arge0 be "hard" coded up to something and use the
> switch API to configure the switch ports themselves. If that works
> (well enough for now) then we can just get the switch code + drivers
> into -HEAD and get it all polished.
I think it's time for some ASCII art :-)
If I understand correctly how ray at s device is connected, it looks like this:
Switch arge
+------+ MII +------+
| PHY4 |-------------------------| MAC1 |
+------+ +------+
+------+ +------+---+------+ +------+
| PHY3 |---| MAC3 | | MAC4 |---| MAC0 |
+------+ +------+ +------+ +------+
+------+ +------+ |
| PHY2 |---| MAC2 | |
+------+ +------+ Switch |
+------+ +------+ core | MDC/MDIO
| PHY1 |---| MAC2 | |-----------
+------+ +------+ |
+------+ +------+ |
| PHY0 |---| MAC0 | |
+------+ +------+----------+
(The actual unit numbers might be different.)
PHY4 is directly attache to arg1, so we can use the standard miibus attachment for that.
However, the same MDC/MDIO bus is also used to configure the switch and PHYs 0 to 3, so clearly arge1 should not look at those PHYs and their registers.
In my RTL8366RB driver, I've added an additional miibus for each of the PHYs attached to the switch core, and a struct ifnet to match. I believe that is the correct answer here as well, since arge0 has no PHY when communicating with MAC4 of the switch, and likely will be hardwired for the maximum speed the switch port supports.
I think the question is: how can we hang a switch controller off arge0's miibus when it does not represent any actual PHY that arge0 could manipulate for it's own MAC and MII interface?
For arge1 and PHY4, we can attach ukphy or one of the standard phy drivers. For the switch, the switch driver should present itself as a phy, but with only the hardwired media selection available, i. e. not actually talking to PHY0 to PHY3. Through the switch management interface, it can then expose those PHYs.
Stefan
--
Stefan Bethke <stb at lassitu.de> Fon +49 151 14070811
More information about the freebsd-embedded
mailing list