summaryrefslogtreecommitdiffstats
path: root/target/linux/generic/files/drivers/net/phy/ar8216.c
Commit message (Collapse)AuthorAgeFilesLines
* ar8216: fix ATU flushingFelix Fietkau2015-01-241-8/+3
| | | | | | | | | | | | | | | | | | The functionality to flush the address translation table contains two bugs which luckily compensate each other. 1. Just setting the operation is not sufficient to perform the flushing. The "active" bit needs to be set to actually trigger an action. For the vtu operations this is implemented correctly. 2. ar8xxx_phy_read_status is called every 2s by the phy state machine to check for link changes. This would have caused an ATU flush every 2s. Fix the chip-specific ATU flush functions and remove the ATU flush call from ar8xxx_phy_read_status. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 44101
* ar8216: add 802.3az EEE info to swconfig get_link attributeFelix Fietkau2015-01-181-0/+17
| | | | | | | | | | | | | 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-5/+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-6/+4
| | | | | | | | Introduce ar8xxx_reg_clear complementing ar8xxx_reg_set. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 44004
* ar8216: replace ar8xxx_rmw with ar8xxx_reg_set where appropriateJohn Crispin2015-01-171-8/+5
| | | | | | | | Replace ar8xxx_rmw with ar8xxx_reg_set where appropriate. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 44003
* ar8216: define all switch_addr structs as constJohn Crispin2015-01-171-3/+3
| | | | | | | | Define all switch_addr structs as const. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 44002
* ar8216: factor out AR8327/AR8337-specific driver code into ar8327.cFelix Fietkau2015-01-051-1030/+29
| | | | | | | | | | 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-177/+1
| | | | | | | | | | 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: Inline function ar8xxx_create_miiFelix Fietkau2014-12-181-13/+3
| | | | | | | | Inline function ar8xxx_create_mii. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 43743
* ar8216: Remove read/write/rmw member functions from ar8xxx_privFelix Fietkau2014-12-181-65/+51
| | | | | | | | | | | | | | Remove read/write/rmw member functions from ar8xxx_priv There seems to be no real benefit of the ar8xxx_priv member functions read/write/rmw as one implementation exists for each of them only. Especially ar8xxx_mii_rmw is assigned to priv->rmw first and then mapped to ar8xxx_rmw. Rename the ar8xxx_mii_.. functions to ar8xxx_.. and use them directly. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 43742
* ar8216: Create helpers mii_read32 / mii_write32 for 32 bit MII opsFelix Fietkau2014-12-181-34/+40
| | | | | | | | | | Create helpers mii_read32 / mii_write32 for 32 bit MII ops. Rename r3 variable to page in ar8xxx_mii_write to make it consistent with the other ar8xxx_mii_xxxx functions. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 43741
* ar8216: Factor out chip-specific parameters from ar8xxx_probe_switchFelix Fietkau2014-12-181-117/+151
| | | | | | | | | Factor out chip-specific parameters from ar8xxx_probe_switch. Move the ar8xxx_chip definitions after the swops definitions. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 43740
* ar8216: remove unused function parameter in ar8327_led_registerFelix Fietkau2014-12-181-2/+2
| | | | | | | | Remove unused function parameter in ar8327_led_register. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 43739
* ar8216: enable cpu port to receive arp and broadcast frames for ar8236Felix Fietkau2014-12-121-0/+9
| | | | | | 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-7/+20
| | | | | | | | | 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: factor out mii_lo_first to ar8xxx_chipJohn Crispin2014-12-011-5/+5
| | | | | | | | Factor out mii_lo_first to ar8xxx_chip. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 43470
* ar8216: factor out chip-specific data structures from ar8xxx_privJohn Crispin2014-12-011-15/+16
| | | | | | | | Factor out chip-specific data structures from ar8xxx_priv. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 43469
* ar8216: factor out set_mirror_regs to ar8xxx_chipJohn Crispin2014-12-011-15/+13
| | | | | | | | | Factor out set_mirror_regs to ar8xxx_chip. Remove related chip_is_... checks. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 43468
* ar8216: factor out mib_func to ar8xxx_chipJohn Crispin2014-12-011-6/+6
| | | | | | | | Factor out mib_func to ar8xxx_chip. Remove related chip_is_... checks. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 43467
* ar8216: factor out info whether switch should be configured at probe stage ↵John Crispin2014-12-011-2/+4
| | | | | | | | | | | to ar8xxx_chip Factor out info whether switch should be configured at probe stage to ar8xxx_chip. Remove related chip_is_... checks. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 43466
* ar8216: suppress PHY reset for linux 3.14Felix Fietkau2014-11-271-2/+2
| | | | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 43410
* ar8216: Fix issue with autoneg being disabled under 3.14, revert 43332Felix Fietkau2014-11-241-2/+47
| | | | | | | | | | Patch reverts 43332 which seems to cause issues with VLAN functionality. Add a specific check to check whether ANEG is still enabled and re-enable it if necessary. Disable generic phy soft reset for kernel >=3.16. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 43356
* ar8216: Use generic hw_init from ar8236 for ar8216 tooFelix Fietkau2014-11-201-13/+7
| | | | | | | | | | We should make sure that also for ar8216 hw gets initialized. For ar8216 hw_init is a dummy currently. The hw_init used for ar8236 should be generic enough to be usable with ar8216 too. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 43334
* ar8216: simplify PHY fixup/initFelix Fietkau2014-11-201-19/+10
| | | | | | | | | | Move the PHY fixup call to the PHY init loop. Use ar8xxx_has_gige in the PHY init instead of passing the gigE capability via function parameter. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 43333
* ar8216: use genphy_config_aneg also for PHY 0Felix Fietkau2014-11-191-10/+1
| | | | | | | | | | | | | | | | | Kernel 3.14 introduced a switch reset in phy_init_hw in drivers/net/phy causing BMCR_ANENABLE to get cleared. Due to the fact that ar8xxx_phy_config_aneg does nothing for PHY 0 autonegatiation support remains disabled. This can cause ports to operate at 10MBit/half-duplex only. Fix this by calling genphy_config_aneg for PHY 0 too as genphy_config_aneg sets BMCR_ANENABLE if it's not yet set. Fixes: ticket 17800 Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 43332
* ar8216: factor out PHY init code into a generic functionFelix Fietkau2014-11-191-41/+25
| | | | | | | | | | PHY init code in the switch-specific hw_init functions is mainly identical. Factor it out into a generic ar8xxx_phy_init function. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 43331
* ar8216: introduce fixup_phys callback in ar8xxx_chipFelix Fietkau2014-11-191-2/+13
| | | | | | | | | Move phy fixup code from the chip-specific hw_init functions into a fixup_phys callback. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 43330
* ar8216: after a switch reset poll until BCMR_RESET is clearedFelix Fietkau2014-11-191-3/+29
| | | | | | | | | | | | Currently there is a fixed 1000ms wait time after the switch was reset. Most if not all switches need much less time to perform a reset. Therefore replace the fixed wait time with polling for BMCR_RESET to be cleared. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 43329
* ar8216: introduce global constant for number of PHYsFelix Fietkau2014-11-191-3/+5
| | | | | | | | | | 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: fix "unused variable" compiler warningJohn Crispin2014-11-141-1/+1
| | | | | | | | | | Most likely a copy & paste error when deriving ar8327_sw_set_ports from ar8xxx_sw_set_ports. Remove unused variable. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 43273
* ar8216: set the pvid based on runtime state instead of port number to fix ↵Felix Fietkau2014-10-021-3/+1
| | | | | | | | learning with enable_vlan = 0 Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 42753
* ar71xx: ar8216: tagged+untagged on ar8327 (#12181)Felix Fietkau2014-09-231-7/+53
| | | | | | | | | | | | | | | | | | This allows tagged and untagged traffic together on the same port on ar8327 switch devices. I looked at the first attempt to do this in r40777 (ar71xx: Fix tagged+untagged operation on AR8327N (#12181)). I also set the vlan and port egress policies like that change. But I change vlan_tagged in an less intrusive way. The tagged/untagged decision is now based on the following rules: - if vid != pvid then traffic is always tagged - if vid == pvid then vlan_tagged stores if the traffic should be tagged Tested on TP-Link WDR-3600 (ar8327N). Signed-off-by: Valentin Spreckels <Valentin.Spreckels@Informatik.Uni-Oldenburg.DE> SVN-Revision: 42653
* ar71xx: ar8216: move policies, pvid to setup_portFelix Fietkau2014-09-231-41/+52
| | | | | | | | | | | | | | This moves ingress, egress policy and pvid decisions to setup_port methods. They arenow device type dependent. This allows policy changes on only one device type which is needed to allow tagged + untagged operation on ar8327. Tested on TP-LINK WDR-3600 (ar8327N). Signed-off-by: Valentin Spreckels <Valentin.Spreckels@Informatik.Uni-Oldenburg.DE> SVN-Revision: 42652
* ar8216: add new phyid 0x004dd043 (ar8326)John Crispin2014-07-141-0/+1
| | | | | | Used in ubiquity nanostation xw boards SVN-Revision: 41635
* ar8216: disable EEE by default on AR8327 to fix stability issues (#14597)Felix Fietkau2014-07-101-0/+9
| | | | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 41577
* Revert "ar71xx: Fix tagged+untagged operation on AR8327N (#12181)"Jo-Philipp Wich2014-05-241-154/+72
| | | | | | | | | Revert the tagged + untagged rework for now due to regressions in vlan setup on certain AR83xx switches. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org> SVN-Revision: 40842
* ar71xx: Fix tagged+untagged operation on AR8327N (#12181)Jo-Philipp Wich2014-05-191-72/+154
| | | | | | | | | | | | | | Replace the global "vlan_tagged" variable with an array storing the tagging state per vlan. The code was taken from #12181, tested and cleaned up by Saverio Proto with additional bug fixes supplied by Álvaro Fernández. Tested-by: Jo-Philipp Wich <jow@openwrt.org> Signed-off-by: Saverio Proto <zioproto@gmail.com> Signed-off-by: Álvaro Fernández <noltari@gmail.com> SVN-Revision: 40777
* generic: ar8216: add custom LED support for the AR8327 switchGabor Juhos2014-01-201-0/+365
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 39338
* generic: ar8216: allow to use chip specific cleanup callbackGabor Juhos2014-01-201-0/+5
| | | | | | | | It will be used for AR8327. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 39337
* generic: ar8216: add optimized rmw operationGabor Juhos2014-01-201-20/+44
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 39336
* generic: ar8216: Enable jumbo frames on AR8327 by defaultGabor Juhos2013-12-151-2/+2
| | | | | | | | | | This patch enables jumbo frames on AR8327 switch by default. I have tested it on TP-Link TL-WDR3600. Signed-off-by: Piotr Dymacz <pepe2k@gmail.com> Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 39076
* generic: ar8216: add AR8337N switch supportGabor Juhos2013-11-291-6/+25
| | | | | | | | | | | | | | | | | 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: remove trailing whitespacesGabor Juhos2013-11-291-9/+9
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 38951
* generic: ar8216: allow to specify SGMII config via platform dataGabor Juhos2013-05-301-3/+22
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 36798
* generic: ar8216: add get_port_link callbackGabor Juhos2013-05-301-2/+17
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 36797
* generic: ar8216: show chip revision in the kernel logGabor Juhos2013-05-301-2/+3
| | | | | | Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 36791
* generic: ar8216: add port mirroringLuka Perkov2013-05-241-0/+310
| | | | | | | | | | | | | | | 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
* kernel: add missing PHY ID for an AR8327 switch variantFelix Fietkau2013-05-131-0/+1
| | | | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 36630
* generic: ar8216: start AR8327 switch from the probe routineGabor Juhos2013-03-151-1/+19
| | | | | | | | | | | | The AR8327 switch gets its configuration from platform data or from the device-tree. This allows to start it from the probe routine. Doing so makes it usable with ethernet drivers which only connects to the PHY device when the ethernet interface is opened. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 36050
* generic: ar8216: add ar8xxx_start helperGabor Juhos2013-03-151-11/+23
| | | | | | | | | Move switch starting code into a separate function. This makes it usable from other places. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 36049