[OpenWrt-Devel] Migration in ath79 for swapped ethernet

Chuanhong Guo gch981213 at gmail.com
Thu Jan 30 00:19:12 EST 2020

Sorry for the late reply.

On Wed, Jan 29, 2020 at 11:18 PM Piotr Dymacz <pepe2k at gmail.com> wrote:
> AFAIK, there wasn't any official or general rule about what should be
> LAN and WAN (in terms of mapping ethX to 'our' LAN/WAN), so it was
> always up to the device support author (personally I preferred to have
> LAN on eth0). And as you can see above, ar71xx allowed two different
> orders in which ethX interfaces where registered in kernel.
> > Despite, from what I understand our current problem is the driver implementation
> > in ath79, which needs to skip/delay initialization in certain cases.
> > So, it's not so much about finding out the situation on ar71xx, but
> > understanding the situation in ath79 as well. All-in-all, I think this will come
> > down to having to check each device manually.
> More or less, yes.

on ath79 chips with builtin switch, the phy used by gmac0 is wired to mdio on
gmac1. we need to get mdio1 ready before we can probe gmac0.

ar71xx do peripheral resets in mach-xxx.c code, and have mdio/gmac in separate
drivers. This inspired me to make a commit:
83d2dbc599 ath79: ag71xx: Split mdio driver into an independent platform device.

But it was later discovered that even though atheros provided separated
mdio/gmac reset, we still have to assert both resets together, or gmac register
values won't be restored to default. Some devices got broken ethernet because of

In order to do this reset sequence in ath79, mdio and gmac can't be treated as
two separated drivers, so gmac1 must be probed before gmac0 to have mdio1

Since probing order is fixed in ath79, I think the only way to specify interface
names is to add a device tree property and fill the corresponding name field in
netdev structure. This has no chance to be accepted upstream and can only
be our local hack forever.

Chuanhong Guo

openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list