aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/etherswitch/e6000sw
Commit message (Collapse)AuthorAgeFilesLines
* net: Remove unneeded NULL check for the allocated ifnetZhenlei Huang2024-07-122-8/+0
| | | | | | | | | | | | | Change 4787572d0580 made if_alloc_domain() never fail, then also do the wrappers if_alloc(), if_alloc_dev(), and if_gethandle(). No functional change intended. Reviewed by: kp, imp, glebius, stevek MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D45740 (cherry picked from commit aa3860851b9f6a6002d135b1cac7736e0995eedc)
* etherswitch: Use device_set_desc(f)()Mark Johnston2024-06-091-3/+1
| | | | | | | | No functional change intended. MFC after: 1 week (cherry picked from commit 54482989d34c94c6894cb51f65250a4d5946eb1b)
* e6000sw: Fix locking in miibus_{read,write}reg implementationsMark Johnston2023-11-131-12/+19
| | | | | | | | | | | | | | | | | | | | Commit 469290648005e13b819a19353032ca53dda4378f made e6000sw's implementation of miibus_(read|write)reg assume that the softc lock is held. I presume that is to avoid lock recursion in e6000sw_attach() -> e6000sw_attach_miibus() -> mii_attach() -> MIIBUS_READREG(). However, the lock assertion in e6000sw_readphy_locked() can fail if a different driver uses the interface to probe registers. Work around the problem by providing implementations which lock the softc if it is not already locked. PR: 274795 Fixes: 469290648005 ("e6000sw: add readphy and writephy wrappers") Reviewed by: kp, imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D42466 (cherry picked from commit 725962a9f4c050b21488edd58d317e87c76d6f66)
* e6000sw: support building without FDTLuiz Otavio O Souza2023-08-211-2/+101
| | | | | | | This enables the use of this driver on platorms without device tree, such as Netgate's XG-7100. Sponsored by: Rubicon Communications, LLC ("Netgate")
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-162-4/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* etherswitch: Fix leftovers from IfAPI conversionJustin Hibbits2023-02-141-2/+2
| | | | Sponsored by: Juniper Networks, Inc.
* etherswitch: Clean up whitespace after IfAPI conversionJustin Hibbits2023-01-312-5/+5
| | | | | Sponsored by: Juniper Networks, Inc. Fixes: 2e6a8c1ae
* Mechanically convert etherswitch drivers to IfAPIJustin Hibbits2023-01-242-24/+24
| | | | | | Reviewed by: kd Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D37813
* etherswitch(4): Remove a double word in a source code commentGordon Bergling2022-09-041-1/+1
| | | | | | - s/the the/the/ MFC after: 3 days
* e6000sw: fix incorrect lockingKristof Provost2022-08-191-9/+0
| | | | | | | | | | | | | | | During attach we release the lock to call e6000sw_attach_miibus(), which calls mii_attach(). The mii_attach() function calls miibus_readreg() / miibus_writereg(). However, these are set to be e6000sw_readphy_locked(). That is, the read/write phy functions do not acquire the lock, but expect to be called while locked. Simply do not unlock and relock while calling mii_attach(). Reviewed by: Hubert Mazur <hum@semihalf.com> Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D36117
* e6000sw: add readphy and writephy wrappersAlbert Jakiela2022-07-071-16/+37
| | | | | | | | | | | | New functions take lock and give lock after operation. Removed locking and unlocking within other methods, to prevent from recursive locking on non recursive lock. Tested on EspressoBin. Reviewed by: mw Obtained from: Semihalf Differential Revision: https://reviews.freebsd.org/D35656
* e6000sw: Fix direct register write logicKornel Dulęba2022-07-041-1/+1
| | | | | | | | | | | | | When accessing a register directly from etherswitchcfg one must specify a register group(e.g. registers of portN) and the register offset within the group. The latter is passed as the 5 least significant bits. Extract the former by dividing the register address by 32, not by 5. Approved by: mw(mentor) Obtained from: Semihalf Sponsored by: Stormshield MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D35672
* etherswitch drivers: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin2022-05-092-5/+2
|
* Remove unused etherswitch_devclass.John Baldwin2022-05-092-3/+2
|
* Remove unused mdio_devclass.John Baldwin2022-05-061-1/+1
|
* Remove unused miibus_devclass and miibus_fdt_devclass.John Baldwin2022-05-062-2/+2
|
* e6000sw_set_atustat: eliminate write only ret variableWarner Losh2022-04-051-2/+1
| | | | Sponsored by: Netflix
* e6000sw: Build the driver as a kernel moduleHubert Mazur2021-09-131-46/+29
| | | | | | | | | | Fix detach routine. Driver was tested on EspressoBin. Remove it from GENERIC, since now it can be loaded automatically. Obtained from: Semihalf Reviewed by: manu Differential revision: https://reviews.freebsd.org/D31580
* e6000sw: Use taskqueue subsytem for MDIO pollingHubert Mazur2021-09-131-27/+38
| | | | | | | | | Previosuly the link status was pooled in an infinite loop in a separate kproc. Use taskqueue subsytem instead. This is a prequisite for making this driver work as a loadable module. Obtained from: Semihalf Differential revision: https://reviews.freebsd.org/D31579
* Fix panic when running etherswitchcfg port command.Ganbold Tsagaankhuu2019-12-251-1/+2
| | | | Notes: svn path=/head/; revision=356075
* Add support for the Marvell 88E6190 11 ports switch.Luiz Otavio O Souza2019-07-012-49/+187
| | | | | | | | | | | With more ports, some of the registers are shifted a bit to accommodate. This switch also adds two high speed Serdes/SGMII interfaces (2.5 Gb/s). Sponsored by: Rubicon Communications, LLC (Netgate) Notes: svn path=/head/; revision=349578
* Add the 802.1q support for the Marvell e6000 series of ethernet switches.Luiz Otavio O Souza2019-06-282-323/+608
| | | | | | | | Tested on: espressobin, Clearfog, SG-3100 and others Sponsored by: Rubicon Communications, LLC (Netgate) Notes: svn path=/head/; revision=349521
* Do not overwrite the RGMII bits in the CPU port register of Switch.Luiz Otavio O Souza2019-06-062-2/+5
| | | | | | | | | | | Fixes the network on Espressobin. The GENERIC kernel now boots over NFS. Sponsored by: Rubicon Communications, LLC (Netgate) Notes: svn path=/head/; revision=348762
* Update mvneta/e6000sw for new DSA Device Tree BindingsMarcin Wojtas2019-03-231-36/+79
| | | | | | | | | | | | | | | | | | | In the latest Linux kernel revisions the DSA (Distributed Switch Architecture) device tree binding was changed. Instead of the top level dsa@ node, the switch and its ports is represented as a child node of the mdio bus. With that other modifications were added, such as relation with the ethernet port of the SoC. Adjust e6000sw etherswitch and mvneta drivers to that. Tested on Armada 3720 EspressoBin and Armada 388 Clearfog Pro boards. Submitted by: Bert JW Regeer <xistence@0x58.com> Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D19036 Notes: svn path=/head/; revision=345432
* Improve detection of addressing mode in e6000swMarcin Wojtas2018-04-101-1/+3
| | | | | | | | | | | | | | Some devices cannot rely on the switch MDIO address passed in the DTB for specifying single/multi-chip addressing mode. Introduce new property "single-chip-addressing" which added to DTS will force single-chip mode. Submitted by: Michal Mazur <mkm@semihalf.com> Obtained from: Semihalf Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D14800 Notes: svn path=/head/; revision=332354
* Clean up OF_getprop_alloc APIOleksandr Tymoshenko2018-04-081-2/+2
| | | | | | | | | | | | | | | | | | | | OF_getprop_alloc takes element size argument and returns number of elements in the property. There are valid use cases for such behavior but mostly API consumers pass 1 as element size to get string properties. What API users would expect from OF_getprop_alloc is to be a combination of malloc + OF_getprop with the same semantic of return value. This patch modifies API signature to match these expectations. For the valid use cases with element size != 1 and to reduce modification scope new OF_getprop_alloc_multi function has been introduced that behaves the same way OF_getprop_alloc behaved prior to this patch. Reviewed by: ian, manu Differential Revision: https://reviews.freebsd.org/D14850 Notes: svn path=/head/; revision=332310
* [etherswitch] check if_alloc returns NULLMichael Zhilin2018-01-241-0/+6
| | | | | | | | | | | This patch is cosmetic. It checks if allocation of ifnet structure failed. It's better to have this check rather than assume positive scenario. Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com> Reported by: Dmitry Luhtionov <dmitryluhtionov@gmail.com> Notes: svn path=/head/; revision=328377
* Fix the port vlan support in e6000 based switches.Luiz Otavio O Souza2017-07-272-92/+85
| | | | | | | | | | | | Reduce the use of local copies of switch register data. The switch now works with the upstream dsa node (i.e. the upstream DTS). Tested on: ClearFog Pro (88E6176), SG-3100 (88E6141) Sponsored by: Rubicon Communications, LLC (Netgate) Notes: svn path=/head/; revision=321602
* Add support to 2.5G uplink for the MV88E6141 and MV88E6341 switches.Luiz Otavio O Souza2017-06-202-43/+111
| | | | | | | | | | Force the switch port settings for fixed media types. Tested with: 88E6176, 88E6141 Sponsored by: Rubicon Communications, LLC (Netgate) Notes: svn path=/head/; revision=320157
* Prevent multiple lock initialization in e6000sw probeZbigniew Bodek2017-06-131-3/+8
| | | | | | | | | | | | | | | | r319886 ("Add the initial support for the Marvell 88E6141 and 88E6341 switches.") unveiled a problem with possible multiple lock creation. Move its initialization to the driver attach and for obtaining the switch ID create a temprorary one, which is immediately destroyed after the check. Submitted by: Zbigniew Bodek <zbb@semihalf.com> Marcin Wojtas <mw@semihalf.com> Obtained from: Semihalf Notes: svn path=/head/; revision=319906
* Add the initial support for the Marvell 88E6141 and 88E6341 switches.Luiz Otavio O Souza2017-06-131-18/+66
| | | | | | | | | | | | | Right now the driver only supports port VLANs, so make sure etherswitch_getinfo() return the proper switch capabilities. Handle the cases where not all ports are in use (that will also require etherswitch cooperation). Sponsored by: Rubicon Communications, LLC (Netgate) Notes: svn path=/head/; revision=319886
* Remove an unnecessary variable from the switch softc structure and make theLuiz Otavio O Souza2017-06-091-19/+22
| | | | | | | | | functions that are used as booleans return real boolean values. Sponsored by: Rubicon Communications, LLC (Netgate) Notes: svn path=/head/; revision=319760
* style(9) fixes, remove unnecessary headers, remove duplicate #defines andLuiz Otavio O Souza2017-06-022-136/+88
| | | | | | | | | | | in some cases, shuffle the code around to simplify locking. No functional changes. Sponsored by: Rubicon Communications, LLC (Netgate) Notes: svn path=/head/; revision=319498
* Poll PHY status using internal e6000sw registersWojciech Macek2017-05-192-6/+53
| | | | | | | | | | | | | | | | | | | | | | | | e6000sw family automatically reflects PHY status in each port's registers. Therefore it is not necessary to do a full PHY polling squence, which results in much quicker operation and much less significant usage of the SMI bus. Care must be taken that the resulting ifmedia_active is identical to what the PHY will compute, or gratuitous link status changes will occur whenever the PHYs update function is called. This patch implements above improvement. On the occasion set a pointer to the proc structure to be part of software context instead of being a global variable. Submitted by: Marcin Wojtas <mw@semihalf.com> Obtained from: Semihalf Sponsored by: Stormshield Reviewed by: loos Differential revision: https://reviews.freebsd.org/D10714 Notes: svn path=/head/; revision=318524
* Improve busy-wait loop during switch phy access in e6000swWojciech Macek2017-05-191-8/+39
| | | | | | | | | | | | | | | | Hitherto implementation of PHY polling resulted in a risk of an endless loop and very high occupation of the SMI bus. Improve the operation by limiting the polling tries and adding sleepable pause. Submitted by: Marcin Wojtas <mw@semihalf.com> Obtained from: Semihalf Sponsored by: Stormshield Reviewed by: loos Differential revision: https://reviews.freebsd.org/D10713 Notes: svn path=/head/; revision=318521
* Add missing unlock in e6000sw driverZbigniew Bodek2017-05-171-0/+1
| | | | | | | | | | | | | This patch adds missing unlock on attach failure. Submitted by: Zbigniew Bodek <zbb@semihalf.com> Obtained from: Semihalf Sponsored by: Stormshield Reviewed by: loos Differential revision: https://reviews.freebsd.org/D10712 Notes: svn path=/head/; revision=318411
* Fix broken malloc in e6000swZbigniew Bodek2017-05-171-2/+4
| | | | | | | | | | | | | | | | Malloc should always return something when M_WAITOK flag is used, but keep this code and change flag to M_NOWAIT as it is under a lock (allows for possible future change). Free ifnet structure to avoid memory leak on failure. Submitted by: Zbigniew Bodek <zbb@semihalf.com> Obtained from: Semihalf Sponsored by: Stormshield Reviewed by: loos Differential revision: https://reviews.freebsd.org/D10711 Notes: svn path=/head/; revision=318410
* [etherswitch] [e6000sw] fix compile issue under clang/armAdrian Chadd2017-05-061-2/+4
| | | | | | | | | Submitted by: Hiroki Mori <yamori813@yahoo.co.jp> Approved by: mizhka Differential Revision: https://reviews.freebsd.org/D10563 Notes: svn path=/head/; revision=317869
* When the switch is set to operate in the Multi Chip Addressing Mode weLuiz Otavio O Souza2017-04-301-13/+7
| | | | | | | | | | | | | | | | | | cannot access the GLOBAL2 register directly. Despite the comment in code (which was misleading), the indirect access is only used to read the switch CONFIG data from the scrap register and not for the GLOBAL2 access. Use the dsa data to define when the switch is in the Multi Chip Addressing Mode (a even address different than zero). While here fix a typo. Sponsored by: Rubicon Communications, LLC (Netgate) Notes: svn path=/head/; revision=317605
* [etherswitch] add support for Marvell 88E6065 ethernet switch incl. 802.1qMichael Zhilin2017-03-271-42/+364
| | | | | | | | | | | | | This patch brings 802.1q support for Marvell 88E606x ethernet switches. Test is done on 88E6065 chip (Aterm WR1200). Submitted by: Hiroki Mori <yamori813@yahoo.co.jp> Reviewed by: mizhka MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D10144 Notes: svn path=/head/; revision=316052
* Improve ports handling in e6000sw driverZbigniew Bodek2017-01-052-80/+286
| | | | | | | | | | | | | | | | | | | - recognize ports and vlangroups based on DTS file - support multi-chip addresing mode (required in upcoming Armada-388-Clearfog support) - refactor attachment function Each port in 'dsa' node should have 'vlangroup' property. Otherwise, e6000sw will fail to attach. Submitted by: Bartosz Szczepanek <bsz@semihalf.com> Konrad Adamczyk <ka@semihalf.com> Obtained from: Semihalf Sponsored by: Stormshield Differential revision: https://reviews.freebsd.org/D7328 Notes: svn path=/head/; revision=311448
* [etherswitch] add Marvell 88e6060 switch supportMichael Zhilin2016-11-151-0/+703
| | | | | | | | | | | | | Add 88e6060 basic support: only port-based VLAN is supported. No vlan(4) support. Submitted by: Hiroki Mori <yamori813@yahoo.co.jp> Reviewed by: mizhka, adrian Approved by: adrian(mentor) Differential Revision: https://reviews.freebsd.org/D8344 Notes: svn path=/head/; revision=308699
* sys/dev: minor spelling fixes.Pedro F. Giffuni2016-05-031-1/+1
| | | | | | | Most affect comments, very few have user-visible effects. Notes: svn path=/head/; revision=298955
* [mdio] migrate mdiobus out of etherswitch and into a top-level device of its ↵Adrian Chadd2015-12-261-1/+1
| | | | | | | | | | | | | | own. The mdio driver interface is generally useful for devices that require MDIO without the full MII bus interface. This lifts the driver/interface out of etherswitch(4), and adds a mdio(4) man page. Submitted by: Landon Fuller <landon@landonf.org> Differential Revision: https://reviews.freebsd.org/D4606 Notes: svn path=/head/; revision=292738
* Introduce e6000sw etherswitch supportZbigniew Bodek2015-10-252-0/+1161
Add e6000sw driver supporting Marvell 88E6352, 88E6172, 88E6176 switches. It needs to be attached to mdio interface, exporting SMI access functionality. e6000sw supports port-based VLAN configuration, per-port media changing, accessing PHY and switch registers. e6000sw attaches miibuses and PHY drivers as children. Instead of typical tick as callout, kthread-based tick is used. This combined with SX locks allows MDIO read/write calls to sleep. It is expected, because this hardware requires long delays in SMI read/write procedures, which can not be handled by busy-waiting. Reviewed by: adrian Obtained from: Semihalf Submitted by: Bartosz Szczepanek <bsz@semihalf.com> Differential revision: https://reviews.freebsd.org/D3902 Notes: svn path=/head/; revision=289947