aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/dsa (follow)
AgeCommit message (Collapse)AuthorFilesLines
2015-07-23Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller2-3/+14
Conflicts: net/bridge/br_mdb.c br_mdb.c conflict was a function call being removed to fix a bug in 'net' but whose signature was changed in 'net-next'. Signed-off-by: David S. Miller <davem@davemloft.net>
2015-07-21net: dsa: bcm_sf2: Do not override speed settingsFlorian Fainelli1-17/+1
The SF2 driver currently overrides speed settings for its port configured using a fixed PHY, this is both unnecessary and incorrect, because we keep feedback to the hardware parameters that we read from the PHY device, which in the case of a fixed PHY cannot possibly change speed. This is a required change to allow the fixed PHY code to allow registering a PHY with a link configured as DOWN by default and avoid some sort of circular dependency where we require the link_update callback to run to program the hardware, and we then utilize the fixed PHY parameters to program the hardware with the same settings. Fixes: 246d7f773c13 ("net: dsa: add Broadcom SF2 switch driver") Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-07-20net: dsa: bcm_sf2: do not use indirect reads and writes for 7445E0Florian Fainelli1-2/+13
7445E0 contains an ECO which disconnected the internal SF2 pseudo-PHY which was known to conflict with the external pseudo-PHY of BCM53125 switches. This motivated the need to utilize the internal SF2 MDIO controller via indirect register reads/writes to control external Broadcom switches due to this address conflict (both responded at address 30d). For 7445E0, the internal pseudo-PHY of the SF2 switch got disconnected, and as a consequence this prevents the internal SF2 MDIO bus controller from reading data (reads back everything as 0) since the MDI line is tied low. Fix this by making the indirect register reads and writes conditional to 7445D0, on 7445E0 we can utilize the SWITCH_MDIO controller (backed by mdio-unimac and not the DSA created slave MII bus). We utilize of_machine_is_compatible() here since this is the only way for use to differentiate between these two chips in a way that does not violate layers or becomes (too) vendor-specific. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-07-20net: dsa: mv88e6xxx: fix fid_mask when leaving bridgeVivien Didelot1-1/+1
The mv88e6xxx_priv_state structure contains an fid_mask, where 1 means the FID is free to use, 0 means the FID is in use. This patch fixes the bit clear in mv88e6xxx_leave_bridge() when assigning a new FID to a port. Example scenario: I have 7 ports, port 5 is CPU, port 6 is unused (no PHY). After setting the ports 0, 1 and 2 in bridge br0, and ports 3 and 4 in bridge br1, I have the following fid_mask: 0b111110010110 (0xf96). Indeed, br0 uses FID 0, and br1 uses FID 3. After setting nomaster for port 0, I get the wrong fid_mask: 0b10 (0x2). With this patch we correctly get 0b111110010100 (0xf94), meaning port 0 uses FID 1, br0 uses FID 0, and br1 uses FID 3. Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-07-09dsa: mv88e6352/mv88e6xxx: Add support for Marvell 88E6320 and 88E6321Aleksey S. Kazantsev4-22/+65
MV88E6320 and MV88E6321 are largely compatible to MV886352, but are members of a different chip family. Signed-off-by: Aleksey S. Kazantsev <ioctl@yandex.ru> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-23dsa: mv88x6xxx: Zero statistics countersAndrew Lunn1-0/+6
Zero the statistics counters when setting up the global registers. Otherwise the counters will remain from the last boot if the power has not been removed. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-23dsa: mv88x6xxx: Add debugfs interface for scratch registersAndrew Lunn2-0/+57
Allow the contents of the scratch registers to be shown in debugfs. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-23dsa: mv88x6xxx: Add debugfs interface for device mapAndrew Lunn2-0/+42
The device map is used to route packets between cascaded switches. Add dumping a switches device map via debugfs. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-23dsa: mv88x6xxx: Add debugfs interface for statisticsAndrew Lunn1-0/+59
Allow the contents of the statistics counters to be shown in debugfs. This is particularly useful for the cpu and dsa ports, which cannot be seen using ethtools -S. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-23dsa: mv88x6xxx: Refactor getting a single statisticAndrew Lunn2-27/+40
Move the code to retrieve a statistics counter into a function of its own, so it can later be reused. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-23dsa: mv88e6xxx: Add debugfs interface for ATUAndrew Lunn2-0/+84
Dump the Address Translation Unit via a file in debugfs. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-23dsa: mv88e6xxx: Add debugfs interface for registersAndrew Lunn2-0/+52
Allow the contents of the registers to be shown in debugfs. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-10net: dsa: bcm_sf2: Utilize BRCM_PSEUDO_PHY_ADDRFlorian Fainelli1-3/+4
Utilize the newly introduced BRCM_PSEUDO_PHY_ADDR constant from brcmphy.h instead of open-coding the Broadcom Ethernet switches pseudo-PHY address (30). Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-07net: dsa: mv88e6xxx: Fix deadlock by double lockAndrew Lunn1-2/+2
ethtool -S on a DSA interface can deadlock for some switches because the same lock is taken twice. Use the register read function which expects the lock to be already held. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Fixes: 31888234b736 ("net: dsa: mv88e6xxx: Replace stats mutex with SMI mutex") Signed-off-by: David S. Miller <davem@davemloft.net>
2015-05-17net: dsa: bcm_sf2: properly propagate carrier down state for MoCAFlorian Fainelli1-0/+7
MoCA interfaces require the use of an user-space daemon (mocad) which will typically use cmd->autoneg to force the link. This is causing other network manager applications not to get proper carrier down notifications because of the following sequence of events: - link down interrupt is received, link is set to 0 by the interrupt handler - fixed_link update callback runs and updates the BMSR register accordingly - PHY library polls the PHY for link status, sees the link is down, proceeds with reporting that - mocad gets notified of the link state and call phy_ethtool_sset() with cmd->autoneg set to the link status (0) - phy_start_aneg() is called at the end of phy_ethtool_sset() and sets the PHY state to PHY_FORCING Just make sure we notify the interface carrier appropriately when we detect that the link is down in our fixed_link update callback. This is made local to the bcm_sf2 driver as the PHY library does the right thing in any case. This is similar to the GENET change introduced in 54d7c01d3ed699cfc213115eaecfe1175cfaff8f ("net: bcmgenet: enable MoCA link state change detection"). Fixes: 246d7f773c13 ("net: dsa: add Broadcom SF2 switch driver") Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-05-13Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller1-0/+3
Four minor merge conflicts: 1) qca_spi.c renamed the local variable used for the SPI device from spi_device to spi, meanwhile the spi_set_drvdata() call got moved further up in the probe function. 2) Two changes were both adding new members to codel params structure, and thus we had overlapping changes to the initializer function. 3) 'net' was making a fix to sk_release_kernel() which is completely removed in 'net-next'. 4) In net_namespace.c, the rtnl_net_fill() call for GET operations had the command value fixed, meanwhile 'net-next' adjusted the argument signature a bit. This also matches example merge resolutions posted by Stephen Rothwell over the past two days. Signed-off-by: David S. Miller <davem@davemloft.net>
2015-05-09net: dsa: mv88e6xxx: Fix false positive lockdep splatAndrew Lunn1-9/+37
DSA can have nested MDIO busses, where the Ethernet MDIO bus is used to access an MDIO bus within the switch which has the PHYs connected to it. This nesting causes lockdep to give false positives. Use mutex_lock_nested() to avoid this. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-05-09net: dsa: mv88e6xxx: Replace stats mutex with SMI mutexAndrew Lunn1-23/+27
The SMI bus is the bottleneck in all switch operations, not the granularity of locks. Replace the stats mutex by the SMI mutex to make the locking concept simpler. The REG_READ/REG_WRITE macros cannot be used while holding the SMI mutex, since they try to acquire it. Replace with calls to the appropriate function which does not try to get the mutex. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-05-09net: dsa: mv88e6xxx: Replace PHY mutex by SMI mutexAndrew Lunn2-59/+63
The SMI bus is the bottleneck in all switch operations, not the granularity of locks. Replace the PHY mutex by the SMI mutex to make the locking concept simpler. The REG_READ/REG_WRITE macros cannot be used while holding the SMI mutex, since they try to acquire it. Replace with calls to the appropriate function which does not try to get the mutex. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-05-09net: dsa: mv88e6131: Add support for mv88e6185Andrew Lunn1-0/+3
The mv88e6185 is part of the family that the mv88e6131 driver supports. Add it to the probe function, and set the number of ports. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <vivien.didelot@savoirfairelinux.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <vivien.didelot@savoirfairelinux.com> Acked-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <vivien.didelot@savoirfairelinux.com> Acked-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <geert@linux-m68k.org> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <linux@roeck-us.net> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <linux@roeck-us.net> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <andrew@lunn.ch> Tested-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <andrew@lunn.ch> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Tested-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <andrew@lunn.ch> Tested-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <andrew@lunn.ch> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Tested-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <andrew@lunn.ch> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Tested-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <andrew@lunn.ch> Tested-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <andrew@lunn.ch> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Tested-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <andrew@lunn.ch> Tested-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <linux@roeck-us.net> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <linux@roeck-us.net> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <linux@roeck-us.net> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <linux@roeck-us.net> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <andrew@lunn.ch> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <andrew@lunn.ch> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <andrew@lunn.ch> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <andrew@lunn.ch> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <andrew@lunn.ch> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <andrew@lunn.ch> Tested-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-03-29net: dsa: mv88e6352: Add support for hardware bridgingGuenter Roeck1-0/+3
Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: David S. Miller <davem@davemloft.net>