aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ar71xx/files/drivers
Commit message (Collapse)AuthorAgeFilesLines
* ar71xx/ath79: ag71xx: dont fetch the same var againKoen Vandeputte2019-08-271-1/+1
| | | | | | | | tx_size was just declared above and set to BIT(tx->order) Use the declaration instead, which could avoid a pointer deref Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com> (cherry picked from commit 6852eab58236e3991f5d73f211018dfef01f2a64)
* ar71xx: ag71xx: use base address value directly from the sourceKoen Vandeputte2019-08-271-2/+2
| | | | | | This brings the code more inline with the ath79 flavour Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
* ar71xx: ag71xx: make use of managed dev API simplifying codeKoen Vandeputte2019-08-271-51/+34
| | | | | | | | | Backport of a4eef43a120d ("ath79: ag71xx: replace alloc_etherdev with devm_alloc_etherdev") combined with the initial changes from John Crispin. Simplifies the code a lot by using the Managed dev API. Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
* ar71xx: ag71xx: replace ag71xx_get_phy_if_mode_name with phy_modes()Koen Vandeputte2019-08-271-22/+1
| | | | | | Backport of f73b2d64ed56 ("ath79: ag71xx: replace ag71xx_get_phy_if_mode_name() with phy_modes()") Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
* ar71xx: ag71xx: pass correct device pointer to dma functionsKoen Vandeputte2019-08-271-7/+7
| | | | | | | | | Backport of 4eaa3626a821 ("ath79: ag71xx: pass correct device pointer to dma functions") While 4.14 does not contain the warnings, it still makes sense to use the proper pointers here. Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
* ar71xx/ath79: ag71xx: get ring_mask consistentKoen Vandeputte2019-08-271-1/+1
| | | | | | | | | All other instances of this identical declaration fetch the value directly from the ring_order. Also do it here. Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
* ar71xx: ag71xx: add missing register writesKoen Vandeputte2019-08-271-0/+5
| | | | | | These are added in ath79, but were not backported here Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
* ar71xx: ag71xx: init rings with GFP_KERNELKoen Vandeputte2019-08-091-1/+1
| | | | | | | ar71xx got lost during final rebase .. Fixes: c8a6ce71e49c ("ar71xx/ath79: ag71xx: init rings with GFP_KERNEL") Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
* ar71xx/ath79: ag71xx: fix sleep in atomicKoen Vandeputte2019-08-091-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When enabling atomic-sleep-debugging options in the kernel, following splat is seen when disabling the interface (which happens on boot): [ 10.892878] eth0: link down [ 10.896788] BUG: sleeping function called from invalid context at net/core/dev.c:5563 [ 10.904730] in_atomic(): 1, irqs_disabled(): 1, pid: 425, name: ip [ 10.911004] 2 locks held by ip/425: [ 10.914539] #0: (rtnl_mutex){....}, at: [<80377474>] rtnetlink_rcv_msg+0x2d8/0x380 [ 10.922441] #1: (&(&ag->lock)->rlock){....}, at: [<80330158>] ag71xx_hw_disable+0x24/0x94 [ 10.930976] CPU: 0 PID: 425 Comm: ip Not tainted 4.14.136 #0 [ 10.936716] Stack : 805e0000 80589228 80557404 876998ec 80610000 80610000 87cdcafc 805b5327 [ 10.945233] 80551534 000001a9 8061386c 87699ccc 87cfb180 00000001 876998a0 84f70903 [ 10.953751] 00000000 00000000 80b00000 8769979c 6a7407fa 00000000 00000007 00000000 [ 10.962270] 000000b7 16d0954a 000000b6 00000000 80000000 87cb658c 87cb65b0 00000001 [ 10.970787] 8046f97c 87699ccc 87cfb180 87ff2810 00000003 802ce724 0806e098 80610000 [ 10.979306] ... [ 10.981797] Call Trace: [ 10.984287] [<8006cb0c>] show_stack+0x58/0x100 [ 10.988814] [<800aab34>] ___might_sleep+0x100/0x120 [ 10.993774] [<8035c434>] napi_disable+0x30/0xd8 [ 10.998377] [<80330198>] ag71xx_hw_disable+0x64/0x94 [ 11.003418] [<8033069c>] ag71xx_stop+0x24/0x38 [ 11.007959] [<80359e30>] __dev_close_many+0xcc/0x104 [ 11.013009] [<80362eac>] __dev_change_flags+0xc8/0x1ac [ 11.018227] [<80362fb8>] dev_change_flags+0x28/0x70 [ 11.023182] [<80376890>] do_setlink+0x31c/0x91c [ 11.027786] [<80379360>] rtnl_newlink+0x3ec/0x7f8 [ 11.032563] [<80377498>] rtnetlink_rcv_msg+0x2fc/0x380 [ 11.037799] [<8039a734>] netlink_rcv_skb+0xd4/0x178 [ 11.042754] [<80399d10>] netlink_unicast+0x168/0x250 [ 11.047796] [<8039a2d4>] netlink_sendmsg+0x3d8/0x434 [ 11.052841] [<8033f0e4>] ___sys_sendmsg+0x1dc/0x290 [ 11.057794] [<80340140>] __sys_sendmsg+0x54/0x84 [ 11.062495] [<8007212c>] syscall_common+0x34/0x58 This is caused by calling napi_disable() while holding the spinlock. Fix it by omitting the spinlock, which is not required here Extensively tested on GL-MiFi, RB-912 and RB-922 hardware Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
* ar71xx: ag71xx: update ethtool supportPetr Štetiar2019-06-051-34/+14
| | | | | | | | | | Remove references to broken and mostly deprecated phy_ethtool_ioctl, use new {s,g}et_link_ksettings and add nway_reset which was previously handled in phy_ethtool_ioctl. Cc: John Crispin <john@phrozen.org> Ref: https://bugs.openwrt.org/index.php?do=details&task_id=1982 Signed-off-by: Petr Štetiar <ynezz@true.cz>
* ar71xx: ag71xx: remove unused SIOCETHTOOL ioctl handlingPetr Štetiar2019-06-051-10/+0
| | | | | | | | | | | | This ioctl is currently routed through generic interface code: dev_ioctl dev_ethtool __ethtool_get_link_ksettings phy_ethtool_ioctl Cc: Felix Fietkau <nbd@nbd.name> Signed-off-by: Petr Štetiar <ynezz@true.cz>
* ar71xx: ag71xx: Fix broken networking on some devices (FS#2177)Petr Štetiar2019-04-081-2/+3
| | | | | | | | | It was reported, that latest ar71xx builds have broken networking on TP-Link TL-WPA8630 and Nanostation M5 XW devices and that by reverting the offending commit, everything is back to normal. Fixes: d3506d1 ("ar71xx: ag71xx: fix compile error when enabling debug") Signed-off-by: Petr Štetiar <ynezz@true.cz>
* ar71xx: ag71xx: fix compile error when enabling debugKoen Vandeputte2019-03-051-6/+5
| | | | | | | | | | | | | | | | | | | | | | | Starting from kernel 4.5, phy_id needs to be fetched from a different location. not doing so results in this compile error: drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.c: In function 'ag71xx_phy_connect_multi': drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.c:133:35: error: 'struct mdio_device' has no member named 'phy_id' ag->mii_bus->mdio_map[phy_addr]->phy_id); ^ ./include/linux/printk.h:137:18: note: in definition of macro 'no_printk' printk(fmt, ##__VA_ARGS__); \ ^~~~~~~~~~~ drivers/net/ethernet/atheros/ag71xx/ag71xx.h:72:27: note: in expansion of macro 'pr_debug' #define DBG(fmt, args...) pr_debug(fmt, ## args) ^~~~~~~~ drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.c:130:3: note: in expansion of macro 'DBG' DBG("%s: PHY found at %s, uid=%08x\n", ^~~ scripts/Makefile.build:326: recipe for target 'drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.o' failed Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
* ar71xx: ag71xx: preserve port mirror flags during swconfig applyMilan Krstic2019-01-221-0/+4
| | | | | | | | | | The swconfig load operation always triggers 'apply' function which in this driver currently clears port mirroring flags effectively undoing port mirroring configuration. This fix preserves port mirroring flags during apply. Signed-off-by: Milan Krstic <milan.krstic@gmail.com>
* ar71xx: ag71xx: Replace duplicate debugging code with simple function callPetr Štetiar2018-12-171-16/+1
| | | | | | | ag71xx_dump_regs is used in code several times, and is providing same output. Signed-off-by: Petr Štetiar <ynezz@true.cz>
* ar71xx: fix typo in rb91x nand sourceKoen Vandeputte2018-08-241-1/+2
| | | | | | Fixes: 3b1ea0996f83 ("ar71xx: fix build error due to bad include") Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
* ar71xx: fix build error due to bad includeKoen Vandeputte2018-08-224-5/+20
| | | | | | | | | | | | | | | | | | While "rawnand.h" is available in kernel 4.14, the default for this target is kernel 4.9 in which "nand.h" should be used. Add an extra check to include the correct file depending on kernel version Fixes these build errors: drivers/mtd/nand/ar934x_nfc.c:16:10: fatal error: linux/mtd/rawnand.h: No such file or directory #include <linux/mtd/rawnand.h> ^~~~~~~~~~~~~~~~~~~~~ compilation terminated. Fixes: 318e19ba6755 ("ar71xx: add v4.14 support") Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
* ar71xx: add missing include for checking kernel versionKoen Vandeputte2018-08-221-0/+1
| | | | | | | | | | | | | | | | | | Fixes these build errors: arch/mips/ath79/mach-rb2011.c:20:5: error: "LINUX_VERSION_CODE" is not defined, evaluates to 0 [-Werror=undef] #if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) ^~~~~~~~~~~~~~~~~~ arch/mips/ath79/mach-rb2011.c:20:26: error: "KERNEL_VERSION" is not defined, evaluates to 0 [-Werror=undef] #if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) ^~~~~~~~~~~~~~ arch/mips/ath79/mach-rb2011.c:20:40: error: missing binary operator before token "(" #if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) ^ Fixes: 318e19ba6755 ("ar71xx: add v4.14 support") Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
* ar71xx: add v4.14 supportJohn Crispin2018-08-226-4/+30
| | | | | | adds v4.14 patches for testing but leaves v4.9 as default for now. Signed-off-by: John Crispin <john@phrozen.org>
* ar71xx: fix QCA955X SGMII link lossDavid Bauer2018-08-082-0/+81
| | | | | | | | | | | | | | | | | | | The QCA955X is affected by a hardware bug which causes link-loss of the SGMII link between SoC and PHY. This happens on change of link-state or speed. It is not really known what causes this bug. It definitely occurs when using a AR8033 Gigabit Ethernet PHY. Qualcomm solves this Bug in a similar fashion. We need to apply the fix on a per-device base via platform-data as performing the fixup work will break connectivity in case the SGMII interface is connected to a Switch. This bug was first proposed to be fixed by Sven Eckelmann in 2016. https://patchwork.ozlabs.org/patch/604782/ Based-on-patch-by: Sven Eckelmann <sven.eckelmann@open-mesh.com> Signed-off-by: David Bauer <mail@david-bauer.net>
* Revert "ar71xx: ag71xx: Prevent kernel oops for board def"Jo-Philipp Wich2018-08-011-15/+1
| | | | | | | | | | | This reverts commit 7a3e133751870a3431e2430386a77a002eb24117. This change reportedly breaks connectivity on some ar71xx devices, so revert it for now. Ref: https://github.com/openwrt/openwrt/pull/1217#issuecomment-409708087 Reported-by: Hannu Nyman <hannu.nyman@iki.fi> Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* Revert "ar71xx: ag71xx: Add connect message: fixed phy"Jo-Philipp Wich2018-08-011-7/+0
| | | | | | | | | | | This reverts commit 0b9f4e880807e3cfd22d12b929202e1edcdc577c. This change reportedly breaks connectivity on some ar71xx devices, so revert it for now. Ref: https://github.com/openwrt/openwrt/pull/1217#issuecomment-409708087 Reported-by: Hannu Nyman <hannu.nyman@iki.fi> Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* Revert "ar71xx: ag71xx_phy: Fix compilation for debug messages"Jo-Philipp Wich2018-08-011-4/+2
| | | | | | | | This reverts commit 2655fbe8efb2a596aa8db92cffa817e3bf0c64ea. The patch introduces syntax errors, revert it for now. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* ar71xx: ag71xx: Prevent kernel oops for board defDaniel F. Dickinson2018-07-301-1/+15
| | | | | | | | | | | The driver is written in such a way that with a board defintion that connects a fixed phy, mdio, and switch in a certain way, a kernel oops could result because of lack of previously probed mdio bus. This commit allows for easier debugging in this case by casting the correct blame with serial console messages. Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
* ar71xx: ag71xx: Add connect message: fixed phyDaniel F. Dickinson2018-07-301-0/+7
| | | | | | | | It's a little noisier but makes it obvious when the ar7240 switch was connected to the MDIO bus, and to which phy device (or the failure to do so). Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
* ar71xx: ag71xx_phy: Fix compilation for debug messagesDaniel F. Dickinson2018-07-301-2/+4
| | | | | | | | | | | NB: Error only appears with ag71xx debug messages and dynamic printk enabled. This is probably why no one has caught it before. Previously phy probe debug messages used old (now wrong) functions to get the phy name for printing. There was also the chance of a NULL pointer in the event no phy_device was found. Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
* ar71xx: fix mii bus irq assignmentFelix Fietkau2018-03-042-3/+3
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* ar71xx: remove pdata->fifo_cfg*Felix Fietkau2018-03-041-3/+3
| | | | | | The values are the same for all chipsets that use it Signed-off-by: Felix Fietkau <nbd@nbd.name>
* ar71xx: fix build with ag71xx debugfs support enabledFelix Fietkau2018-02-281-6/+4
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* ag71xx: Move timestamp struct member outside of struct.Rosen Penev2018-02-282-4/+3
| | | | | | | | | | | | | | | With this change, the timestamp variable is only used in ag71xx_check_dma_stuck. Small tx speedup. Based on a Qualcomm commit. ag->timestamp = jiffies was not replaced with netif_trans_update(dev) because of this quote: It should be noted that after this series several instances of netif_trans_update() are useless (if they occur in .ndo_start_xmit and driver doesn't set LLTX flag -- stack already did an update). From: http://lists.openwall.net/netdev/2016/05/03/87 Signed-off-by: Rosen Penev <rosenp@gmail.com>
* ar71xx: use global timestamp for hang checkFelix Fietkau2018-02-052-6/+7
| | | | | | | Shrink the size of struct ag71xx_buf to 8 bytes, which improves cache footprint Signed-off-by: Felix Fietkau <nbd@nbd.name>
* ar71xx: only access device stats in tx handler if packets were processedFelix Fietkau2018-02-051-3/+3
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* ar71xx: allocate rx/tx descriptor/buffers in one chunkFelix Fietkau2018-02-051-47/+38
| | | | | | Reduces false sharing due to cache aliases Signed-off-by: Felix Fietkau <nbd@nbd.name>
* ag71xx: Reorder ag71xx struct members for better cache performanceRosen Penev2018-02-051-10/+17
| | | | | | | | | | | | | | | Qualcomm claims this improves the D-cache footprint. Origina commit message below: From: Ben Menchaca <ben.menchaca@qca.qualcomm.com> Date: Fri, 7 Jun 2013 10:57:28 -0500 Subject: [ag71xx] cluster/align structs for cache perf Cluster the frequently used, per-packet structures in ag71xx near to each other, and cacheline-align them. Some other re-ordering occurred to move "warmer" structures near the per-packet structures. Signed-off-by: Ben Menchaca <ben.menchaca@qca.qualcomm.com> Signed-off-by: Rosen Penev <rosenp@gmail.com>
* ar71xx: remove obsolete '< KERNEL_VERSION(4, 2, 0)' checkGabor Juhos2018-01-091-7/+0
| | | | | | | | | Because the oldest supported kernel version on the ar71xx target is 4.4, the condition that the kernel version is smaller than 4.2.0 is always false. Remove the obsolete check from ag71xx_main.c to clean up the code a bit. Signed-off-by: Gabor Juhos <juhosg@freemail.hu>
* ar71xx: remove obsolete '< KERNEL_VERSION(3, 15, 0)' checksGabor Juhos2018-01-091-12/+0
| | | | | | | | | Because the oldest supported kernel version on the ar71xx target is 4.4, the condition that the kernel version is smaller than 3.15.0 is always false. Remove the obsolete checks from the target specific source files to clean up the code a bit. Signed-off-by: Gabor Juhos <juhosg@freemail.hu>
* ag71xx: Fix rx ring buffer stall on small packets flood on qca956x and qca953x.Vittorio Gambaletta2017-12-291-0/+16
| | | | | | Backported from Code Aurora QSDK Signed-off-by: Vittorio Gambaletta <openwrt@vittgam.net>
* ar71xx: spi-rb4xx: balance clk_prepare_enable() callGabor Juhos2017-12-241-2/+2
| | | | | | | | | | | | | Commit c312cef223dd ("ar71xx: spi-rb4xx fix.") replaced the clk_enable() call with clk_prepare_enable() to meet the common clock framework requirements. However it did not change the clk_disable() call in the error patch which thus leads to imbalance. Fix the code by using the correct counterpart of clk_prepare_enable() in both places. Fixes: c312cef223dd ("ar71xx: spi-rb4xx fix.") Signed-off-by: Gabor Juhos <juhosg@freemail.hu>
* ag71xx: Reduce NAPI weight to 32.Rosen Penev2017-12-081-1/+6
| | | | | | | | | | | | | | Qualcomm claims this reduces cache misses. Original commit message below: From: Ben Menchaca <ben.menchaca@qca.qualcomm.com> Date: Tue, 11 Jun 2013 12:18:46 -0500 Subject: [ag71xx] reduce NAPI weight In an attempt to increase our cache warmth, we are decreasing NAPI. This increases the warmth of the reused SKBs. Signed-off-by: Ben Menchaca <ben.menchaca@qca.qualcomm.com> Signed-off-by: Rosen Penev <rosenp@gmail.com>
* Revert "ag71xx: Switch from driver to kernel macro for NAPI_WEIGHT."Rosen Penev2017-12-083-6/+7
| | | | | | The motivation for this was misguided. It turns out tuning the NAPI weight could be useful for testing purposes. Therefore reverting. Signed-off-by: Rosen Penev <rosenp@gmail.com>
* ag71xx: Switch from driver to kernel macro for NAPI_WEIGHT.Rosen Penev2017-11-063-7/+6
| | | | | | NAPI_POLL_WEIGHT was introduced in the kernel for exactly this purpose 5 years ago. Signed-off-by: Rosen Penev <rosenp@gmail.com>
* ar71xx: fix mikrotik routerboard nand driver issues with linux 4.9Felix Fietkau2017-10-243-27/+108
| | | | | | The mtd device is now embedded inside the nand chip data structure Signed-off-by: Felix Fietkau <nbd@nbd.name>
* Revert "ar71xx: Add GRO support to ag71xx"Felix Fietkau2017-10-171-3/+3
| | | | | | | | | | This reverts commit 13e5e473699b92f171205e0f5c57c9ebe7922492. This commit causes a severe regression in LAN->WAN routing performance for several devices. This appears to be caused by the extra requirement to validate the SKB checksum early in the rx path, which the ethernet hardware does not do Signed-off-by: Felix Fietkau <nbd@nbd.name>
* ar71xx: fix section mismatchesHauke Mehrtens2017-10-111-4/+4
| | | | | | Fix some section mismatches found with kernel 4.9. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* ar71xx: Add kernel 4.9 supportHauke Mehrtens2017-10-1111-71/+359
| | | | | | | | | | | | | This add support for kernel 4.9 to the ar71xx target. It was compile tested with the generic, NAND and mikrotik subtarget. Multiple members of the community tested it on their boards and did not report any major problem so far. Especially the NAND part received some changes to adapt to the new kernel APIs. The serial driver hack used for the Arduino Yun was not ported because the kernel changed there a lot. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* ar71xx: Add GRO support to ag71xxRosen Penev2017-09-111-3/+3
| | | | | | On a TL-WN710N, this patch increases iperf performance from ~92.5 to ~93.5 mbps. Keep in mind the WN710N is a 100mbps device. I expect greater numbers from gigabit devices. Signed-off-by: Rosen Penev <rosenp@gmail.com>
* ag71xx: add support for port mirroringMilan Krstić2017-07-211-0/+153
| | | | | | | This exposes hardware port mirroring in ag71xx driver (e.g. TL-WR841ND) via swconfig API. Signed-off-by: Milan Krstić <milan.krstic@gmail.com>
* ar71xx/ag71xx_ethtool: don't return uninitialized return value on successAlexander Couzens2017-06-111-1/+1
| | | | | | | | ag71xx_ethtool_set_ringparam() will return an uninitialized value on success. Found-by: Coverity Scan #1330877 Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
* ar71xx/ag71xx_mdio_probe: fix a memory leak when probe failsAlexander Couzens2017-06-111-1/+1
| | | | | Found-by: Coverity Scan #1330233 Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
* ar71xx/ag71xx_ar7240_get_port_link: fix off-by-one check on argument `port`Alexander Couzens2017-06-111-2/+2
| | | | | Found-by: Coverity Scan #1329901 Signed-off-by: Alexander Couzens <lynxis@fe80.eu>