aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/mii/qsphy.c
Commit message (Collapse)AuthorAgeFilesLines
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* spdx: Simplify BSD-2-Clause AND BSD-2-ClauseWarner Losh2023-05-121-1/+1
| | | | | | | | | After removing the -FreeBSD and -NetBSD, we're left with a nuber of BSD-2-Clause AND BSD-2-Clause, so tidy that up. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* spdx: The BSD-2-Clause-NetBSD identifier is obsolete, drop -NetBSDWarner Losh2023-05-121-1/+1
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-NetBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* mii: Remove unused devclass arguments to DRIVER_MODULE.John Baldwin2022-05-061-3/+1
|
* mii: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-1/+1
| | | | Notes: svn path=/head/; revision=365207
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326255
* The MII layer shouldn't care about administrative status of anGleb Smirnoff2013-10-261-12/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | interface. Make MII drivers forget about 'struct ifnet'. Later plan is to provide an administrative downcall from ifnet layer into drivers, to inform them about administrative status change. If someone thinks that processing MII events for an administratively down interface is a big problem, then drivers would turn MII processing off. The following MII drivers do evil things, like strcmp() on driver name, so they still need knowledge of ifnet and thus include if_var.h. They all need to be fixed: sys/dev/mii/brgphy.c sys/dev/mii/e1000phy.c sys/dev/mii/ip1000phy.c sys/dev/mii/jmphy.c sys/dev/mii/nsphy.c sys/dev/mii/rgephy.c sys/dev/mii/truephy.c Sponsored by: Netflix Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=257184
* Use DEVMETHOD_END.Marius Strobl2011-11-231-1/+1
| | | | Notes: svn path=/head/; revision=227908
* - Remove attempts to implement setting of BMCR_LOOP/MIIF_NOLOOPMarius Strobl2011-05-031-26/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (reporting IFM_LOOP based on BMCR_LOOP is left in place though as it might provide useful for debugging). For most mii(4) drivers it was unclear whether the PHYs driven by them actually support loopback or not. Moreover, typically loopback mode also needs to be activated on the MAC, which none of the Ethernet drivers using mii(4) implements. Given that loopback media has no real use (and obviously hardly had a chance to actually work) besides for driver development (which just loopback mode should be sufficient for though, i.e one doesn't necessary need support for loopback media) support for it is just dropped as both NetBSD and OpenBSD already did quite some time ago. - Let mii_phy_add_media() also announce the support of IFM_NONE. - Restructure the PHY entry points to use a structure of entry points instead of discrete function pointers, and extend this to include a "reset" entry point. Make sure any PHY-specific reset routine is always used, and provide one for lxtphy(4) which disables MII interrupts (as is done for a few other PHYs we have drivers for). This includes changing NIC drivers which previously just called the generic mii_phy_reset() to now actually call the PHY-specific reset routine, which might be crucial in some cases. While at it, the redundant checks in these NIC drivers for mii->mii_instance not being zero before calling the reset routines were removed because as soon as one PHY driver attaches mii->mii_instance is incremented and we hardly can end up in their media change callbacks etc if no PHY driver has attached as mii_attach() would have failed in that case and not attach a miibus(4) instance. Consequently, NIC drivers now no longer should call mii_phy_reset() directly, so it was removed from EXPORT_SYMS. - Add a mii_phy_dev_attach() as a companion helper to mii_phy_dev_probe(). The purpose of that function is to perform the common steps to attach a PHY driver instance and to hook it up to the miibus(4) instance and to optionally also handle the probing, addition and initialization of the supported media. So all a PHY driver without any special requirements has to do in its bus attach method is to call mii_phy_dev_attach() along with PHY-specific MIIF_* flags, a pointer to its PHY functions and the add_media set to one. All PHY drivers were updated to take advantage of mii_phy_dev_attach() as appropriate. Along with these changes the capability mask was added to the mii_softc structure so PHY drivers taking advantage of mii_phy_dev_attach() but still handling media on their own do not need to fiddle with the MII attach arguments anyway. - Keep track of the PHY offset in the mii_softc structure. This is done for compatibility with NetBSD/OpenBSD. - Keep track of the PHY's OUI, model and revision in the mii_softc structure. Several PHY drivers require this information also after attaching and previously had to wrap their own softc around mii_softc. NetBSD/OpenBSD also keep track of the model and revision on their mii_softc structure. All PHY drivers were updated to take advantage as appropriate. - Convert the mebers of the MII data structure to unsigned where appropriate. This is partly inspired by NetBSD/OpenBSD. - According to IEEE 802.3-2002 the bits actually have to be reversed when mapping an OUI to the MII ID registers. All PHY drivers and miidevs where changed as necessary. Actually this now again allows to largely share miidevs with NetBSD, which fixed this problem already 9 years ago. Consequently miidevs was synced as far as possible. - Add MIIF_NOMANPAUSE and mii_phy_flowstatus() calls to drivers that weren't explicitly converted to support flow control before. It's unclear whether flow control actually works with these but typically it should and their net behavior should be more correct with these changes in place than without if the MAC driver sets MIIF_DOPAUSE. Obtained from: NetBSD (partially) Reviewed by: yongari (earlier version), silence on arch@ and net@ Notes: svn path=/head/; revision=221407
* Convert the PHY drivers to honor the mii_flags passed down and convertMarius Strobl2010-10-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | the NIC drivers as well as the PHY drivers to take advantage of the mii_attach() introduced in r213878 to get rid of certain hacks. For the most part these were: - Artificially limiting miibus_{read,write}reg methods to certain PHY addresses; we now let mii_attach() only probe the PHY at the desired address(es) instead. - PHY drivers setting MIIF_* flags based on the NIC driver they hang off from, partly even based on grabbing and using the softc of the parent; we now pass these flags down from the NIC to the PHY drivers via mii_attach(). This got us rid of all such hacks except those of brgphy() in combination with bce(4) and bge(4), which is way beyond what can be expressed with simple flags. While at it, I took the opportunity to change the NIC drivers to pass up the error returned by mii_attach() (previously by mii_phy_probe()) and unify the error message used in this case where and as appropriate as mii_attach() actually can fail for a number of reasons, not just because of no PHY(s) being present at the expected address(es). Reviewed by: jhb, yongari Notes: svn path=/head/; revision=213893
* Consistently always explicitly set IFM_HDX for half-duplex.Marius Strobl2010-10-031-3/+3
| | | | | | | Obtained from: OpenBSD (mostly) Notes: svn path=/head/; revision=213384
* - In the spirit of previous simplifications factor out the checks for aMarius Strobl2010-10-021-20/+2
| | | | | | | | | | | | | | | | | | | | different PHY instance being selected and isolation out into the wrappers around the service methods rather than duplicating them over and over again (besides, a PHY driver shouldn't need to care about which instance it actually is). - Centralize the check for the need to isolate a non-zero PHY instance not supporting isolation in mii_mediachg() and just ignore it rather than panicing, which should sufficient given that a) things are likely to just work anyway if one doesn't plug in more than one port at a time and b) refusing to attach in this case just leaves us in a unknown but most likely also not exactly correct configuration (besides several drivers setting MIIF_NOISOLATE didn't care about these anyway, probably due to setting this flag for no real reason). - Minor fixes like removing unnecessary setting of sc->mii_anegticks, using sc->mii_anegticks instead of hardcoded values etc. Notes: svn path=/head/; revision=213364
* Use the mii_data provided via mii_attach_args and mii_pdata respectivelyMarius Strobl2010-09-271-1/+1
| | | | | | | instead of reaching out for the softc of the parent. Notes: svn path=/head/; revision=213229
* - Remove clause 3 and 4 from TNF licenses.Marius Strobl2010-09-261-12/+0
| | | | | | | | | - Remove closes 3 & 4 from Manuel Bouyer's license. Obtained from: NetBSD Notes: svn path=/head/; revision=213188
* Add a helper function mii_phy_dev_probe(), which wraps around theMarius Strobl2006-12-021-10/+6
| | | | | | | | | | | | | | mii_phy_match() API and takes care of the PHY device probe based on the struct mii_phydesc array and the match return value provided. Convert PHY drivers to take advantage of mii_phy_dev_probe(), converting drivers to provide a mii_phydesc table in the first place where necessary. Reviewed by: yongari MFC after: 2 weeks Notes: svn path=/head/; revision=164827
* - In qsphy_service() for the MII_TICK case don't bother to check whetherMarius Strobl2006-11-281-29/+4
| | | | | | | | | | | | | | | | | the currently selected media is of type IFM_AUTO as auto-negotiation doesn't need to be kicked anyway. - Don't set MIIF_NOISOLATE so qsphy(4) can be used in configurations with multiple PHYs. There doesn't seem to be a problem with isolating QS6612 per se nor in combination with the NICs they're used with. - Use mii_phy_add_media() instead of mii_add_media() so the latter can be eventually retired. - Take advantage of mii_phy_setmedia(). Obtained from: NetBSD (except for the first item) MFC after: 2 weeks Notes: svn path=/head/; revision=164710
* Replace hard-coded magic constants to system defined constantsPyun YongHyeon2006-07-031-1/+1
| | | | | | | | | | (BUS_PROBE_DEFAULT, BUS_PROBE_GENERIC etc). There is no functional changes. Reviewed by: oleg, scottl Notes: svn path=/head/; revision=160076
* Use ansi function definitions in preference to K&R to reduce diffsWarner Losh2005-09-301-12/+5
| | | | | | | with NetBSD (and cause it looks cooler). Notes: svn path=/head/; revision=150763
* Start each of the license/copyright comments with /*-, minor shuffle of linesWarner Losh2005-01-061-1/+1
| | | | Notes: svn path=/head/; revision=139749
* Remove double __FBSDID and move the remaining one into a common place afterMarius Strobl2004-05-291-6/+3
| | | | | | | | the license(s) and before the driver comment (the latter only in drivers not having __FBSDID at that location). Notes: svn path=/head/; revision=129844
* Use __FBSDID().David E. O'Brien2003-08-241-0/+3
| | | | | | | Also some minor style cleanups. Notes: svn path=/head/; revision=119418
* Use __FBSDID rather than rcsid[].David E. O'Brien2003-04-031-5/+3
| | | | Notes: svn path=/head/; revision=113038
* Remove miidevs.h and generate it from miidevs at compile time.David E. O'Brien2003-01-191-1/+1
| | | | | | | The devlist2h.awk tool to do this has been repocopied to sys/tools/. Notes: svn path=/head/; revision=109514
* Put function return types on a line by themselves.Alfred Perlstein2002-10-141-4/+6
| | | | | | | | Cleanup my earlier de-__P sweep and remove whitespace between function names and paramters. Notes: svn path=/head/; revision=105135
* Clean up mii/phy drivers: Remove the MIIF_DOINGAUTO which doesn't reallyPoul-Henning Kamp2002-05-041-1/+1
| | | | | | | | do anything at the end of the day except bloat the drivers which has copy&pasted it. Notes: svn path=/head/; revision=96026
* MII_TICK handlers need not restart aneg on these PHYs, they behave prettySemen Ustimenko2002-05-011-69/+39
| | | | | | | | | | | | | | | well as is, so - just fetch current status upon MII_TICK. Also do IFM_INST verification at the top of *_service() then doing it separately for every case in switch. acphy: do not read MII_ACPHY_DIAG twice, there is nothing latching. qsphy: always fetch actual link status from MII_QSPHY_PCTL. MFC after: 1 week Notes: svn path=/head/; revision=95877
* Make one generic mii_phy_detach() to replace 19 slightly different ones.Poul-Henning Kamp2002-04-291-16/+1
| | | | | | | | | | Rename mii_phy_auto_stop() mii_phy_down(). Introduce mii_down(), use it from nge. Do not indirect it to 19 identical case's in 19 switchstatements like NetBSD did. Notes: svn path=/head/; revision=95722
* Don't pass three args when one will do just fine, and even preventPoul-Henning Kamp2002-04-281-1/+1
| | | | | | | mistakes like the one brgphy.c (now corrected). Notes: svn path=/head/; revision=95667
* Improve an API by about 4 lines per driver.Poul-Henning Kamp2002-04-281-3/+1
| | | | Notes: svn path=/head/; revision=95665
* Remove __P.Alfred Perlstein2002-03-201-6/+6
| | | | Notes: svn path=/head/; revision=92739
* Cleanup pass for mii drivers.Jonathan Lemon2001-09-291-22/+17
| | | | | | | | | | . Make internal service routines static. . Use a consistent ordering of checks in MII_TICK. Do the work in the mii_phy_tick() subroutine if appropriate. . Call mii_phy_update() to trigger the callbacks. Notes: svn path=/head/; revision=84145
* Add QS6612, AC101 and LXT970 personal drivers and register definitions.Semen Ustimenko2001-02-071-0/+366
Obtained from: NetBSD/OpenBSD Notes: svn path=/head/; revision=72132