aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/dsa
AgeCommit message (Collapse)AuthorFilesLines
2015-05-09net: dsa: mv88e6171: Add other members of the familyAndrew Lunn2-3/+12
The 6171 is one member of the family 6171/6175/6350/6351. Add the other family members to the driver. Not tested on these new devices. Signed-off-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-05-09net: dsa: Move mv88e6172 support into mv88e6352 family driverAndrew Lunn3-51/+15
The mv88e6172 is part of the mv88e6352 family of devices. Move support for it out of the mv88e6171 driver into the mv88e6352, which results in some simplifications to the code. Signed-off-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-05-09net: dsa: Converting remaining registers to mnemonicsAndrew Lunn5-16/+69
Use defines for registers, shifts and bits in the remaining register accesses in the individual drivers, in order to aid readability. Signed-off-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-05-09net: dsa: Centralize setting up portsAndrew Lunn6-37/+20
Now that setting up a port is identical for all switches, centralisers the code looping over all the ports to set them up. Signed-off-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-05-09net: dsa: Centralise global and port setup code into mv88e6xxx.Andrew Lunn6-660/+486
The port setup code in the individual drivers is identical for 6123, 6171, and 6352, and very similar in 6131. Move it all into mv88e6xxx, using the chip families to differentiate on features. Similarly, the global setup is also very similar. Move the majority into mv8e6xxx. The chips themselves fall into families. Add helpers which uses the device IDs to determine if a device is a member of a family or not. Add some additional device IDs to the existing list, to make these helper functions more complete. However these IDs are not yet added to the probe functions. Signed-off-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-05-04net: dsa: mv88e6xxx: unregister mv88e6352 driverVivien Didelot1-0/+3
Add the missing unregister for the mv88e6352_switch_driver. Signed-off-by: Vivien Didelot <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-04-20net: dsa: mv88e6xxx: use PORT_DEFAULT_VLANVivien Didelot1-1/+2
Minor, use the explicit PORT_DEFAULT_VLAN define instead of 0x07. Signed-off-by: Vivien Didelot <[email protected]> Acked-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-04-20net: dsa: mv88e6xxx: fix setup of port control 1Vivien Didelot1-2/+1
mv88e6xxx_setup_port_common was writing to PORT_DEFAULT_VLAN (port offset 0x07) instead of PORT_CONTROL_1 (port offset 0x05). Fixes: cca8b1337541 ("net: dsa: Use mnemonics rather than register numbers") Signed-off-by: Vivien Didelot <[email protected]> Acked-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-04-16net: dsa: mv88e6xxx: Add missing initialization in mv88e6xxx_set_port_state()Geert Uytterhoeven1-1/+1
drivers/net/dsa/mv88e6xxx.c: In function ‘mv88e6xxx_set_port_state’: drivers/net/dsa/mv88e6xxx.c:905: warning: ‘ret’ may be used uninitialized in this function If oldstate == state, mv88e6xxx_set_port_state() will return an uninitialized value. Pre-initialize ret to zero to fix this. Signed-off-by: Geert Uytterhoeven <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-04-16dsa: mv88e6xxx: Drop duplicate declaration of 'ret' variableGuenter Roeck1-2/+0
A duplicate declaration of 'ret' can result in hiding an error code. Drop it. Fixes: 17ee3e04ddbf ("net: dsa: Provide additional RMON statistics") Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-04-16dsa: mv88e6xxx: Fix error handling in mv88e6xxx_set_port_stateGuenter Roeck1-1/+3
Return correct error code if _mv88e6xxx_reg_read returns an error. Fixes: facd95b2e0ec0 ("net: dsa: mv88e6xxx: Add Hardware bridging support") Signed-off-by: Guenter Roeck <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Reported-by: kbuild test robot <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-04-01net: dsa: mv88e6xxx: Fix stats counters for 6352 familyAndrew Lunn1-0/+16
The statistic counters for the mv88e6172 never worked. This device is a member of the 6352 family of chips, which has a slightly different layout of the register used for capturing statistics. Add support for detecting this family and poking the port in the right place in the register. Signed-off-by: Andrew Lunn <[email protected]> Tested-by: Guenter Roeck <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-04-01net: dsa: Use mnemonics rather than register numbersAndrew Lunn6-178/+335
Rather than refer to registers by number, define mnemonics. Also define mnemonics for the commonly used bits within the registers. Signed-off-by: Andrew Lunn <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Tested-by: Guenter Roeck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-04-01net: dsa: Consolidate getting the statisticsAndrew Lunn6-241/+110
Reading the statistics from the hardware is the same for all chips. What differs is the number of available statistics. Have just one copy of the code in the shared mv88e6xxx. Signed-off-by: Andrew Lunn <[email protected]> Tested-by: Guenter Roeck <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-04-01net: dsa: mv88e6xxx: Add missing mutex's in EEE operations.Andrew Lunn1-29/+30
The phy_mutex should be held while reading and writing to the phy. Signed-off-by: Andrew Lunn <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Tested-by: Guenter Roeck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-04-01net: dsa: Consolidate phy read and write functionsAndrew Lunn5-146/+110
Move the common code for reading and writing phy registers into the shared mv88e6xxx. Signed-off-by: Andrew Lunn <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Tested-by: Guenter Roeck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-04-01net: dsa: Move phy page access functions into shared codeAndrew Lunn3-41/+42
These functions could in future be used by other drivers. Move them into the shared area. Signed-off-by: Andrew Lunn <[email protected]> Tested-by: Guenter Roeck <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-04-01net: dsa: Centralize Marvell switch resetAndrew Lunn6-154/+45
Marvell switches are all reset in nearly the same way. The only difference is if the PPU should be enabled or not. Move this code into the shared mv88x6xxx.c. Signed-off-by: Andrew Lunn <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Tested-by: Guenter Roeck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-04-01net: dsa: Consistently set and use ps->num_portsAndrew Lunn2-11/+22
As a step towards consolidating code, consistently set the number of ports in the private state structure, and make use of it in loops. Signed-off-by: Andrew Lunn <[email protected]> Tested-by: Guenter Roeck <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-04-01net: dsa: mv88e6123_61_65: Determine and use number of switch portsGuenter Roeck1-16/+38
Determine and use number of switch ports from chip ID instead of always using the maximum, and return error when an attempt is made to access a non-existing port. Signed-off-by: Guenter Roeck <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-04-01net: dsa: mv88e6131: Determine and use number of switch portsGuenter Roeck2-7/+36
Determine and use number of switch ports from chip ID instead of always using the maximum, and return error when an attempt is made to access a non-existing port. Signed-off-by: Guenter Roeck <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-04-01net: dsa: mv88e6xxx: Move switch product IDs into common include fileGuenter Roeck3-10/+36
This will let us use the switch product IDs in the common source code. Signed-off-by: Guenter Roeck <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-04-01net: dsa: mv88e6131: Use common initialization functionsGuenter Roeck1-28/+5
Common initialization functions will be needed to enable HW bridging support. Signed-off-by: Guenter Roeck <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-03-29net: dsa: mv88e6171: Add support for hardware bridgingAndrew Lunn1-0/+6
Wire up the common code for setting up hardware bridging and access to the forwarding database. Signed-off-by: Andrew Lunn <[email protected]> Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-03-29net: dsa: mv88e6171: Add EEE support to the mv88e6172Andrew Lunn1-0/+24
The mv88e6172 has support for EEE. Check for the product ID and call the common code if applicable. Signed-off-by: Andrew Lunn <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-03-29net: dsa: mv88e6171: Add defines for switch product IDsAndrew Lunn1-2/+6
Make the code more readable by using defines for the switch IDs. Signed-off-by: Andrew Lunn <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-03-29net: dsa: Centralise getting switch idAndrew Lunn2-2/+2
Get the switch id and save it away in the private mv88x6xxx structure in a centralised piece of code, rather than each driver doing it itself. Signed-off-by: Andrew Lunn <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-03-29net: dsa: mv88e6352: Add support for ndo_fdb functionsGuenter Roeck1-0/+3
Add support for manipulating switch fdb entries by pointing to the ndo_fdb functions implemented for mv88e6xxxx. Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-03-29net: dsa: mv88e6xxx: Add support for fdb_add, fdb_del, and fdb_getnextGuenter Roeck2-0/+152
No vlan support at this time. Reviewed-by: Andrew Lunn <[email protected]> Tested-by: Andrew Lunn <[email protected]> Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-03-29net: dsa: mv88e6352: Add support for hardware bridgingGuenter Roeck1-0/+3
Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-03-29net: dsa: mv88e6xxx: Add Hardware bridging supportGuenter Roeck2-7/+292
Bridge support is similar for all chips supported by the mv88e6xxx code, so add the code there. Reviewed-by: Andrew Lunn <[email protected]> Tested-by: Andrew Lunn <[email protected]> Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-03-29net: dsa: mv88e6171: Use common port configurationGuenter Roeck1-23/+1
Reviewed-by: Andrew Lunn <[email protected]> Tested-by: Andrew Lunn <[email protected]> Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-03-29net: dsa: mv88e6123_61_65: Use common port configurationGuenter Roeck1-23/+1
This will simplify adding offloaded bridge support later on. Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-03-29net: dsa: mv88e6352: Use common port initialization codeGuenter Roeck1-23/+1
This prepares the driver for hardware bridging. Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-03-29net: dsa: mv88e6xxx: Split mv88e6xxx_reg_read and mv88e6xxx_reg_writeGuenter Roeck1-9/+26
Split mv88e6xxx_reg_read and mv88e6xxx_reg_write into two functions each, one to acquire smi_mutex and one to get struct mii_bus *bus from struct dsa_switch *ds and to call the actual read/write function. Reviewed-by: Andrew Lunn <[email protected]> Tested-by: Andrew Lunn <[email protected]> Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-03-29net: dsa: mv88e6xxx: Disable Message Port bit for CPU portGuenter Roeck1-4/+3
Datasheet says that the Message Port bit should not be set for the CPU port. Having it set causes DSA tagged packets to be sent to the CPU port roughly every 30 seconds. Those packets are the same as real packets forwarded between switch ports if the switch is configured for switching between multiple ports. The packets are then bridged by the software bridge, resulting in duplicated packets on the network. Reported-by: Andrew Lunn <[email protected]> Cc: Andrew Lunn <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Tested-by: Andrew Lunn <[email protected]> Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-03-29net: dsa: mv88e6xxx: Provide function for common port initializationGuenter Roeck2-0/+40
Provide mv88e6xxx_setup_port_common() for common port initialization. Currently only write Port 1 Control and VLAN configuration since this will be needed for hardware bridging. More can be added later if desired/needed. Reviewed-by: Andrew Lunn <[email protected]> Tested-by: Andrew Lunn <[email protected]> Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-03-29net: dsa: mv88e6xxx: Factor out common initialization codeGuenter Roeck5-12/+22
Code used and needed in mv886xxx.c should be initialized there as well, so factor it out from the individual initialization files. Reviewed-by: Andrew Lunn <[email protected]> Tested-by: Andrew Lunn <[email protected]> Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-03-16dsa: change "select" to "depends on" for NET_SWITCHDEV and for NET_DSAJiri Pirko1-7/+6
This would fix randconfig compile error: net/built-in.o: In function `netdev_switch_fib_ipv4_abort': (.text+0xf7811): undefined reference to `fib_flush_external' Also it fixes following warnings: warning: (NET_DSA) selects NET_SWITCHDEV which has unmet direct dependencies (NET && INET) warning: (NET_DSA_MV88E6060 && NET_DSA_MV88E6131 && NET_DSA_MV88E6123_61_65 && NET_DSA_MV88E6171 && NET_DSA_MV88E6352 && NET_DSA_BCM_SF2) selects NET_DSA which has unmet direct dependencies (NET && HAVE_NET_DSA && NET_SWITCHDEV) Reported-by: Randy Dunlap <[email protected]> Suggested-by: Alexei Starovoitov <[email protected]> Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-03-07net: dsa: mv88e6352: Add support for EEEGuenter Roeck1-0/+2
Enable EEE support for MV88E6352. Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-03-07net: dsa: mv88e6xxx: Add EEE supportGuenter Roeck2-0/+54
EEE configuration is similar for the various MV88E6xxx chips. Add generic support for it. Signed-off-by: Guenter Roeck <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-03-03Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller1-1/+1
Conflicts: drivers/net/ethernet/rocker/rocker.c The rocker commit was two overlapping changes, one to rename the ->vport member to ->pport, and another making the bitmask expression use '1ULL' instead of plain '1'. Signed-off-by: David S. Miller <[email protected]>
2015-02-25net: dsa: bcm_sf2: add HW bridging supportFlorian Fainelli3-1/+171
Implement the bridge join, leave and set_stp callbacks by making that we do the following: - when a port joins the bridge, all existing ports in the bridge get their VLAN control register updated with that joining port - the joining port is including all existing bridge ports in its own VLAN control register The leave operation is fairly similar, special care must be taken to make sure that port leaving the bridging is not removing itself from its own VLAN control register. Since the various BR_* states apply directly to our HW semantics, we just need to translate these constants into their corresponding HW settings, and voila! We make sure to trigger a fast-ageing process for ports that are joining/leaving the bridge and transition from incompatible states, this is equivalent to triggering an ARL flush for that port. Signed-off-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-02-20net: dsa: bcm_sf2: fix 64-bits register readsFlorian Fainelli1-1/+1
Reading 64-bits register was not working because we inverted the steps between reading the lower 32-bits of the register and reading the upper 32-bits. Swapping these operations is how the HW guarantees that 64-bits reads are latched correctly. We only have a handful of 64-bits registers for now, mostly MIB counters, so the imapct is low. Fixes: 246d7f773c13 ("net: dsa: add Broadcom SF2 switch driver") Signed-off-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-02-19net: dsa: mv88e6171: Enable access to phys via internal mdio busAndrew Lunn1-8/+10
When the device is configured to use single chip addressing mode, the phy devices of the port are not accessible on the host MDIO bus. Instead the switch internal MDIO bus must be used. For this to work, the phy polling unit must be enabled. Signed-off-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-02-19net: dsa: mv88e6352: Refactor shareable codeAndrew Lunn3-65/+71
The mv88e6352 allows access to the port phys via an internal mdio bus which is accessed using registers in the GLOBAL 2 range. The mv88e6171 and probably other devices use the same mechanism. Move this code into the shared mv88e6xxx.c library. Signed-off-by: Andrew Lunn <[email protected]> Tested-by: Guenter Roeck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-02-09Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller1-1/+2
Signed-off-by: David S. Miller <[email protected]>
2015-02-07net: dsa: bcm_sf2: implement GPHY power downFlorian Fainelli2-9/+45
Implement the power on/off recommended procedure for the Single GPHY we have on our Starfighter 2 switch. In order to make sure we get proper LED link/activity signaling during suspend, switch the link indication from the Switch/MAC to the PHY. Finally, since the GPHY needs to be reset to be put in low power mode, we will loose any context applied to it: workarounds, EEE etc.. so we need to call phy_init_hw() to get our fixups re-applied successfully. Signed-off-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-02-07net: dsa: bcm_sf2: move GPHY enabling to its own functionFlorian Fainelli1-12/+20
Move the code that touches the single GPHY register from bcm_sf2_sw_resume() to a separate function since we will have to enable/disable the GPHY from different locations, and we want the code to be self-contained. Signed-off-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-02-07dsa: do not dereference non-existing routing tableTobias Waldekranz1-1/+2
In the case where there is only one switch, no routing table will have been allocated, so do not dereference it in this case. Signed-off-by: Tobias Waldekranz <[email protected]> Signed-off-by: David S. Miller <[email protected]>