summaryrefslogtreecommitdiffstats
path: root/sys/dev/mii
Commit message (Collapse)AuthorAgeFilesLines
* MFC: r271864marius2015-12-273-3/+3
| | | | Move rl(4) to dev/rl.
* MFC: r284447, r284552marius2015-07-301-3/+40
| | | | | | | | | | | | | | | | | Merge from NetBSD: o rev. 1.10: Nuke trailing whitespace. o rev. 1.15: Fix typo in comment. o rev. 1.16: Add the following registers from IEEE 802.3-2009 Clause 22: - PSE control register (0x0b) - PSE status register (0x0c) - MMD access control register (0x0d) - MMD access address data register (0x0e) o rev. 1.17 (comments only): The bit location of link ability is different between 1000Base-X and others (see Annex 28B.2 and 28D). o rev. 1.18: Nuke dupe word. Obtained from: NetBSD Sponsored by: genua mbh
* MFC r281877:yongari2015-05-141-10/+18
| | | | | | | Add another variant of BCM5708S controller to IBM HS21 workaround list. PR: 118238
* MFC r279903,279941:yongari2015-03-262-60/+126
| | | | | | Add RTL8211F gigabit PHY support. PR: 197265
* MFC r277481:kevlo2015-02-221-2/+2
| | | | Typo: ivalid -> invalid.
* MFC r271073:yongari2014-10-201-9/+16
| | | | | | Do not blindly announce 1000baseT half-duplex capability in autonegotiation. Some controllers like cgem(4) do not support half-duplex at gigabit speeds.
* MFC r257702, r257745, r257746, r257747, r257751, r257791, r257793,ian2014-05-142-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r257794, r257795, r257992 Teach nexus(4) about Open Firmware (e.g. FDT) on ARM and MIPS, retiring fdtbus in most cases. Make OF_nextprop() work correctly for FDT by using the libfdt fdt_next_property_offset() API. Do not panic if pmap_mincore() is called. An addendum: it is possible, though of questionable utility, for a node to have no properties at all. Add definition for the Atheros 8021 gigabit PHY. Consolidate Apple firmware hacks and improve them by switching on the presence of mac-io devices in the tree, which uniquely identifies Apple hardware. Allow OF_decode_addr() to also be able to map resources on big-endian devices. Make tsec work with the device tree present on the RB800. Be more flexible about which compatible strings to accept. This brings up the PCI Express bus on the RB800 using the firmware device tree. Rename the "bare" platform "mpc85xx", which is what it actually is, and add actual platform probing based on PVR.
* MFC r257304:yongari2013-11-042-2/+6
| | | | | | | | Add support for new Gigabit PHY of RealTek. I don't have a copy of data sheet so I'm not sure exact PHY model name. Vendor's web page indicates RTL8251 is latest PHY so I used the name. This PHY is used with RTL8168G, RTL8168GU and RTL8411B. Approved by: re (delphij)
* Recognize BCM5725C PHY.yongari2013-07-202-0/+5
|
* For RTL8211B or later PHYs, enable crossover detection andyongari2013-03-202-1/+21
| | | | | | | auto-correction. This change makes re(4) establish a link with a system using non-crossover UTP cable. Tested by: Michael BlackHeart < amdmiek <> gmail dot com >
* Recognize 5720S PHY and treat it as 5708S PHY.yongari2012-12-202-11/+17
| | | | | | | Unfortunately 5720S uses 5709S PHY id so add a hack to detect 5720S PHY by checking parent device name. 5720S PHY does not support 2500SX. Tested by: Geans Pin < geanspin <> broadcom dot com >
* For fiber PHYs, BRGPHY_MII_1000CTL register is not defined at allyongari2012-12-201-6/+5
| | | | so do not touch it.
* Remove duplicate const specifiers in many drivers (I hope I got all ofdim2012-11-051-1/+1
| | | | | | | | | | | | | | | | | | | | them, please let me know if not). Most of these are of the form: static const struct bzzt_type { [...list of members...] } const bzzt_devs[] = { [...list of initializers...] }; The second const is unnecessary, as arrays cannot be modified anyway, and if the elements are const, the whole thing is const automatically (e.g. it is placed in .rodata). I have verified this does not change the binary output of a full kernel build (except for build timestamps embedded in the object files). Reviewed by: yongari, marius MFC after: 1 week
* Recognize the Marvell 88E1145 Quad Gigabit PHY.jmallett2012-10-291-0/+1
|
* For 5717C/5719C/5720C and 57765 PHYs, do not perform any specialyongari2012-10-111-0/+9
| | | | | | handling(jumbo, wire speed etc) in brgphy_reset(). Touching BRGPHY_MII_AUXCTL register seems to confuse APE firmware such that it couldn't establish a link.
* Remove unused variable ma.kevlo2012-09-231-2/+0
|
* Merging of projects/armv6, part 5gonzo2012-08-153-1/+243
| | | | | | | - Driver for SMSC LAN95XX and LAN8710A ethernet controllers - Driver for LAN8710A PHY Submitted by: Ben Gray, Damjan Marion, Tim Kientzle
* Add support for 88E1116R.hrs2012-07-281-1/+6
| | | | Sponsored by: Plat'Home, Co.,Ltd.
* More Cicada/Vitesse PHY ids.raj2012-05-252-1/+10
| | | | Obtained from: Semihalf
* Prefer RL_GMEDIASTAT register to RGEPHY_MII_SSR register toyongari2012-02-281-6/+12
| | | | | | | | | | | | | | | | | | | | extract a link status of PHY when parent driver is re(4). RGEPHY_MII_SSR register does not seem to report correct PHY status on some integrated PHYs used with re(4). Unfortunately, RealTek PHYs have no additional information to differentiate integrated PHYs from external ones so relying on PHY model number is not enough to know that. However, it seems RGEPHY_MII_SSR register exists for external RealTek PHYs so checking parent driver would be good indication to know which PHY was used. In other words, for non-re(4) controllers, the PHY is external one and its revision number is greater than or equal to 2. This change fixes intermittent link UP/DOWN messages reported on RTL8169 controller. Also, mii_attach(9) is tried after setting interface name since rgephy(4) have to know parent driver name. PR: kern/165509
* Add Seeq Technology 80220 PHY support to smcphy(4). This PHY isyongari2012-02-231-4/+60
| | | | | | | | | found on Adaptec AIC-6915 Starfire ethernet controller. While here, use status register to know resolved speed/duplex. With this change, sf(4) correctly reports speed/duplex of established link. Reviewed by: marius
* Probe the National DP83849, which is a dual-port version of the PHYTER.marius2012-02-192-3/+6
| | | | Obtained from: NetBSD
* - Probe BCM57780.marius2012-02-192-2/+6
| | | | | | | | | | | | - In case the parent is bge(4), don't set the Jumbo frame settings unless the MAC actually is Jumbo capable as otherwise the PHY might not have the corresponding registers implemented. This is also in line with what the Linux tg3 driver does. PR: 165032 Submitted by: Alexander Milanov Obtained from: OpenBSD MFC after: 3 days
* - In mii_attach(9) just set the driver for a newly added miibus(4) instancemarius2011-12-051-3/+3
| | | | | | | | | | | | | before calling bus_enumerate_hinted_children(9) (which is the minimum for this to work) instead of fully probing it so later on we can just call bus_generic_attach(9) on the parent of the miibus(4) instance. The latter is necessary in order to work around what seems to be a bzzarre race in newbus affecting a few machines since r227687, causing no driver being probed for the newly added miibus(4) instance. Presumably this is the same race that was the motivation for the work around done in r215348. Reported and tested by: yongari - Revert the removal of a static in r221913 in order to help compilers to produce more optimal code.
* Wrap BCM5785 in #ifdef notyet for now. According to yongari@ there aremarius2011-11-231-0/+2
| | | | | | issues probably needing workarounds in bge(4) when brgphy(4) handles this PHY. Letting ukphy(4) handle it instead results in a working configuration, although likely with performance penalties.
* Use DEVMETHOD_END.marius2011-11-2328-32/+29
|
* Probe the BCM5785.marius2011-11-231-0/+1
| | | | Obtained from: NetBSD
* Sync with NetBSD rev. 1.104marius2011-11-231-1/+14
| | | | Obtained from: NetBSD
* s,KOBJMETHOD_END,DEVMETHOD_END,g in order to fully hide the explicit mentionmarius2011-11-221-1/+1
| | | | of kobj(9) from device drivers.
* - There's no need to overwrite the default device method with the defaultmarius2011-11-221-2/+1
| | | | | | | | | | one. Interestingly, these are actually the default for quite some time (bus_generic_driver_added(9) since r52045 and bus_generic_print_child(9) since r52045) but even recently added device drivers do this unnecessarily. Discussed with: jhb, marcel - While at it, use DEVMETHOD_END. Discussed with: jhb - Also while at it, use __FBSDID.
* For IP1001 PHY, do not set multi-port device(MASTER). Ideally thisyongari2011-11-221-1/+2
| | | | | | | | | | bit should not affect link establishment process of auto-negotiation if manual configuration is not used, which is true in auto-negotiation. However it seems setting this bit interfere with IP1001 PHY's down-shifting feature such that establishing a 10/100Mbps link failed when 1000baseT link is not available during auto-negotiation process. Tested by: Andrey Smagin <samspeed <> mail dot ru >
* There's no need export the device interface methods of miibus(4).marius2011-11-182-7/+6
|
* - Add a hint.miibus.X.phymask hint, allowing do individually exclude PHYmarius2011-11-181-39/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | addresses from being probed and attaching something including ukphy(4) to it. This is mainly necessarily for PHY switches that create duplicate or fake PHYs on the bus that can corrupt the PHY state when accessed or simply cause problems when ukphy(4) isolates the additional instances. - Change miibus(4) to be a hinted bus, allowing to add child devices via hints and to set their attach arguments (including for automatically probed PHYs). This is mainly needed for PHY switches that violate IEEE 802.3 and don't even implement the basic register set so we can't probe them automatically. However, the ability to alter the attach arguments for automatically probed PHYs is also useful as for example it allows to test (or tell a user to test) new variant of a PHY with a specific driver by letting an existing driver attach to it via manipulating the IDs without the need to touch the source code or to limit a Gigabit Ethernet PHY to only announce up to Fast Ethernet in order to save energy by limiting the capability mask. Generally, a driver has to be hinted via hint.phydrv.X.at="miibusY" and hint.phydrv.X.phyno="Z" (which already is sufficient to add phydrvX at miibusY at PHY address Z). Then optionally the following attach arguments additionally can be configured: hint.phydrv.X.id1 hint.phydrv.X.id2 hint.phydrv.X.capmask - Some minor cleanup. Reviewed by: adrian, ray
* - Import the common MII bitbang'ing code from NetBSD and convert drivers tomarius2011-11-012-0/+234
| | | | | | | | | | | | | | | | | | | | | | | | take advantage of it instead of duplicating it. This reduces the size of the i386 GENERIC kernel by about 4k. The only potential in-tree user left unconverted is xe(4), which generally should be changed to use miibus(4) instead of implementing PHY handling on its own, as otherwise it makes not much sense to add a dependency on miibus(4)/mii_bitbang(4) to xe(4) just for the MII bitbang'ing code. The common MII bitbang'ing code also is useful in the embedded space for using GPIO pins to implement MII access. - Based on lessons learnt with dc(4) (see r185750), add bus barriers to the MII bitbang read and write functions of the other drivers converted in order to ensure the intended ordering. Given that register access via an index register as well as register bank/window switching is subject to the same problem, also add bus barriers to the respective functions of smc(4), tl(4) and xl(4). - Sprinkle some const. Thanks to the following testers: Andrew Bliznak (nge(4)), nwhitehorn@ (bm(4)), yongari@ (sis(4) and ste(4)) Thanks to Hans-Joerg Sirtl for supplying hardware to test stge(4). Reviewed by: yongari (subset of drivers) Obtained from: NetBSD (partially)
* Recognize BCM5720C PHY.yongari2011-10-282-0/+2
|
* - Follow the lead of dcphy(4) and pnphy(4) and move the reminder of the PHYmarius2011-10-085-700/+0
| | | | | | | | | | | | | | drivers that only ever attach to a particular MAC driver, i.e. inphy(4), ruephy(4) and xlphy(4), to the directory where the respective MAC driver lives and only compile it into the kernel when the latter is also there, also removing it from miibus.ko and moving it into the module of the respective MAC driver. - While at it, rename exphy.c, which comes from NetBSD where the MAC driver it corresponds to also is named ex(4) instead of xl(4) but that in FreeBSD actually identifies itself as xlphy(4), and its function names accordingly for consistency. - Additionally while at it, fix some minor style issues like whitespace in the register headers and add multi-inclusion protection to inphyreg.h.
* r221812 reveals that at least some Broadcom PHYs default to being not onlymarius2011-08-192-5/+17
| | | | | | | | | | | | | | | | | | | isolated but also powered down after a reset and while they just work fine [sic] when both is the case they don't if they are only deisolate but still powered down. So in order to put PHYs in an overall normal operation mode for the common case, ensure in mii_phy_reset() that they are not powered down after a reset. Unfortunately, this only helps in case of BCM5421, while BCM5709S apparently only work when they remain isolated and powered down after a reset. So don't call mii_phy_reset() in brgphy_reset() and implement the reset locally leaving the problematic bits alone. Effectively this bypasses r221812 for brgphy(4). Thanks to Justin Hibbits for doing a binary search in order to identify the problematic commit. PR: 157405, 158156 Reviewed by: yongari (mii_phy_reset() part) Approved by: re (kib) MFC after: 3 days
* Add detection for the Marvel 88E1149R and treat it just like theimp2011-06-302-1/+6
| | | | 88E1149.
* - There's no need for nibbletab to be static, it's const however.marius2011-05-141-3/+3
| | | | - Fix whitespace.
* Explicitly clear 1000baseT control register for F1 PHY used inyongari2011-05-121-0/+12
| | | | | | | | | | | AR8132 FastEthernet controller. The PHY has no ability to establish a gigabit link. Previously only link parters which support down-shifting was able to establish link. This change should fix a long standing link establishment issue of AR8132. PR: kern/156935 MFC after: 1 week
* Some PHYs like the Level One LXT970 optionally can default to isolationmarius2011-05-121-6/+9
| | | | | | | after rest, in which case we may need to deisolate it. Tested by: nwhitehorn MFC after 1 week
* Fix whitespace.marius2011-05-101-1/+1
|
* Fix a bug in r221407; this driver doesn't add the media itself.marius2011-05-101-1/+1
| | | | PR: 156893
* Recognize BCM5719C PHY.yongari2011-05-092-0/+2
| | | | Submitted by: Geans Pin at Broadcom
* Enable Ethernet@WireSpeed for BCM5718/BCM57765 family. While I'myongari2011-05-051-1/+1
| | | | | here inverse meaning of PHY flag as Ethernet@WireSpeed is enabled for most PHYs.
* - Remove attempts to implement setting of BMCR_LOOP/MIIF_NOLOOPmarius2011-05-0337-1462/+934
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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@
* Probe the PHY accompanying BCM57765.marius2011-05-022-0/+2
| | | | | | Tested by: Paul Thornton MFC after: 1 week
* Correct spelling in comments.marius2011-04-228-12/+12
| | | | Submitted by: brucec
* Add Realtek RTL8201E 10/100 PHY found in RTL8105E controller. Theyongari2011-01-262-0/+2
| | | | | | exact model name is not clear yet. All previous RTL8201 10/100 PHYs used 0x8201 in MII_PHYIDR2 which in turn makes model number 0x20 but this PHY used new model number 0x08.
* - Allow IFM_FLAG0 to be set indicating that auto-negotiation with manualmarius2011-01-141-22/+29
| | | | | | | | | | | | | | | | | | | configuration, which is used to work around issues with certain setups (see r161237) by default, should not be triggered as it may in turn cause harm in some edge cases. - Even after masking the media with IFM_GMASK the result may have bits besides the duplex ones set so just comparing it with IFM_FDX may lead to false negatives. - Announce PAUSE support also for manually selected 1000BASE-T, but for all manually selected media types only in full-duplex mode. Announce asymmetric PAUSE support only for manually selected 1000BASE-T. - Simplify setting the manual configuration bits to only once after we have figured them all out. This also means we no longer unnecessarily update the hardware along the road. - Remove a stale comment. Reviewed by: yongari (plus additional testing) MFC after: 3 days
OpenPOWER on IntegriCloud