Commit Graph

16 Commits (5fd68d60e422492dfad0d4f77f1bef3d0ea079ba)

Author SHA1 Message Date
Petr Štetiar 5fd68d60e4 ath79: ag71xx: Fix tx queue timeouts during ifup
On ath79 and UBNT Bullet M XW (ar9342) I was experiencing weird issues during
network setup[1] which I was able to reproduce easily with following commands:

 uci set network.lan.ipaddr='192.168.1.20'
 uci commit network
 ifup lan

Which resulted after some time in:

 ...
 WARNING: CPU: 0 PID: 0 at net/sched/sch_generic.c:461 dev_watchdog+0x16c/0x280
 NETDEV WATCHDOG: eth0 (ag71xx): transmit queue 0 timed out
 ...

Sometimes I wasn't able to use networking anymore, sometimes it was enough to
just ifdown/ifup lan and network was backup. On ar71xx it was all working just
fine.

I've found out, that it was happening because ag71xx_poll() wasn't called, thus
the TX queue wasn't emptied. The ag71xx_poll() is being called from napi
hrtimer, which is enabled by napi_schedule() in ar71xx_interrupt(), but since
no interrupts were ever fired again after ag71xx_stop() was called, it was
always leading to tx queue timeouts:

 *** ag71xx_hard_start_xmit()
 eth0: packet injected into TX queue
 eth0: raw intr=00000001 TXPS POLL
 eth0: enable polling mode
 eth0: processing TX ring, flush=no
 eth0: disable polling mode, rx=1, tx=1,limit=32

 ( `ifup lan done here` )

 *** ag71xx_stop()
 *** ag71xx_open()
 *** ag71xx_hw_enable()
 IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
 IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
 *** ag71xx_hard_start_xmit()
 eth0: packet injected into TX queue
 *** ag71xx_hard_start_xmit()
 eth0: packet injected into TX queue
 ...
 WARNING: CPU: 0 PID: 0 at net/sched/sch_generic.c:320 dev_watchdog+0x164/0x274

So I've looked at ag71xx_stop() in ar71xx, added the missing bits to ath79 and
fixed this issue.

1. https://github.com/openwrt/openwrt/pull/1635#issuecomment-448638246

Signed-off-by: Petr Štetiar <ynezz@true.cz>
[move ag->link before ag71xx_hw_disable to retain ordering as original]
Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
5 years ago
Petr Štetiar 7bd2595b67 ath79: ag71xx: Fix code formatting in ag71xx_probe
Signed-off-by: Petr Štetiar <ynezz@true.cz>
6 years ago
Petr Štetiar a29df78c9f ath79: ag71xx: Unify debug output with ar71xx and make debugging easier
Currently it's quite hard to diff debugging output between ar71xx and
ath79, so this patch tries to improve it by adding the same
ag71xx_dump_regs function and placing debugging output from the
registers to relatively same places.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
6 years ago
Chuanhong Guo 028daa9974 ath79: ag71xx: apply interface mode to MII0/1_CTRL on ar71xx/ar913x
We currently don't have any code configuring interface mode in ath79,
meaning that we relies on bootloader to set the correct interface mode.

This patch added code to set interface correctly so that everything works
even if bootloader configures it wrong.(e.g. on WNDR3800 u-boot set
the second GMAC mode to RMII but it should be RGMII.)

Introduced "qca,mac-idx" for the difference in MII_CTRL register value.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
6 years ago
Chuanhong Guo 42b3fdf981 ath79: ag71xx: fix speed applied to MII0/1_CTRL on ar71xx/ar913x
Currently speed value is applied to interface mode field.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
6 years ago
Chuanhong Guo 387736af41 ath79: ag71xx: remove PHY reset
Bit 8/12 of reset controller which is marked as PHY_RESET/SWITCH_RESET
in datasheets will trigger either a reset for builtin switch or assert
an external ETH0_RESET_L/ETH1_RESET_L pin, which are usually connected
to external PHY/switch. None of them should be triggered every time an
interface is brought up in ethernet driver.

Remove PHY reset support from ag71xx and definition for them in dtsi.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
6 years ago
Chuanhong Guo f43e8f9004 ath79: ag71xx: Explicitly register mdio bus after ag71xx_hw_init() for ar7240
mdio bus isn't a standalone device on ar7240. (and maybe older SoCs?)
Use simple-mfd for ar7241 and later SoCs to get mdio1 ready before gmac0
For ar7240 and older chips, manually create platform device after
ag71xx_hw_init() in ag71xx_probe()to get mdio0 ready between
ag71xx_hw_init() and ag71xx_phy_connect().

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
6 years ago
Chuanhong Guo 83d2dbc599 ath79: ag71xx: Split mdio driver into an independent platform device.
We need to have mdio1 belonging to gmac1 initialized before gmac0.
Split it into a separated mdio device to get both mdios ready before probing gmac.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
6 years ago
Chuanhong Guo 24cbe27bb7 ath79: ag71xx: Remove ar7240_set_addr and ag71xx_ar7240_start
The builtin switch has it's initial valid mac address(00:00:01:00:00:00).
Since the builtin switch is an independent device, setting mac address of gmac1 to builtin switch isn't a good idea and this makes it impossilbe to split builtin switch apart as an independent platform device.
Remove these functions and apply default VLAN during initialization as a preparation for further driver splitting.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
6 years ago
Chuanhong Guo 2d081addb5 ath79: ag71xx: Split gmac config into separated file and add support for ar934x/qca955x.
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
6 years ago
Lucian Cristian c8e76cd4ff ath79: fix rx ring buffer stall qca956x
when ported from ar71xx to ath79 the qca9560-eth was omitted

Signed-off-by: Lucian Cristian <lucian.cristian@gmail.com>
6 years ago
Weijie Gao 52109ce71f ath79: ag71xx: fix pll-data setting for ar7242/ar934x/qca955x/qca956x
ar71xx/ar913x series use the old pll registers and settings.

However started from ar7242, a new pll register is introduced and the
pll setting is much simpler.

This can be observed from dev-eth.c from the ar71xx target.

Signed-off-by: Weijie Gao <hackpascal@gmail.com>
6 years ago
John Crispin 5a6a32ad9b ath79: fix adjust_link callback for ar9130
Signed-off-by: John Crispin <john@phrozen.org>
6 years ago
Johann Neuhauser a7e1e919af ath79: preliminary support for TP-Link WDR3600 / WDR4300 (AR9344)
working:
 - leds
 - buttons
 - lan / wan
 - usb (hub port 1 + 2)
 - wifi 5g
 - sysupgrade
 - ...

not working:
 - wifi 2g

Signed-off-by: Johann Neuhauser <johann@it-neuhauser.de>
6 years ago
Johann Neuhauser c15dfbeea0 ath79: fix gmac compatible in ar9330.dtsi and ag71xx_setup_gmac_933x
1. compatible property in node gmac was wrong

2. ag71xx_setup_gmac_933x should use np of gmac-config and
   not the pointer to gmac. gmac is only used for the reg address.

Signed-off-by: Johann Neuhauser <johann@it-neuhauser.de>
6 years ago
John Crispin 53c474abbd ath79: add new OF only target for QCA MIPS silicon
This target aims to replace ar71xx mid-term. The big part that is still
missing is making the MMIO/AHB wifi work using OF. NAND and mikrotik
subtargets will follow.

Signed-off-by: John Crispin <john@phrozen.org>
6 years ago