[OpenWrt-Devel] Autoneg problems with ar8216 on kernel 3.14 (related to ticket 17800)

Heiner Kallweit hkallweit1 at googlemail.com
Mon Oct 27 17:04:01 EDT 2014

With two different TPLINK routers (both with a AR8327N switch) I faced the issue that with
kernel 3.14 certain switch ports used 10MBit/half only.
Under kernel 3.10 everything was fine and the same ports used 1000MBit/full.

As the ar8216 driver is the same I had a look at the common phy code in drivers/net/phy.
In function phy_init_hw in phy_device.c kernel 3.14 resets the phy whilst 3.10 does not.

The issue turned out to be that when resetting only flag BMCR_RESET is set, not BMCR_ANENABLE.
(In ar8216.c always both flags are set when the switch is reset)
Therefore autoneg was not enabled. Also later in the boot process it doesn't get enabled.
Adding BMCR_ANENABLE solved the problem and now also under 3.14 all ports use 1000MBit/full.

However I'm not sure whether it's a poper fix to add BMCR_ANENABLE in this generic phy function.
It might not be appropriate for other phy's.

After resetting the switch later in the boot process ar8xxx_phy_config_aneg is called with
phydev->addr being 0.
In this case the function returns immediately. Otherwise it would call genphy_config_aneg.
Calling genphy_config_aneg would also solve the problem as it checks for BMCR_ANENABLE
being set and sets it if needed.
I don't know the reason why genphy_config_aneg isn't called in case of addr 0.
Or is this a typo and the check actually should be addr != 0 ?

Rgds, Heiner
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list