summaryrefslogtreecommitdiffstats
path: root/sys/dev/mii/e1000phy.c
Commit message (Collapse)AuthorAgeFilesLines
* - Masking IFM_GMASK when also masking IFM_FDX is redundant and justmarius2011-01-141-3/+3
| | | | | | | | | | | | complicates the code. - Don't let atphy_setmedia() announce PAUSE support for half-duplex when MIIF_FORCEPAUSE is set. - Simplify e1000phy_service() and ip1000phy_service() to only set the manual configuration bits once after we have figured them all out. For ip1000phy_service() this also means we no longer unnecessarily update the hardware along the road. MFC after: 1 week
* Allow pause support advertisement to be turned off again.marius2010-11-271-0/+1
| | | | Submitted by: yongari (ip1000phy(4))
* o Flesh out the generic IEEE 802.3 annex 31B full duplex flow controlmarius2010-11-141-54/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | support in mii(4): - Merge generic flow control advertisement (which can be enabled by passing by MIIF_DOPAUSE to mii_attach(9)) and parsing support from NetBSD into mii_physubr.c and ukphy_subr.c. Unlike as in NetBSD, IFM_FLOW isn't implemented as a global option via the "don't care mask" but instead as a media specific option this. This has the following advantages: o allows flow control advertisement with autonegotiation to be turned on and off via ifconfig(8) with the default typically being off (though MIIF_FORCEPAUSE has been added causing flow control to be always advertised, allowing to easily MFC this changes for drivers that previously used home-grown support for flow control that behaved that way without breaking POLA) o allows to deal with PHY drivers where flow control advertisement with manual selection doesn't work or at least isn't implemented, like it's the case with brgphy(4), e1000phy(4) and ip1000phy(4), by setting MIIF_NOMANPAUSE o the available combinations of media options are readily available from the `ifconfig -m` output - Add IFM_FLOW to IFM_SHARED_OPTION_DESCRIPTIONS and IFM_ETH_RXPAUSE and IFM_ETH_TXPAUSE to IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS so these are understood by ifconfig(8). o Make the master/slave support in mii(4) actually usable: - Change IFM_ETH_MASTER from being implemented as a global option via the "don't care mask" to a media specific one as it actually is only applicable to IFM_1000_T to date. - Let mii_phy_setmedia() set GTCR_MAN_MS in IFM_1000_T slave mode to actually configure manually selected slave mode (like we also do in the PHY specific implementations). - Add IFM_ETH_MASTER to IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS so it is understood by ifconfig(8). o Switch bge(4), bce(4), msk(4), nfe(4) and stge(4) along with brgphy(4), e1000phy(4) and ip1000phy(4) to use the generic flow control support instead of home-grown solutions via IFM_FLAGs. This includes changing these PHY drivers and smcphy(4) to no longer unconditionally advertise support for flow control but only if the selected media has IFM_FLOW set (or MIIF_FORCEPAUSE is set) and implemented for these media variants, i.e. typically only for copper. o Switch brgphy(4), ciphy(4), e1000phy(4) and ip1000phy(4) to report and set IFM_1000_T master mode via IFM_ETH_MASTER instead of via IFF_LINK0 and some IFM_FLAGn. o Switch brgphy(4) to add at least the the supported copper media based on the contents of the BMSR via mii_phy_add_media() instead of hardcoding them. The latter approach seems to have developed historically, besides causing unnecessary code duplication it was also undesirable because brgphy_mii_phy_auto() already based the capability advertisement on the contents of the BMSR though. o Let brgphy(4) set IFM_1000_T master mode on all supported PHY and not just BCM5701. Apparently this was a misinterpretation of a workaround in the Linux tg3 driver; BCM5701 seem to require RGPHY_1000CTL_MSE and BRGPHY_1000CTL_MSC to be set when configuring autonegotiation but this doesn't mean we can't set these as well on other PHYs for manual media selection. o Let ukphy_status() report IFM_1000_T master mode via IFM_ETH_MASTER so IFM_1000_T master mode support now is generally available with all PHY drivers. o Don't let e1000phy(4) set master/slave bits for IFM_1000_SX as it's not applicable there. Reviewed by: yongari (plus additional testing) Obtained from: NetBSD (partially), OpenBSD (partially) MFC after: 2 weeks
* Correct a bug in r213893; within a PHY driver MIIF_PHYPRIVn should be usedmarius2010-10-301-1/+1
| | | | instead of MIIF_MACPRIVn. This didn't make a functional difference though.
* Convert the PHY drivers to honor the mii_flags passed down and convertmarius2010-10-151-13/+5
| | | | | | | | | | | | | | | | | | | | | | | 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
* - In the spirit of previous simplifications factor out the checks for amarius2010-10-021-23/+1
| | | | | | | | | | | | | | | | | 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.
* Use the mii_data provided via mii_attach_args and mii_pdata respectivelymarius2010-09-271-1/+1
| | | | instead of reaching out for the softc of the parent.
* Marvell model number 0x06 is 88E1101 PHY.yongari2010-08-071-1/+1
|
* Add Marvell PHYG65G Gigabit PHY which is found on 88E8059 Yukon Optima.yongari2010-04-301-0/+2
| | | | | Tested by: James LaLagna < jameslalagna <> gmail dot com > MFC after: 5 days
* Remove programming LED register and enable 25MHz TX clock foryongari2010-03-031-1/+0
| | | | | | | | 88E1149 PHY. This will fix intermittent watchdog timeouts as well as very slow network performance on 88E8072 Yukon Extreme. PR: kern/144148 MFC after: 1 week
* Add hack to pass controller specific information to phy driver.yongari2009-09-281-0/+22
| | | | | | | | | Unlike most other PHYs there is no easy way to know which media type the PHY supports on Marvell PHYs. MIIF_HAVEFIBER flags is now passed via bus-specific instance variable of a device. While I'm here add 88E1112 specific work around to set SIGDET polarity low. Many thanks "Eugene Perevyazko <john <> dnepro dot net>" who kindly gave remote access to system with DGE-560SX.
* Some fiber PHY(88E1112) does not seem to set resolved speed soyongari2009-09-281-2/+5
| | | | always assume we've got IFM_1000_SX.
* Don't encode model id twice.yongari2009-09-281-1/+1
| | | | Reported by: Kristof Provost <kristof <> sigsegv dot be>
* Backout r193289. r193289 restored page select bits to previousyongari2009-08-181-3/+1
| | | | | | | | | | | | | | | | | value instead of blindly resetting it to 0. However, it seems page select bits of some 88E1116 PHY is initialized to invalid one such that restoring page select bits after programming broke MII register access. The correct solution would be reset page select bits to 0 in PHY attach stage but it would require more testing. Since we're in BETA stage such a change would be dangerous so just back it out. This change should fix nfe(4) breakage on NVIDIA MCP55. Reported by: Ryan Rogers < webmaster <> doghouserepair dot com > Sam Fourman Jr. < sfourman <> gmail dot com > Tested by: Ryan Rogers < webmaster <> doghouserepair dot com > Sam Fourman Jr. < sfourman <> gmail dot com > Approved by: re (kib)
* Program LED registers for 88E1116/88E1149 PHYs. These PHYs areyongari2009-06-021-2/+16
| | | | | | | found on Marvell Yukon Ultra, Marvell Yukon Extreme controllers. While I'm here explicitly issue 'powerup' command for 88E1149 PHY. Tested by: jhb, Warren Block ( wblock <> wonkity dot com )
* Don't assume page register value is 0 and restore previous pageyongari2009-06-021-1/+3
| | | | register after issuing 'powerup'.
* Add driver support for 88E3016 PHY which is found on Marvell Yukonyongari2009-05-251-4/+23
| | | | | | | | | | | | | | | FE+ controller. Due to the severe silicon bugs for Yukon FE+, 88E3016 seems to require more workarounds. However I'm not sure whether the workaround is PHY specific or only applicable to Yukon FE+. The datasheet for the PHY is publicly available but it lacks several details for the workaround used in this change. The workaround information was obtained from Linux. Many thanks to Yukon FE+ users who helped me add 88E3016 support. Tested by: bz, Tanguy Bouzeloc ( the.zauron <> gmail dot com ) Bruce Cran ( bruce <> cran dot org dot uk ) Michael Reifenberger ( mike <> reifenberger dot com ) Stephen Montgomery-Smith ( stephen <> missouri dot edu )
* Do not ignore NEXT Page capability of auto-negotiationyongari2009-05-251-4/+7
| | | | | | advertisement register. Some PHYs such as 88E3016 requires NEXT Page capability to establish valid link. Also set protocol selector field which is read only but it makes the intention clearer.
* Don't read unnecessary PHY registers. Speed/duplex resolution bityongari2009-05-251-12/+16
| | | | | | | is valid only for auto-negotiation case so check the bit if we know auto-negotiation is active. While I'm here explicitly checks current speed with speed mask and set IFM_NONE if resolved speed is unknown.
* Report current link state while auto-negotiation is in progress.yongari2009-05-251-1/+1
|
* Use mii_phy_add_media() and remove usage of local macro ADD. Alsoyongari2009-05-251-50/+12
| | | | | | | | | checks extended status register to see whether the PHY is fast ethernet or not. This removes a lot of checks for specific PHY models and it makes easy to add more PHYs to e1000phy(4). While I'm here remove setting mii_anegticks as it is set with mii_phy_add_media().
* Some 88E1149 PHY's page select is initialized to point to otheryongari2008-10-171-0/+14
| | | | | | | | | | | | | | | | | | | | bank instead of copper/fiber bank which in turn resulted in wrong registers were accessed during PHY operation. It is believed that page 0 should be used for copper PHY so reinitialize E1000_EADR to select default copper PHY. This fixes link establishment issue of nfe(4) on Sun Fire X4140. OpenBSD also has similimar patch but they just reset the E1000_EADR register to page 0. However some Marvell PHYs((88E3082, 88E1000) don't have the extended address register and the meaning of the register is quite different for each PHY model. So selecting copper PHY is limited to 88E1149 PHY which seems to be the only one that exhibits link establishment problem. If parent device know the type of PHY(either copper or fiber) that information should be notified to PHY driver but there is no good way to pass this information yet. Reported by: thompsa Reviewed by: thompsa
* Save extended address register prior to switching to 1000BASE-Xyongari2008-09-301-2/+3
| | | | | | | | | | | only mode and restore original value of extended address register instead of overwriting it with page 1. There are still instance information passing issue(e.g configured media type: fiber or copper) from driver to PHY layer but this change make the selected PHY work with 88E1112 PHY. Reported by: Krzysztof Jedruczyk < beaker <at> hot dot pl > Tested by: Krzysztof Jedruczyk < beaker <at> hot dot pl >
* Recognize 88E1116R phy variation. This part is found on some embedded devices.raj2008-09-041-0/+1
| | | | Obtained from: Semihalf
* Reset autonegotation timer if media option is not IFM_AUTO.yongari2007-11-161-1/+5
| | | | | Make mii_ticks advance, autonegiation is retried every mii_anegticks seconds.
* Add 88E1116/88E1116R PHY support code that takes the PHY out ofyongari2007-10-291-0/+10
| | | | | | | power-down mode. PR: kern/114086 MFC after: 3 days
* o Add support code for newer Marvell PHYs.yongari2006-12-111-127/+213
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Remove unused static global variable e1000phy_debug. o Take advantage of mii_phy_dev_probe(). o Use MII_ANEGTICKS/MII_ANEGTICKS_GIGE instead of magic number 5. o Add IFM_NONE as e1000phy(4) supports it without issues. o Nuke magic PHY programming sequence in PHY reset and follow correct reset sequence. [1] o Make manual media selection work for all supported media types. o Don't set MIIF_NOISOLATE so e1000phy(4) can be used in configurations with multiple PHYs. o In 1000baseT, when setting the link manually, one side must be the master and the other the slave. If LINK0 is set, program the PHY to be a master, otherwise it's a slave. o When we lost a link, reset mii_ticks immediately so it correctly check number of seconds elapsed in autonegotiation phase. o Announce link loss right after it happens. o After kicking autonegotiation, report PHY status instead of returning immediatly. o When link state check is in progress, check auto negotiation completion bit only when auto negotiation is enbaled. o When PHY is resolved to a master, show it with IFM_FLAG2. Special thanks to marius who fixed several nits in original patch. In half-duplex mode, nfe(4) fails to send packets. I think it's a bug in nfe(4) as the same PHY works without problems on msk(4). Obtained from: em(4) [1] Reviewed by: marius Tested by: bz
* style(9)yongari2006-12-111-5/+4
|
* Replace hard-coded magic constants to system defined constantsyongari2006-07-031-1/+1
| | | | | | | (BUS_PROBE_DEFAULT, BUS_PROBE_GENERIC etc). There is no functional changes. Reviewed by: oleg, scottl
* Since DELAY() was moved, most <machine/clock.h> #includes have beenphk2006-05-161-1/+0
| | | | unnecessary.
* Start each of the license/copyright comments with /*-, minor shuffle of linesimp2005-01-061-1/+1
|
* Add some missing <sys/module.h> includes which are masked by thephk2004-05-301-0/+1
| | | | one on death-row in <sys/kernel.h>
* Move __FBSDID out from under a comment.marius2004-05-291-3/+3
|
* Correct the phy_service() routine case MII_TICK to correctly trackandre2004-05-031-2/+2
| | | | | | | | | | the falling edge of a media state change. This is in preparation for media state change notification to the routing socket. No objections by: sam, wpaul, ru, bms Brucification by: bde
* Add support for SK-9521 V2.0 and 3COM 3C940.wilko2003-09-201-49/+85
| | | | | | | | | | Tested at 100Mbit only, using Asus P4P800 onboard 3C940. The -stable version of this patch I have in use for ~2 weeks now, and works just fine for me. Based on: Nathan L. Binkert's patch for OpenBSD Patch submitted by and thanks to: Jung-uk Kim <jkim@niksun.com> MFC after: 2 weeks
* Use __FBSDID().obrien2003-08-241-1/+3
| | | | Also some minor style cleanups.
* Remove miidevs.h and generate it from miidevs at compile time.obrien2003-01-191-1/+1
| | | | The devlist2h.awk tool to do this has been repocopied to sys/tools/.
* Remove unnecessary <sys/malloc.h> include.semenu2002-10-291-1/+0
| | | | | Submitted by: marius@alchemy.franken.de MFC after: 1 week
* Clean up mii/phy drivers: Remove the MIIF_DOINGAUTO which doesn't reallyphk2002-05-041-58/+13
| | | | | do anything at the end of the day except bloat the drivers which has copy&pasted it.
* Make one generic mii_phy_detach() to replace 19 slightly different ones.phk2002-04-291-20/+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.
* Follow NetBSD and s/IFM_1000_TX/IFM_1000_T/phk2002-04-281-4/+4
|
* Cleanup pass for mii drivers.jlemon2001-09-291-35/+23
| | | | | | | . 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.
* Change the order that we print the media options during device probe tojlemon2001-09-291-30/+24
| | | | match the other mii drivers.
* Add Marvell PHY support for 10/100/1000 LIVENGOOD_CU Intel NIC.mjacob2001-04-091-0/+473
Parag Patel did all of the grunt work, so he gets the credit. Register definitions and actions inferred from a Linux driver, so Intel also gets some 'credit'.
OpenPOWER on IntegriCloud