summaryrefslogtreecommitdiffstats
path: root/target/linux/generic/files/drivers/net/phy
Commit message (Collapse)AuthorAgeFilesLines
* mvsw61xx: enable SerDes on 6176 if requiredJonas Gorski2016-09-262-0/+59
| | | | | | | | If the cpu port is connected through SGMII we need to enable SerDes for it to work. Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> Acked-by: Felix Fietkau <nbd@nbd.name>
* mvsw61xx: reset phys on probe to enable switch ports on clearfog proJonas Gorski2016-09-262-1/+54
| | | | | | | | The clearfog u-boot does not initialize the switch at all, so we need to power up the phys ourselves. Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> Acked-by: Felix Fietkau <nbd@nbd.name>
* kernel: b53: force BCM531x5 port 5 link state if enabledRafał Miłecki2016-09-081-0/+13
| | | | | | | | | | | Some devices (e.g. Tenda AC9 based on BCM47189B0) have BCM53125 with port 5 connected to the second Ethernet interface on the SoC. In such case there is no PHY and we need to force link manually. This assumes port 5 can be marked as enabled for such devices. It's not implemented yet unfortunately. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* swconfig: revert the portmapping patches, they seem to cause a segfaultJohn Crispin2016-08-161-0/+76
| | | | | | | | | | | | Revert "kernel/swconfig: remove obsolete portmapping feature from swconfig" This reverts commit 675407baa44a8700de20b6b2857009a552a807ba. Revert "swconfig: remove obsolete portmapping feature" This reverts commit fca1eb349ef31b133a62880cbd562d6bf17500aa. Signed-off-by: John Crispin <john@phrozen.org>
* kernel/swconfig: remove obsolete portmapping feature from swconfigJohn Crispin2016-08-151-76/+0
| | | | Signed-off-by: John Crispin <john@phrozen.org>
* kernel: adm6996: set carrier statusMathias Kresin2016-08-101-0/+5
| | | | | | | Due to the missing carrier status set, the interface wasn't usable on a BTHOMEHUB2B after ip link down and up as it is done in preinit. Signed-off-by: Mathias Kresin <dev@kresin.me>
* b53: allow ports with higher numbers than CPU portRafał Miłecki2016-07-241-2/+1
| | | | | | | | | | | | | | Our code was assuming CPU port uses the highest number. My BCM53573 device has eth0 connected to port 8 and eth1 connected to port 5. While working on support for it I tried to: 1) Enable all ports (including port 8) 2) Set CPU port to 5 I noticed port 8 is not accessible anymore. It was just a development process but it seems like something worth fixing anyway. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Acked-by: Jonas Gorski <jonas.gorski@gmail.com>
* kernel: rename B53 symbols to avoid upstream kernel conflictRafał Miłecki2016-06-202-18/+18
| | | | | | | | | In kernel 4.7 there is upstreamed b53 driver using (mostly?) the same symbols as our b53 does. Change our symbols so both drivers can coexist in kernel tree. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Acked-by: Jonas Gorski <jonas.gorski@gmail.com>
* kernel: require admin permissions for swconfig set operationsFelix Fietkau2016-06-121-0/+3
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* kernel: deny swconfig set requests for unprivileged usersJo-Philipp Wich2016-06-111-0/+3
| | | | | | | | | | | | | | | | | The swconfig kernel infrastructure fails to do any permissions checks when changing settings. As such an ordinary user account on a device with a switch can change switch settings without any special permissions. Routers generally have few non-admin users so this isn't a big hole, but it is a security hole. Likely the greatest danger is for multifunction devices which have a lot of extra daemons, compromising a low-security daemon would allow one to modify switch settings and cause the router/switch to appear to lock-up (or cause other sorts of troublesome nyetwork behavior). Implement a check for CAP_NET_ADMIN in swconfig_set_attr() and deny any requests originating from user contexts lacking this capability. Reported-by: Elliott Mitchell <ehem+openwrt@m5p.com> Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* treewide: replace nbd@openwrt.org with nbd@nbd.nameFelix Fietkau2016-06-0713-15/+15
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* AR8216: improve mmd register accessJohn Crispin2016-03-043-13/+17
| | | | | | | | | | | 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-044-4/+80
| | | | | | | | | | | | | | | | | 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: remove redundant port number in MIB header lineJohn Crispin2016-03-041-2/+1
| | | | | | | | | The line before includes the port number anyway so there's no need to duplicate the port number in the MIB info header. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 48912
* AR8216: complement MIB counters with info in GiB / MiB / KiBJohn Crispin2016-03-041-5/+40
| | | | | | | | | | The decimal values especially for TxByte and RxGoodByte are hard to read once bigger amounts of data have been transferred. Therefore complement the decimal values with info in GiB / MiB / KiB. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 48911
* AR8216: don't display MIB counters if all are emptyJohn Crispin2016-03-041-1/+8
| | | | | | | | | | | | For unused switch ports all MIB values are zero. Displaying ~40 empty MIB counters is just confusing and makes it hard to read the output of swconfig dev <dev> show. Therefore, if all MIB counters for a port are zero, just display an info that the MIB counters are empty. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 48910
* switch: allow Ethernet port LEDs to show specific port speeds onlyFelix Fietkau2016-02-251-5/+99
| | | | | | | | | | | | | This patch adds speed_mask special file to LEDs connected to switch ports via 'switch' trigger. It allows to choose which speeds to signal when link is up. If router has more than one LED per port, they may light up differently depending on how fast connection is. Default setting is 'all speeds' so backward compatibility with system scripts (for example uci) is maintained. Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl> SVN-Revision: 48775
* switch: make LED port_mask file write handler use kstrtoul() functionFelix Fietkau2016-02-251-25/+16
| | | | | | | | | | | This patch changes swconfig_trig_port_mask_store() handler to utilize kstrtoul() function instead of call to obsolete simple_strtoul(). Thanks to this change, new handler takes less memory and makes port_mask special file accept not only hexadecimal, but also decimal and octal numbers. Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl> SVN-Revision: 48774
* b53: support setting port linkRafał Miłecki2016-02-031-0/+31
| | | | | | | | | When dealing with Broadcom hardware we can simply use swconfig's generic helper, we just need to do some validation of requested state. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 48623
* b53: provide PHY access to swconfigRafał Miłecki2016-02-033-0/+48
| | | | | | | | | Thanks to this change swconfig can access port PHYs e.g. when setting port link state with a generic helper. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 48622
* swconfig: add (PHY) generic helper setting port linkRafał Miłecki2016-02-031-0/+36
| | | | | | | | | | It's quite common for switches to have PHY per port so adding a generic helper setting link state will help many drivers. It just needs an API to access PHYs which this patch also adds. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 48621
* swconfig: simplify init codeJonas Gorski2016-01-241-6/+1
| | | | | | | | | Directly return the return value of genl_register_family_with_ops() instead of storing it in a temporary variable, then returning it. Signed-off-by: Jonas Gorski <jogo@openwrt.org> SVN-Revision: 48472
* swconfig: drop linux < 3.13 code pathsJonas Gorski2016-01-241-20/+0
| | | | | | | | | The oldest kernel we support is 3.18, no need to keep code paths for older kernels. Signed-off-by: Jonas Gorski <jogo@openwrt.org> SVN-Revision: 48471
* b53: update header register difinitionsJonas Gorski2016-01-181-1/+2
| | | | | | | | | BCM531x5 has two pontential cpu ports, and header mode can be enabled independently on both. Signed-off-by: Jonas Gorski <jogo@openwrt.org> SVN-Revision: 48302
* ar8327: add IGMP Snooping supportFelix Fietkau2016-01-172-0/+232
| | | | | | | | | | | | | | | This add support for IGMP Snooping on atheros switches (disabled by default), which avoids flooding the network with multicast data. Tested on TL-WDR4300: disabling IGMP Snooping results in multicast flooding on each specific port, enabling it back again prevents each port from receiving all multicast packets. Partially based on: http://patchwork.ozlabs.org/patch/418122/ Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> SVN-Revision: 48268
* swconfig: add API for setting port link speedRafał Miłecki2016-01-061-1/+48
| | | | | | | | | Some switches can force link speed for a port. Let's add API that will allow drivers to export this feature. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 48142
* swconfig: switch kernel PORT_LINK support to SWITCH_TYPE_LINKJohn Crispin2015-12-231-47/+4
| | | | | | | | | As explained earlier, using SWITCH_TYPE_LINK gives more flexibility, it doesn't require e.g. string parsing to read some data. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 47999
* swconfig: add SWITCH_TYPE_LINK and support sending link info to user spaceJohn Crispin2015-12-231-0/+56
| | | | | | | | | | | | | So far we were sending link data as a string. It got some drawbacks: 1) Didn't allow writing clean user space apps reading link state. It was needed to do some screen scraping. 2) Forced whole PORT_LINK communication to be string based. Adding support for *setting* port link required passing string and parting it in the kernel space. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 47997
* ar8216: rework/fix AR8337 MAC swap handlingFelix Fietkau2015-12-201-3/+3
| | | | | | | | | | | | | | In r45970 the MAC swap handling was made opt-in, however some boards have been forgotten during the conversion. Since the reference design uses this MAC swapping, and pretty much all known boards using this chip seem to do so too, enabling the swapping is a more reasonable default than leaving it disabled. Change the code to still allow boards to opt-out of this. Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 47956
* kernel: mvswitch: merge 3.10+ compile fix into the codeJonas Gorski2015-12-041-3/+3
| | | | | | | | | The lowest we support is 3.18, so no need to keep it as a separate patch. Signed-off-by: Jonas Gorski <jogo@openwrt.org> SVN-Revision: 47749
* generic: fix adm6996 initJohn Crispin2015-10-261-0/+6
| | | | | | | | | | | | Kernel 3.14 added aditional genphy_soft_reset phy reset to phy_init_hw in drivers/net/phy/phy_device.c Since adm6996 does in driver soft reset and doesn't use BMCR_RESET for soft reset add dummy soft_reset callback to adm6996 driver, like it is done in ar8216. This fixes ticket #20147 Signed-off-by: Andrej Vlasic <andrej.vlasic0@gmail.com> SVN-Revision: 47272
* mvsw61xx: match swconfig function namesFelix Fietkau2015-09-111-4/+4
| | | | | | Signed-off-by: Claudio Leite <leitec@staticky.com> SVN-Revision: 46865
* mvsw61xx: use standard swconfig get_port_linkFelix Fietkau2015-09-111-76/+18
| | | | | | | | | The previous "link" and "status" functions were non-standard, and thus less useful for parsing. Signed-off-by: Claudio Leite <leitec@staticky.com> SVN-Revision: 46864
* Previously, all VLANs (port-based or 802.1q) were sharing a single database ↵Imre Kaloz2015-08-212-4/+19
| | | | | | | | | | | | | | | | in the ATU. This created problems in the case of a system where two ports/devices share a MAC address (e.g. Linksys WRT1900AC eth0/eth1). This also clears any bootloader-set FDB defaults. This had caused issues creating port-based VLANs when mappings overlapped previous VLANs. Packets destined to a port not in the default port group flooded all ports. Tested on a 88E6171 (Linksys EA4500) and 88E6172 ('1900AC) Signed-off-by: Claudio Leite <leitec@staticky.com> Signed-off-by: Imre Kaloz <kaloz@openwrt.org> SVN-Revision: 46699
* ar8216: add swconfig attributes for ARL table flushingFelix Fietkau2015-07-153-1/+67
| | | | | | | | Add swconfig attributes for flushing the ARL table globally or per port. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 46382
* ar8216: adjust ATU flushing in case of link changesFelix Fietkau2015-07-151-6/+4
| | | | | | | | | | If a link goes down, don't flush the complete ARL table. Only flush the entries for the respective port. Don't touch ARL table if a link goes up. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 46381
* ar8216: add ARL table flushing per portFelix Fietkau2015-07-154-4/+47
| | | | | | | | | | | | | 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-152-8/+98
| | | | | | | | | | | | | | | | 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
* kernel: b53: fix build with brcm47xxHauke Mehrtens2015-07-031-0/+5
| | | | | | | | | The position of the nvram header file on brcm47xx changed with kernel version 4.1. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> SVN-Revision: 46170
* b53: Allow using all 8 ports on BCM53011Rafał Miłecki2015-06-211-1/+1
| | | | | | | | | | | On two tested devices: Netgear R6250 (BCM53011 rev 2) and Luxul XWC-1000 (BCM53011 rev 3) it was possible to use port 7 and eth1 (instead of port 5 and eth0). It seems BCM53011 just like BCM53012 has 8 ports and usually 3 of them are connected to the SoC. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 46104
* ar8216: Fix problem with AR8337 MAC swap handlingFelix Fietkau2015-06-141-3/+3
| | | | | | | | | | | | | | | | | | | | | AR8337 supports a configuration bit to swap MAC0 and MAC6. Currently this is set in general if an AR8337 is detected and causes issues with devices using an AR8334 (internally an AR8337, just less chip pins). And it might even cause issues with AR8337-based devices with different board designs. Swapping the MAC's however isn't needed for AR8337 in general. It's just needed in case of certain board designs (affected devices seem to be based on Atheros reference board AP135/136-010). Therefore this configuration bit should be moved to platform data. The patch includes the needed changes to the device initialization code of affected devices. Hopefully I didn't miss any .. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 45970
* b53: fix memory out of bounds access on 64 bit targetsJonas Gorski2015-06-101-2/+2
| | | | | | | | | | | | | On device reset the sizes for the vlan and port tables were wrongly calculated based on the pointer size instead of the struct size. This causes buffer overruns on 64 bit targets, resulting in panics. Fix this by dereferencing the pointers. Reported-by: Fedor Konstantinov <blmink@mink.su> Signed-off-by: Jonas Gorski <jogo@openwrt.org> SVN-Revision: 45938
* b53: widen stp state mask to 3 bits (instead of 2)Jonas Gorski2015-06-101-1/+1
| | | | | | | | | | | | | | | At least on my b53 chip, the mask is 3 bits wide, and because of this some STP states are not set properly and discarded when read. Maybe for some other chips it makes sense to have just 2 bits width, but I don't have other versions around to test/validate. If that's the case then maybe we could add another STP state mask. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com> Signed-off-by: Jonas Gorski <jogo@openwrt.org> SVN-Revision: 45937
* b53: Allow using all ports on BCM53012Rafał Miłecki2015-05-121-1/+1
| | | | | | | | | | | | | This chipset has at least 8 usable ports, e.g. Netgear R8000 has ports 5, 7 and 8 connected to Ethernet interfaces: vlan1ports=0 1 2 3 5 7 8* vlan2ports=4 8u Port 6 seems to be always disabled. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Acked-by: Jonas Gorski <jogo@openwrt.org> SVN-Revision: 45676
* b53: improve overriding CPU port state on BCM5301XRafał Miłecki2015-04-122-2/+30
| | | | | | | | | | | | | | | | | On BCM5301X there are two different cases to handle: CPU port 8 vs. any other one. Support for CPU port 8 was already partially implemented but it lacked setting some extra bit for 2G speed. It also will need to be extended to implement "SMP dual core 3 GMAC setup". That's the reason for handling it in separated code block. This patch also adds overriding CPU port state for port other than 8. It requires using recently defined GMII_PORT registers. It was tested for regressions on BCM53011 revs 2 & 3. It was also confirmed to fix switch on some internal Broadcom board. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Acked-by: Jonas Gorski <jogo@openwrt.org> SVN-Revision: 45402
* b53: clean up code to match kernel style betterJonas Gorski2015-04-106-20/+23
| | | | | | | | | | | | | * properly enclose macro arguments in paranthesis on use * remove trailing white space * convert C99 // comments * add missing blank lines after declaration * remove braces from single statement blocks * split lines > 80 chars (except for one) Signed-off-by: Jonas Gorski <jogo@openwrt.org> SVN-Revision: 45356
* b53: define registers available and needed on BCM5301XJonas Gorski2015-04-101-0/+33
| | | | | | | | They are also present on some BCM63xx switches. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 45355
* b53: reverse duplex bit meaning for IMP state override registerJonas Gorski2015-03-181-1/+1
| | | | | | | Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Jonas Gorski <jogo@openwrt.org> SVN-Revision: 44875
* b53: global config is part of the management page, not the control pageJonas Gorski2015-03-151-2/+2
| | | | | | | | | | It will now actually enable the mib counters instead of enabling rx/tx for the first switch port. Reported-by: Daniel Gonzalez <dgcbueu@gmail.com> Signed-off-by: Jonas Gorski <jogo@openwrt.org> SVN-Revision: 44788
* swconfig: fix build with linux 4.0John Crispin2015-03-061-3/+6
| | | | | | Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> SVN-Revision: 44617