Commit graph

340 commits

Author SHA1 Message Date
Felix Fietkau
1961f8cdb7 ar71xx: ack completed tx descriptors only after the full frame has been completed
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 42457
2014-09-10 12:56:24 +00:00
Felix Fietkau
60eeadd0ba ar71xx: re-enable descriptor splitting on ar716x after the previous bugfixes (#13072)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 42429
2014-09-06 17:51:48 +00:00
Felix Fietkau
2da2317fed ar71xx: fix off-by-one error in packet descriptor splitting (patch from #13072)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 42428
2014-09-06 17:51:44 +00:00
Felix Fietkau
05dd36a980 ar71xx: on ar716x, split ethernet packets in 512 byte chunks instead of 256 (improves performance) (patch from #13072)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 42427
2014-09-06 17:51:39 +00:00
Felix Fietkau
926f000b99 ar71xx: disable ethernet descriptor splitting for now, as it seems to cause tx hangs in some setups
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 42333
2014-08-30 09:11:41 +00:00
Felix Fietkau
2c680151e4 ar71xx: split packets into multiple descriptors on ar716x
This improves performance when doing concurrent rx/tx on a single
ethernet MAC, e.g. when routing between VLANs.

Fixes #13072

Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 42328
2014-08-29 19:42:08 +00:00
Hauke Mehrtens
f5e5477c81 kernel: modify mtd related patches for 3.14
The change is the same as ("kernel/generic: modify mtd related
patches"). Since these files are under files directory, not a files
directory of specific kernel version, better to also change them. So
it will avoid adding files to future specific files directory
(e.g. files-3.14) for this mtd related change.

Signed-off-by: Zhao, Gang <gamerh2o@gmail.com>

SVN-Revision: 40732
2014-05-08 21:52:04 +00:00
Gabor Juhos
3d906ac6ac ar71xx: rb91x-nand: rewrite to use GPIO API
Rewrite tha rb91x-nand driver to use GPIO API to
modify the NAND control lines.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 39700
2014-02-23 07:19:32 +00:00
Gabor Juhos
ab08c40487 ar71xx: add a generic GPIO latch driver
It will be used for the Mikrotik boards.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 39697
2014-02-22 18:05:29 +00:00
Gabor Juhos
30ebad2dee ar71xx: ag71xx: increase calculated max frame length value
The r39147 commit introduces a regression: at lease on some routers
with ar8216 switch large packets get lost if 802.1q tagged port is
used on the interface connected to the aforementioned switch.

The r39147 changes code in the way so interface is set to accept
packets no longer than max ethernet frame length for a given mtu.

Unfortunately ar8216 has a feature: it sends two additional bytes
as a packet header and those this header needs to be added to the
max frame length. Otherwise long enough packets get lost.

The problem only manuifests itself if interface is used in vlan
tagged mode. If interface is untagged then ar8216's header fits
into space used by 802.1q tag and not packets are lost.

Include two additional bytes in the max frame length calculation
to fix the issue.

This patch is tested and works with Trendnet TEW-632BRP.

Signed-off-by Nikolay Martynov <mar.kolya@gmail.com>
Patchwork: http://patchwork.openwrt.org/patch/4656/
[juhosg:
  - simplify the patch to include the additional bytes of the
    switch header unconditionally,
  - change subject and update commit message]
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 39219
2014-01-11 11:15:30 +00:00
Gabor Juhos
2b220f3550 ar71xx: ag71xx: fix max frame length setup of the built-in switches
The currently used bitmask of the maximum frame length field
is wrong for both models. On AR724x/AR933x the largest frame
size is 2047 bytes, on the AR934x it is 16383 bytes.

Make the MTU setup code model specific, and use the correct
bitmask for both models. Also change the value to the maximum.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 39148
2013-12-20 11:41:22 +00:00
Gabor Juhos
35d601f974 ar71xx: ag71xx: calculate max frame len register value from the MTU
Set the MAX_FRAME_LEN register to zero in ag71xx_hw_init()
and write the correct value into that from the ag71xx_open()
and ag71xx_fast_reset() functions.

Also recalculate the RX buffer size based on the actual
maximum frame length value to optimize memory allocation.
Additionaly, disallow to change the MTU value while the
interface it running.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 39147
2013-12-20 11:41:20 +00:00
Gabor Juhos
9e7d77de2d ar71xx: ag71xx: add ag71xx_max_frame_len() helper
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 39146
2013-12-20 11:41:18 +00:00
Gabor Juhos
2c4e3cf33a ar71xx: ag71xx: get max_frame_len and desc_pktlen_mask from platform data
This will allow to use SoC specific values for both.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 39145
2013-12-20 11:41:17 +00:00
Gabor Juhos
9be1e508f9 ar71xx: ag71xx: store descriptor packet length mask in ag71xx struct
The currently used bitmask is not correct for all SoCs.
Introduce a new field in struct ag71xx and store the
bitmask in that. Use the current value for now, it will
be adjusted for each SoCs in further patches.

Aslo use the new field directly in the ag71xx_rx_packets
and ag71xx_hard_start_xmit() functions and remove the
ag71xx_desc_pktlen() helper.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 39144
2013-12-20 11:41:16 +00:00
Gabor Juhos
8b712436f3 ar71xx: implement callback in mdio reset
This enables us to add fixups to the board specific code for boards that
require special treatment of PHYs on mdio bus reset.

Signed-off-by: Felix Kaechele <heffer@fedoraproject.org>
http://patchwork.openwrt.org/patch/4614/
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 39127
2013-12-17 22:14:10 +00:00
Gabor Juhos
31de995025 ar71xx: ag71xx: compute the RX buffer size from the maximum frame size
Currently, the AG71XX_RX_PKT_SIZE value limits the received
frame size to 1514/1516 bytes with/without a VLAN header
respectively. However the hardware limit is controlled by
the value the AG71XX_REG_MAC_MFL register which contains
the value of the max_frame_len field.

Compute the RX buffer size from the max_frame_len field
to get rid of the 1514/1516 byte limitation. Also remove
the unused AG71XX_RX_PKT_SIZE definition.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 39121
2013-12-17 16:27:46 +00:00
Gabor Juhos
b35e0da0f4 ar71xx: ag71xx: store RX buffer size in the ag71xx struct
This allows to change the value dynamically.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 39120
2013-12-17 16:27:44 +00:00
Gabor Juhos
6072e777e9 ar71xx: ag71xx: store maximum frame length in the ag71xx struct
This will allow to use different values for the
different SoCs.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 39117
2013-12-17 15:18:16 +00:00
Gabor Juhos
ea89cc9250 ar71xx: ag71xx: use mdio bus name in ar7240_probe messages
The ar7240_probe function uses the network device name
in the kernel log messages, however the name is not yet
initialized when the ar7240_probe function is called.
Use the mdio bus name in the messages to avoid ugly
log lines like the following one:

  eth%d: Found an AR7240/AR9330 built-in switch

Reported-by: Ronald Wahl <ronald.wahl@raritan.com>
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 39116
2013-12-17 15:12:52 +00:00
Gabor Juhos
0d7a6748e1 ag71xx: ag71xx: use device name for debugfs entry
The ag71xx debugfs code uses the network device name
for the device specific debugfs directory. Since r38689
'ar71xx: ag71xx: fix a race involving netdev registration'
the debugfs initialization happens before the ethernet
device gets registered and the network device name contains
'eth%d' at this point. If the board setup code registers
multiple ag71xx devices, the debugfs code tries to create
the device specific dir with the same name which causes
an error like this:

  eth0: Atheros AG71xx at 0xba000000, irq 5, mode:GMII
  ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.1:04 [uid=004dd041, driver=Generic PHY]
  ag71xx: probe of ag71xx.0 failed with error -12

Use the device name for the debugfs directory to avoid the
collisions. Also add an error message and change the return
code if the debugfs_create_dir call fails.

Reported-by: Ronald Wahl <ronald.wahl@raritan.com>
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 39115
2013-12-17 15:12:50 +00:00
Gabor Juhos
8461ffccc1 ar71xx: add NAND driver for the Mikrotik RB91x boards
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 39097
2013-12-16 12:57:24 +00:00
Gabor Juhos
ec09569b17 ar71xx: ag71xx: fix ag71xx_probe error path
Signed-off-by: Catalin Patulea <cat@vv.carleton.ca>
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 38716
2013-11-11 07:47:00 +00:00
Gabor Juhos
7bd3a7bc7b ar71xx: ag71xx: fix a race involving netdev registration
In particular, phy_connect before register_netdev. This is because
register_netdev runs the netdev notifiers, which can race with the rest of
the initialization in ag71xx_probe. In my case this manifested in two ways:

1) If ag71xx is compiled as a module and inserted after netifd has started,
   netifd is notified by register_netdev before the call to
   ag71xx_phy_connect. netifd tries to bring the interface up, which calls
   ag71xx_open, which in turn enters ag71xx_phy_start. This keys off
   ag->phy_dev (which is still NULL) and thinks this is a fixed-link board,
   and enters ag71xx_link_adjust. This looks at ag->speed which is not yet
   initialized and hits the BUG() in the switch (ag->speed) in
   ag71xx_link_adjust.

   This is the wrong code path for ag71xx_phy_start - my board has PHYs that
   need to be brought up with phy_start. Doing ag71xx_phy_connect before
   register_netdev ensures that ag->phy_dev is non-NULL before
   ag71xx_phy_start is ever called.

2) When ag71xx is built into the kernel, and netconsole is enabled, there
   is a gap in the initial burst of replayed printks right after the netdev
   comes up. My assumption is that netconsole is also triggered by a netdev
   notifier, and part of this printk burst happens before the call into
   ag71xx_phy_connect, so part of the burst is lost while the PHY comes up.
   This patch fixes the gap - all the printks before eth0 comes up are bursted
   in full when netconsole initializes.

ag71xx_phy_connect_xxx no longer runs with a registered netdev, so the
logging has been adjusted accordingly to avoid "unregistered net_device" or
"eth%d" messages in dmesg.

Signed-off-by: Catalin Patulea <cat@vv.carleton.ca>
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 38689
2013-11-08 08:17:54 +00:00
Gabor Juhos
7815af409a ar71xx: ar934x-nfc: disable subpage write when hardware ECC is used
It is not supported by the controller.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 38234
2013-09-27 11:15:34 +00:00
Gabor Juhos
e33ccdc295 ar71xx: use netgear prefix for WNDR3700 LED names
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 38098
2013-09-21 15:55:50 +00:00
Gabor Juhos
d6fef0cb39 ar71xx: ar934x_nfc: add experimental support for hardware ECC
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 38069
2013-09-19 18:43:41 +00:00
Gabor Juhos
ceecdfb1c9 ar71xx: ar934x_nfc: return error code from some low-level functions
Change some flow-level unctions to return with an
error code in order to be able to report errors
to the core code.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 38068
2013-09-19 18:43:40 +00:00
Gabor Juhos
df8485c7cb ar71xx: ar934x_nfc: use devm_* functions
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 38067
2013-09-19 18:43:38 +00:00
Felix Fietkau
bbd4d4c8b8 ar71xx: ethernet: reduce tx dma ring size further to improve cache footprint
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 37765
2013-08-13 10:35:10 +00:00
Felix Fietkau
58e049ea80 ar71xx: ethernet: reduce tx and rx DMA ring size to improve cache footprint
256 entries is a bit excessive, even for gigabit speeds

Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 37762
2013-08-12 17:26:03 +00:00
Felix Fietkau
f43b4ea962 ar71xx: ethernet: cache skb->len in the tx function to avoid accessing it again in completion
Improves ethernet performance, especially during bridging

Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 37761
2013-08-12 17:26:00 +00:00
Felix Fietkau
53c3b2a193 ar71xx: fix typo
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 37759
2013-08-12 12:41:53 +00:00
Felix Fietkau
f18fd5512e ar71xx: ethernet: skip calls to netdev_completed_queue and netif_wake_queue if no tx cleanup was done
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 37758
2013-08-12 11:44:35 +00:00
Felix Fietkau
81cfb9e5ed ar71xx: ethernet: do not update the unused dev->last_rx field
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 37757
2013-08-12 11:44:31 +00:00
Felix Fietkau
104ff48e25 ar71xx: add missing return statement in ethernet mtu change op
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 37756
2013-08-12 11:44:28 +00:00
Felix Fietkau
7b05fe59a4 ar71xx: allow mtu > 1500 based on the configured tx/rx mtu register value
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 37748
2013-08-10 15:31:38 +00:00
Felix Fietkau
64dde7d981 ar71xx: add linux 3.10
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 37214
2013-07-09 12:52:18 +00:00
Gabor Juhos
4341b11f3e ar71xx: remove __dev{init,exit} annotations from kernel files
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 35687
2013-02-19 20:52:06 +00:00
Felix Fietkau
2e7a4b088d ar71xx: allow unknown multicast frames to pass to the CPU on AR934x
SVN-Revision: 35564
2013-02-11 18:59:05 +00:00
Gabor Juhos
1dc2b6e8fa ar71xx: ag71xx: show PHY interface mode in dmesg
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 34880
2012-12-25 18:45:29 +00:00
Gabor Juhos
9edcd9d3a3 ar71xx: ag71xx: fix mii_bus_dev sanity check
The mii_bus device is not required if phy_mask is zero.
The driver will use a fixed connection if it is not
specified.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 34849
2012-12-22 12:12:41 +00:00
Gabor Juhos
ad0f03d250 ar71xx: ag71xx: don't start/stop built-in switch w/o mii_bus_dev
Trying to do that causes a NULL pointer dereference:

CPU 0 Unable to handle kernel paging request at virtual address 00000000, epc == 801d170c, ra == 801d18d4
Oops[#1]:
Cpu 0
$ 0   : 00000000 00000000 00000000 00000001
$ 4   : 00000000 802e6390 ffff8f45 00000001
$ 8   : 804b5360 ffffff80 802f93bc 00000000
$12   : 802f93e8 00000000 00000000 00000000
$16   : 8381aba0 8381aba0 00000000 00000000
$20   : 8295eff0 00000032 80000000 004101b8
$24   : 00000000 777265b0
$28   : 82936000 82937cf0 00420000 801d18d4
Hi    : 00000000
Lo    : 00000001
epc   : 801d170c ar7240sw_reset+0x1c/0x19c
    Tainted: G           O
ra    : 801d18d4 ag71xx_ar7240_start+0x28/0xc0
Status: 1100fc03    KERNEL EXL IE
Cause : 00800008
BadVA : 00000000
PrId  : 00019750 (MIPS 74Kc)
Modules linked in: ath79_wdt ohci_hcd ledtrig_usbdev ledtrig_netdev
nf_nat_irc nf_nat_ftp nf_conntrack_irc nf_conntrack_ftp
 ipt_MASQUERADE iptable_nat nf_nat pppoe xt_conntrack xt_CT xt_NOTRACK
iptable_raw xt_state nf_conntrack_ipv4 nf_defrag_ipv4 nf_conntrack
ehci_hcd pppox ipt_REJECT xt_TCPMSS xt_LOG xt_comment xt_multiport
xt_mac xt_limit iptable_mangle iptable_filter ip_tables xt_tcpudp x_tab
les ppp_async ppp_generic slhc ath9k(O) ath9k_common(O) ath9k_hw(O)
ath(O) mac80211(O) usbcore usb_common nls_base crc_ccitt cfg80211(O) c
ompat(O) arc4 aes_generic crypto_blkcipher cryptomgr aead crypto_hash
crypto_algapi ledtrig_timer ledtrig_default_on leds_gpio gpio_button
_hotplug(O)
Process netifd (pid: 677, threadinfo=82936000, task=82cbe140, tls=77803750)
Stack : ffffffff 80087900 00000001 82937d74 8381aba0 8381aba0 00000000 00000000
        8295eff0 801d18d4 8295eff0 801fa4a4 00420000 80092158 00000002 8381aba0
        8381a800 00000000 00000080 801cf900 8027e720 00000000 00000000 8009223c
        8381a800 8381a82c 8027e720 00000000 00000000 7f9d14f0 00420000 801ec08c
        8381a800 801ebfb0 33000000 82937e30 00000001 8381a800 00001003 801ec348
        ...
Call Trace:
[<801d170c>] ar7240sw_reset+0x1c/0x19c
[<801d18d4>] ag71xx_ar7240_start+0x28/0xc0
[<801cf900>] ag71xx_open+0x1d0/0x258
[<801ec08c>] __dev_open+0xcc/0x130
[<801ec348>] __dev_change_flags+0xc0/0x160
[<801ec490>] dev_change_flags+0x20/0x6c
[<801ec5c8>] dev_ifsioc+0xec/0x348
[<801ecdb8>] dev_ioctl+0x594/0x67c
[<800ec00c>] do_vfs_ioctl+0x598/0x5ec
[<800ec0b0>] sys_ioctl+0x50/0x90
[<8006a3c4>] stack_done+0x20/0x40
Code: afbf0024  afb40020  afb10014 <8c910000> 00809021  24100104 24130704  8e440000  02002821

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 34848
2012-12-22 12:12:40 +00:00
Gabor Juhos
1f7ae58a2c ar71xx: ar934x_nfc: allow to control DMA data swap via platform data
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 34588
2012-12-10 10:38:07 +00:00
Gabor Juhos
188908e885 ar71xx: make rb750_nand driver compatible with 3.7
Also add compatibility patches for the currently
supported kernels.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 34279
2012-11-20 16:29:43 +00:00
Gabor Juhos
8194237789 ar71xx: make ar934x_nfc driver compatible with 3.7
Also add compatibility patches for the currently
supported kernels.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 34278
2012-11-20 16:29:42 +00:00
Gabor Juhos
46a3b818b9 ar71xx: remove buffer verification reference from rb4xx_nand.c
It is a dead code.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 34276
2012-11-20 14:40:22 +00:00
Gabor Juhos
d833ca527d ar71xx: restore rb4xx kernel partition size to the original value
The new lzma compressed elf kernel image fits into
that, even on devices with large page NAND chips.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 34274
2012-11-20 12:17:45 +00:00
Gabor Juhos
a6549ac1cb ar71xx: remove NO_AUTOINCR flag from the NAND drivers
The flag is not present in 3.6.
Also add compatibility patches for 3.3.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 33971
2012-10-28 12:21:15 +00:00
Gabor Juhos
e2ec99889e ar71xx: ag71xx: fix build_skb arguments for 3.6
Also add a compatibility patch for 3.3

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 33969
2012-10-27 17:11:06 +00:00