[OpenWrt-Devel] ar8216: question regarding ar8xxx_phy_config_aneg

Jonas Gorski jogo at openwrt.org
Fri Nov 28 06:15:32 EST 2014

On Fri, Nov 28, 2014 at 11:06 AM, Heiner Kallweit <hkallweit1 at gmail.com> wrote:
> In my tests with AR8327 this callback was never called with an addr != 0.
> Seems logical to me as it's called for the PHY attached to the net device
> only.
> In most cases this is addr 0, just for AR8316 with port4_phy being set this
> could be 4.
> This leads to two questions:
> 1. The current version of this function checks for "addr == 0" always, I'd
> assume this is not correct for AR8316 and port4_phy being set.
> 2. As it seems to be called for the attached PHY addr only and in exactly
> this case we do nothing: Can we simply replace this callback with a dummy
> "return 0" ?

Port4_phy being set means the switch operates in dual-mii mode.

Most Atheros switches (including AR8327) support a dual-phy mode,
where port 5 / phy 4 is split out from the rest of the switch and used
as a single phy for a second ethernet mac. In these cases phy 4 is
used like a standard phy, and the kernel needs to be able to configure
autonegotiation or other features.

Consequently you will only see the callback being called for addr != 0
if the switch is in this mode and there is a second ethernet mac as
the single wan port. I'm not sure if there are any OpenWrt supported
devices with this setup with AR8327, but there are several examples
for AR8316, e.g. the RouterStation Pro [1].

The switch driver claiming phy 0 is technically wrong, as the
connection to the switch isn't using phy 0, but uses a fixed (R)(G)MII
connection that does not support autonegotiation. But there also is no
other phy address on the MDIO bus which represents the cpu port, so we
need this workaround for autodetection/-attachment.

More information about the openwrt-devel mailing list