aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/files/drivers/net/phy/ar8216.h
Commit message (Collapse)AuthorAgeFilesLines
* generic: ar8216: fix unknown packet flooding for ar8229/ar8236Chuanhong Guo2020-05-061-2/+2
| | | | | | | | | | | | ar8229 and ar8236 don't allow unknown unicast/multicast frames and broadcast frames to be flooded to cpu port. This isn't desired behavior for swconfig as we treat it as a standalone switch. Current code doesn't enable unicast frame flooding for ar8229 and uses wrong setup for ar8236. This commit fixes both of them by enabling port 0 flooding for all unknown frames. Fixes: FS#2848 Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
* generic ar8xxx: increase VLAN table for AR83x7David Bauer2019-11-301-2/+6
| | | | | | | | | | | | The Atheros AR8327 and AR8337 have (according to their datasheet) a VLAN table with a maximum of 4096 entries. Currently, there's a hard limit of 128 VLANs, which is the same as for most other Atheros switches. Increase this limit only for the AR83x7 series and modify some shared functions to allow them to work with a variable max VLAN count. Signed-off-by: David Bauer <mail@david-bauer.net>
* generic: ar8216: group MIB counters and use two basic ones only by defaultChuanhong Guo2019-05-201-0/+16
| | | | | | | | | | | | | | | | | There are too many MIB counters that almost nobody needs since commit d6366ce3665f ("generic: ar8216: mib_work_func: read all port mibs everytime"). In the worker function to poll MIB data, it deals with all ports instead of only one port every time, which introduces too many mdio operations that it becomes a heavy CPU load even on not-emulated MDIO bus. This commit groups MIB counters and enable only TxBytes and RxGoodBytes by default (both of which are necessary to get swconfig led working.) and adds an swconfig attribute to allow enabling all counters if users need them. Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
* generic: ar8216: add mib_poll_interval switch attributeChuanhong Guo2019-05-201-0/+8
| | | | | | | | | | | | | | This allows specifying interval of polling MIB counters from userspace and allow completely turning off MIB counter support by setting mib_poll_interval to 0. Since MIB counter polling is a heavy CPU load for GPIO emulated MDIO bus, disable this behavior by default. Those who wants to use swconfig LEDs can enable them with qca,mib-poll-interval dts property or with swconfig command. Fixes: FS#2230 ("kworker spikes 100% cpu every 2 second.") Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
* generic: ar8216: introduce qca,mib-poll-interval propertyChuanhong Guo2019-03-241-0/+1
| | | | | | | | This allows users to specify a shorter mib poll interval so that the swconfig leds could behave normal with current get_port_stats() implementation. Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
* generic: ar8216: mib_work_func: read all port mibs everytimeChuanhong Guo2019-03-241-1/+0
| | | | | | | | ar8xxx_mib_capture will update mib counters for all ports. Current code only update one port at a time and the data for other ports are lost. Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
* generic: ar8216: add support for get_port_stats()Chuanhong Guo2019-03-241-0/+11
| | | | | | | | | | | | | | | | | | | | | | | Partially reverts commit eff3549c5883a9abc5dbff00c084cabbcfdf4437. AR7240 and AR9341 have buggy hardware switch LED trigger. The AR7240 one doesn't blink and the blinking of port0/port5 is reversed on AR9341 if we swap PHY0 and PHY4. (Only blinking is reversed, which means LED for PHY0 will lit when PHY0 is link up and will blink when PHY4 has active link and vice versa.) On these two chips a software swconfig LED trigger is required. This commit adds swconfig port stats back but: 1. move checking of mib_t/rxb_id into ar8xxx_chip since we can't distinguish ar7240sw and ar8216 using only chip id. 2. don't update mib counter in get_port_stat. This function is called every 0.01s and this capturing procedure will take up a lot of CPU. We already have a mib_work_func updating mib counters every 2s so return the saved counter instead of fetching new data. The blinking rate will be weird but it should solve the previously mentioned CPU time problem. Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
* generic: ar8216: add support for ar724x/ar933x builtin switchChuanhong Guo2019-03-241-0/+3
| | | | | | | | | | | | | | This builtin switch is a bugless ar8216 with different mib counters and gigabit cpu port. Atheros uses the same device ID and it's impossible to distinguish the standalone one and the builtin one. So we add support to mdio device probe only. This switch doesn't have buggy vlan tag so it's not needed to enable atheros header. This commit changed ar8216_setup_port so that it can be reused for this switch. Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
* generic: ar8216: ar8229: add phy_read/phy_writeChuanhong Guo2019-03-241-0/+9
| | | | | | | the added function also works for ar8216 and will be used in the following ar7240 support. Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
* generic: ar8216: add support for separated mdio bus for phy accessChuanhong Guo2019-03-241-0/+3
| | | | | | | | | | | | | | Atheros FE switches have a builtin mdio master available for PHY accessing and on ar724x/ar933x builtin switches this mdio master is the only way of accessing PHYs. After this patch if there is phy_read/phy_write method available in ar8xxx_chip we register a separated mdio bus for accessing PHYs. Still adds support for mdio device probing only since this isn't needed for those switches registered using PHY probing. Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
* generic: ar8216: add support for ar8229Chuanhong Guo2019-03-241-0/+19
| | | | | | | | | | | | | | | | ar8229 is the builtin switch in ar934x and later chips. There is also a standalone version available and their registers/functions are the same. This commit added support for the builtin ar8229. The only thing missing for standalone ar8229 should be phy modes. Since I don't have a router using that, this commit doesn't add support for other phy modes. Only add its support for mdio-device probing method because the current PHY probing can't return 1G speed when it's a FE switch. Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
* generic: ar8216: add device struct into struct ar8xxx_privChuanhong Guo2019-03-241-0/+1
| | | | | | dev has been taken up by switch_dev so it's named pdev instead. Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
* kernel: ar83xx: Add support for three GMAC's connectionRam Chandra Jangir2018-12-061-0/+4
| | | | | | | | | | | | | We have IPQ8064 AP161 board which has three GMAC's * RGMII x2 * SGMII x1. The existing ar8327 driver does not have support for three GMAC's connection, hence this change adds support for the same. This has been verified on AP148 and AP161 board. Signed-off-by: xiaofeis <xiaofeis@codeaurora.org> Signed-off-by: Ram Chandra Jangir <rjangir@codeaurora.org>
* kernel: ar8xxx: get_arl_table now shows all ports of an entryGünther Kelleter2018-11-261-1/+2
| | | | | | | Multicast ARL entries can have multiple destination ports. Get and dump all destination ports of each entry, not just the lowest. Signed-off-by: Günther Kelleter <guenther.kelleter@devolo.de>
* kernel: ar83xx: add support to configure per port VLAN priorityTan Hong Hui2018-02-201-0/+1
| | | | | | | | | Add support to allow for per switch port VLAN priority (PCP) bits for the ar8327/8337 chip using the swconfig utility. Tested on Netgear R7800 Signed-off-by: Tan Hong Hui <hhtan72@yahoo.com>
* generic: drop support for get_port_stats() on ar8xxxThibaut VARENE2017-09-131-3/+0
| | | | | | | | | | | | | | | | The implementation is not efficient on ar8xxx switches. It triggers high CPU load and degrades device performance. The high CPU load has been traced down to the ar8xxx_reg_wait() call in ar8xxx_mib_op(), which has to usleep_range() till the MIB busy flag set by the request to update the MIB counter is cleared. This commit removes the get_port_stats() code introduced in 4d8a66d and leaves a note for future hacker's beware. Fixes: FS#1004 Signed-off-by: Thibaut VARENE <hacks@slashdirt.org>
* generic: provide get_port_stats() on ar8xxx switchesThibaut VARENE2017-09-011-0/+3
| | | | | | | | | | | | | This patch provides a generic switch_dev_ops 'get_port_stats()' callback by taping into the relevant port MIB counters. The implementation uses a generic callback that select the correct MIB counter index based on chip version. This callback is used by swconfig_leds led trigger to blink LEDs with port network traffic. Signed-off-by: Thibaut VARENE <hacks@slashdirt.org>
* net: ar8327: modify some configuration of switchPavel Kubelun2016-12-011-0/+1
| | | | | | | | | | | | | | | | Imported from https://source.codeaurora.org/quic/qsdk/system/openwrt/commit/?h=korg/linux-3.4.y/release/arugula_bb_cs&id=2be4f8a8b205ae1a37db44839864451ebe893e6e Signed-off-by: Pavel Kubelun <be.dissent@gmail.com> Enable flow control of LAN and WAN ports to get better performance. Setup pvid as 0 for all ports during initialisation to avoid confusion during system or switch INIT. Disable PORT MAC before config MAC to avoid it work abnormal. This change is for IR-054144, IR-057315. Change-Id: I345f3dffa59ad3f97150e09692723da12a7b1067 Signed-off-by: Zou Shunxiang <shunxian@codeaurora.org> Signed-off-by: xiaofeis <xiaofeis@codeaurora.org>
* treewide: replace nbd@openwrt.org with nbd@nbd.nameFelix Fietkau2016-06-071-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* AR8216: improve mmd register accessJohn Crispin2016-03-041-2/+2
| | | | | | | | | | | Combine all bus operations for one MMD access in one function. Protecting all these bus operations with one lock also helps to avoid potential issues due to bus operations intercepting the register and data write. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 48914
* AR8216: make ARL age time configurableJohn Crispin2016-03-041-0/+14
| | | | | | | | | | | | | | | | | The default TTL for address resolution table entries is 5 minutes for all members of the AR8216 family. This can cause issues if e.g. Wifi clients roam to another AP and their MAC appears on another switch port suddenly. Then the client may not be reachable until the old ARL entry expires. I would have expected the switch to invalidate old entries if it detects the same MAC on another port. But that's not the case. Therefore make the TTL for ARL entries configurable. The effective TTL will always be a multiple of 7 seconds. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 48913
* ar8216: add swconfig attributes for ARL table flushingFelix Fietkau2015-07-151-0/+8
| | | | | | | | Add swconfig attributes for flushing the ARL table globally or per port. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 46382
* ar8216: add ARL table flushing per portFelix Fietkau2015-07-151-2/+4
| | | | | | | | | | | | | Adds functions for flushing ARL table entries per port. Successfully tested on AR8327. Implementation for AR8216/AR8236/AR8316 is based on the AR8236 datasheet and assumes that the three chips share a common ATU register layout. Compile-tested only for AR8216/AR8236/AR8316. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 46380
* ar8216: add reading ARL table for AR8216/AR8236/AR8316Felix Fietkau2015-07-151-4/+21
| | | | | | | | | | | | | | | | Adds the chip-specific part of reading ARL table for AR8216/AR8236/AR8316. It's based on the AR8236 datasheet and compile-tested only as I couldn't find datasheets for AR8216/AR8316 and don't own devices with these chips. The existing ar8216_atu_flush implementation was used for all three chip types, therefore I guess they share a common ATU register layout. More testing would be appreciated. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 46379
* ar8216: prefix mii_xxx functions to avoid kernel namespace pollutionFelix Fietkau2015-01-241-2/+2
| | | | | | | | | Prefix the exported mii_xxx32 functions with ar8xxx_ to avoid kernel namespace pollution. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 44105
* ar8216: add swconfig attribute to display ARL table on AR8327/AR8337Felix Fietkau2015-01-241-0/+37
| | | | | | | | | | | | | | Add global read-only swconfig attribute "arl_table" to display the address resolution table. So far the chip-specific part is implemented for AR8327/AR8337 only as I don't have the datasheets for the other AR8XXX chips. Successfully tested on TL-WDR4300 (AR8327rev2) and TL-WDR4900 (AR8327rev4). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 44104
* ar8216: decrease page switch wait timeFelix Fietkau2015-01-241-0/+6
| | | | | | | | | | | | | | | | | | | | | | Until a few years ago the page switch wait time was set to msleep(1) what was changed to usleep_range(1000, 2000) later. I can not imagine that a low-level operation like switching page on register level takes so much time. Most likely the value of 1ms was initially set to check whether it fixes an issue and then remained w/o further checking whether also a smaller value would be sufficient. Now the wait time is set to 5us and I successfully tested this on AR8327. IMHO 5us should be plenty of time for all supported chips. However I couldn't test this due to missing hardware. If other chips should need a longer wait time we can add the wait time as a parameter to the ar8xxx_chip struct. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 44103
* ar8216: add link change detection for switch portsFelix Fietkau2015-01-241-0/+1
| | | | | | | | | | Check for switch port link changes and - flush ATU in case of a change - report link change via syslog Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 44102
* ar8216: add 802.3az EEE info to swconfig get_link attributeFelix Fietkau2015-01-181-0/+3
| | | | | | | | | | | | | AR8327/AR8337 allow to read the result of EEE autonegotiation. If EEE is autonegotiated between the link partners, display this as part of the swconfig get_link attribute. eee100: 100MBit EEE supported by both link partners eee1000: 1GBit EEE supported by both link partners Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 44022
* ar8216: introduce enable_eee swconfig attribute to control 802.3az EEE per portFelix Fietkau2015-01-181-0/+9
| | | | | | | | | | | | | | | | Users reported network issues with AR8327 which turned out to be caused by EEE not working correctly with certain link partners (ticket 14597). The workaround was to disable EEE on all ports (changeset 41577). The issue was with certain link partners only, therefore this patch allows to control usage of EEE per port via swconfig. Still the default is to initially disable EEE on all ports. Successfully tested on a TL-WDR4900 (AR8327 rev.4) Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 44021
* ar8216: introduce ar8xxx_reg_clear complementing ar8xxx_reg_setJohn Crispin2015-01-171-0/+6
| | | | | | | | Introduce ar8xxx_reg_clear complementing ar8xxx_reg_set. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 44004
* ar8216: factor out AR8327/AR8337-specific driver code into ar8327.cFelix Fietkau2015-01-051-0/+76
| | | | | | | | | | Move all AR8327/AR8337-specific driver code into a separate source file ar8327.c and adjust patches so that ar8327.c is compiled if CONFIG_AR8216_PHY is set. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 43845
* ar8216: move definitions from ar8216.c to ar8216.h and introduce ar8327.hFelix Fietkau2015-01-051-168/+140
| | | | | | | | | | Move several structure definitions and #defines from ar8216.c to ar8216.h and move AR8327/AR8337 header stuff into a new header file ar8327.h. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 43844
* ar8216: enable cpu port to receive arp and broadcast frames for ar8236Felix Fietkau2014-12-121-0/+3
| | | | | | Signed-off-by: Weijie Gao <hackpascal@gmail.com> SVN-Revision: 43668
* ar8216: factor out reg_port_stats_base parameters to ar8xxx_chipJohn Crispin2014-12-011-6/+0
| | | | | | | | | Factor out reg_port_stats_base parameters to ar8xxx_chip. Remove related chip_is_... checks. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 43471
* ar8216: introduce global constant for number of PHYsFelix Fietkau2014-11-191-1/+0
| | | | | | | | | | All supported switches have 5 PHYs. Currently partially 5 is hardcoded and partially switch-specific constants exist. Replace them with a global constant. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 43328
* ar8216: disable EEE by default on AR8327 to fix stability issues (#14597)Felix Fietkau2014-07-101-0/+3
| | | | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 41577
* generic: ar8216: add custom LED support for the AR8327 switchGabor Juhos2014-01-201-0/+3
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 39338
* generic: ar8216: add AR8337N switch supportGabor Juhos2013-11-291-0/+2
| | | | | | | | | | | | | | | | | This patch is needed to use the switch inside the Sitecom WLR-8100; it was unusable and detected as Generic-Phy before. since ar8337 is behaving like ar8327 generally do the same thing see: https://forum.openwrt.org/viewtopic.php?pid=214218#p214218 forward-ported to trunk Signed-off-by: Dirk Neukirchen <dirkneukirchen@web.de> Patchwork: http://patchwork.openwrt.org/patch/4469/ [juhosg: merge chip_is_ar83[23]7 statements in ar8xxx_phy_config_init] Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 38952
* generic: ar8216: allow to specify SGMII config via platform dataGabor Juhos2013-05-301-0/+6
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 36798
* generic: ar8216: add port mirroringLuka Perkov2013-05-241-0/+8
| | | | | | | | | | | | | | | Tested on Buffalo WZR-600DHP with ar8316 switch. Commands used to mirror both RX and TX traffic from LAN port 1 to LAN port 4: $ swconfig dev switch0 set enable_mirror_rx 1 $ swconfig dev switch0 set enable_mirror_tx 1 $ swconfig dev switch0 set mirror_monitor_port 4 $ swconfig dev switch0 set mirror_source_port 1 Signed-off-by: Colin Leitner <colin.leitner@googlemail.com> Tested-by: Luka Perkov <luka@openwrt.org> SVN-Revision: 36713
* generic: ar8216: add defines for the AR8316 POSTRIP registerGabor Juhos2013-02-101-0/+30
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 35539
* generic: ar8216: add sgmii_delay_en field to ar8327_platform_dataGabor Juhos2012-12-251-0/+1
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 34881
* generic: ar8216: add MIB counter support for the AR8216 switch as wellGabor Juhos2012-11-181-0/+40
| | | | | | | | Thanks to Jonas Gorski for the reference URL. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 34245
* generic: ar8216: rename AR8216_*_STATS_* definesGabor Juhos2012-11-181-42/+42
| | | | | | | | | | | The names are misleading, those are only valid from AR8236. The AR8216 chip uses different offsets. Thanks to Jonas Gorski for the report. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 34244
* generic ar8216: allow to read/reset MIB counters via swconfigGabor Juhos2012-11-181-0/+61
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 34243
* generic: ar8216: allow to configure AR8327 LEDs via platform dataGabor Juhos2012-06-191-0/+2
| | | | SVN-Revision: 32456
* generic: ar8216: add revision specific PHY fixups for AR8327Gabor Juhos2012-05-291-0/+2
| | | | SVN-Revision: 32000
* generic: ar8216: replace chip_type field with chip_{ver,rev} in ar8216_privGabor Juhos2012-05-291-9/+0
| | | | SVN-Revision: 31999
* generic: ar8216: add support for the AR8327 chipGabor Juhos2012-03-181-0/+142
| | | | SVN-Revision: 31011