summaryrefslogtreecommitdiff
path: root/sys/dev/mii/brgphy.c
AgeCommit message (Collapse)Author
2023-02-22Retry autonegotiation every mii_anegticks seconds instead of mii_anegticks+1.msaitoh
2020-05-25Add support for BCM54213PE RGMII clock delays, from OpenBSDjmcneill
2020-03-28Don't set DVF_DETACH_SHUTDOWN. The MII layer wants to manage the lifecyclethorpej
of the PHY devices, and if a NIC driver chooses not to detach its PHYs at shutdown, that's the driver's business. PR kern/55121.
2020-03-15Define and implement a locking protocol for the ifmedia / mii layers:thorpej
- MP-safe drivers provide a mutex to ifmedia that is used to serialize access to media-related structures / hardware regsiters. Converted drivers use the new ifmedia_init_with_lock() function for this. The new name is provided to ease the transition. - Un-converted drivers continue to call ifmedia_init(), which will supply a compatibility lock to be used instead. Several media-related entry points must be aware of this compatibility lock, and are able to acquire it recursively a limited number of times, if needed. This is a SPIN mutex with priority IPL_NET. - This same lock is used to serialize access to PHY registers and other MII-related data structures. The PHY drivers are modified to acquire and release the lock, as needed, and assert the lock is held as a diagnostic aid. The "usbnet" framework has had an overhaul of its internal locking protocols to fit in with the media / mii changes, and the drivers adapted. USB wifi drivers have been changed to provide their own adaptive mutex to the ifmedia later via a new ieee80211_media_init_with_lock() function. This is required because the USB drivers need an adaptive mutex. Besised "usbnet", a few other drivers are converted: vmx, wm, ixgbe / ixv. mcx also now calls ifmedia_init_with_lock() because it needs to also use an adaptive mutex. The mcx driver still needs to be fully converted to NET_MPSAFE.
2020-02-22Match BCM54213PEjmcneill
2019-11-27- Simplify sc->mii_anegticks setting. Same as FreeBSD.msaitoh
Don't set the default value not in the attach function. Instead, set the default value (MII_ANEGTICKS) first in the beginning of the mii_phy_add_media(). The function already has the code to change the value to MII_ANEGTICKS_GIGE if it's gigabit capable. - Remove extra pmf_device_register() call. It's done in mii_phy_add_media().
2019-11-26 Fix typo in comment.msaitoh
2019-04-11 Fix a bug that the duplex of manual media setting may be wrongmsaitoh
when the IFM_GMASK bit other than IFM_[FH]DX is set. Same as a part of FreeBSD r217413.
2019-03-25 KNF. No functional change.msaitoh
2019-02-25- Add Broadcom BCM540[24], BCM5424 and BCM5466.msaitoh
- Sort lines.
2019-02-24use a macro to tidy up the phydesc array initialization, from FreeBSDchristos
2019-02-20- Add support for BCM5762 ASIC devices.msaitoh
- Add BCM5762, BCM5725, BCM5727, BCM57764, BCM57767 and BCM57787.
2019-01-22 Change MII PHY read/write API from:msaitoh
int (*mii_readreg_t)(device_t, int, int); void (*mii_writereg_t)(device_t, int, int, int); to: int (*mii_readreg_t)(device_t, int, int, uint16_t *); int (*mii_writereg_t)(device_t, int, int, uint16_t); Now we can test if a read/write operation failed or not by the return value. In 802.3 spec says that the PHY shall not respond to read/write transaction to the unimplemented register(22.2.4.3). Detecting timeout can be used to check whether a register is implemented or not (if the register conforms to the spec). ukphy(4) can be used this for MII_MMDACR and MII_MMDAADR. Note that I noticed that the following code do infinite loop in the read/wirte function. If it accesses unimplemented PHY register, it will hang. It should be fixed: arm/at91/at91emac.c arm/ep93xx/epe.c arm/omap/omapl1x_emac.c mips/ralink/ralink_eth.c arch/powerpc/booke/dev/pq3etsec.c(read) dev/cadence/if_cemac.c <- hkenken dev/ic/lan9118.c Tested with the following device: axe+ukphy axe+rgephy axen+rgephy (tested by Andrius V) wm+atphy wm+ukphy wm+igphy wm+ihphy wm+makphy sk+makphy sk+brgphy sk+gentbi msk+makphy sip+icsphy sip+ukphy re+rgephy bge+brgphy bnx+brgphy gsip+gphyter rtk+rlphy fxp+inphy (tested by Andrius V) tlp+acphy ex+exphy epic+qsphy vge+ciphy (tested by Andrius V) vr+ukphy (tested by Andrius V) vte+ukphy (tested by Andrius V) Not tested (MAC): arm:at91emac arm:cemac arm:epe arm:geminigmac arm:enet arm:cpsw arm:emac(omac) arm:emac(sunxi) arm:npe evbppc:temac macppc:bm macppc:gm mips:aumac mips:ae mips:cnmac mips:reth mips:sbmac playstation2:smap powerpc:tsec powerpc:emac(ibm4xx) sgimips:mec sparc:be sf ne(ax88190, dl10019) awge ep gem hme smsh mtd sm age alc ale bce cas et jme lii nfe pcn ste stge tl xi aue mue smsc udav url Not tested (PHY): amhphy bmtphy dmphy etphy glxtphy ikphy iophy lxtphy nsphyter pnaphy rdcphy sqphy tlphy tqphy urlphy
2019-01-11 Remove extra PHY read in brgphy_mii_phy_auto().msaitoh
2019-01-08 Whitespace fixes. No functional change.msaitoh
2014-07-02Add BCM5706.msaitoh
2014-07-02- 5720S and 5709S share the same PHY id. Assume 5720S PHY if parent devicemsaitoh
is bge(4). Same as FreeBSD. Tested on HP Moonshot. - Fix media detect on some Fiber chips. Tested on my own BCM5709 card. Same as {Free,Open}BSD.
2014-07-02 Don't check BNX_CHIP_NUM. Check MII PHY ID because this check is usedmsaitoh
for both bge(4) and bnx(4).
2014-07-02- Remove extra delay in brgphy_mii_phy_auto. Same as {Free,Open}BSD.msaitoh
- s/u_int/uint/ - KNF.
2014-06-18 Fix uninitiazed variable problem found on zaurus. I don't know whymsaitoh
only zaurus found it.
2014-06-17- Fix detection of BGEPHYF_FIBER_{MII|TBI}msaitoh
- Add BCM5708S support in brgphy(4). The auto negotiation may have some bugs. - Add 2500SX support (not tested). - Fix bit definition of BRGPHY_MRBE_MSG_PG5_NP_T2 from FreeBSD.
2014-06-16 IFM_FDX and IFM_HDX use different bit, so set IFM_HDX bit if it's not fullmsaitoh
duplex. For many drivers, it recognize half duplex if IFM_FDX isn't set, but not for others. Same as {Free|Open}BSD.
2014-06-12No functional change:msaitoh
- Remove BRGPHY_SERDES_ANAR_* and BRGPHY_SERDES_ANLPAR_*. Those registers are the same as MII_ANAR_* and MII_ANLPAR_*. - Fix typo. - Remove trailing white spaces. - KNF.
2013-10-31Cleanup flag setting. No functional change.msaitoh
- Split flags into bge_flags and bge_phy_flags. - Rename flags. PHY related flags are prefixed with BGEPHYF_*. Other flags are prefixed with BGEF_*.
2013-06-21 Call brgpy specific autonego function in MII_TICK. Before this commit,msaitoh
only MII_MEDIACHG calls brgphy_mii_phy_auto() and MII_TICK calls MI mii_phy_auto(). That was not intended.
2013-06-16 The bit location of link ability is different between 1000Base-X and othersmsaitoh
(See annex 28B.2 and 28D). The old mii.h defined ANAR_X_PAUSE_* macros. Those macros were named for 1000Base-X, but the bit definitions were not for 1000Base-X but for others (e.g. 1000BaseT). So there was bug in auto negotiation for 1000Base-X, but there was no bug for other media. Define new macro named ANAR_PAUSE_* and ANLPAR_PAUSE_* for other than 1000Base-X and fix the bit definitions of ANAR_X_PAUSE_* and ANLPPAR_X_*. Change some PHY drivers to use true macro. Same as other *BSDs.
2013-06-14KNF.msaitoh
2013-06-06 Fix a bug that the auto negotiation timer isn't cleard as we expected.msaitoh
To not to forget clearing the timer and to reduce the code duplication, clear mii_ticks in *mii_phy_auto().
2013-04-01 In brgphyattach(), set sc_isbge, sc_isbnx and sc_phyflags before PHY_RESET()msaitoh
because brgphy_reset() refers those flags.
2013-03-19- Rename PHY related flags for the consistency. It's the same as FreeBSD.msaitoh
- Remove BGE_10_100_ONLY flag because this was not used. For 10/100 devices, when calling mii_attach(), mask BMSR_EXTSTAT flag to not to check Gigabit flags. It's the same as FreeBSD.
2013-03-15Add BCM5756, BCM5717C, BCM5719C, BCM5720C and BCM57780.msaitoh
2012-09-17Add support for BCM57765. PR kern/46961tsutsui
2011-06-07add BCM5785 phy:cegger
brgphy0 at bge0 phy 1: BCM5785 1000BASE-T media interface, rev. 3 brgphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FD , auto
2011-05-02Fix BCM5709 PHY detection for ethernet PHYs (the SerDes case being alreadyjym
handled): - export bge(4) and bnx(4) CHIP ID and PHY flags to brgphy(4). Move to "unsigned int" rather than "int", and reuse the same softc members for chipid and phyflags (behavior controlled by the sc_isbge/isbnx boolean). - apply bug fix for revisions A and B, so that autonegotiation can complete (from OpenBSD). Bug reported by Rivo Nurges via private mail, patch tested and confirmed working by him (with thanks!)
2010-12-09Add support for BCM5709S (SerDes PHY) in brgphy(4).jym
From FreeBSD, via OpenBSD, with some minor adaptations. No comments, no objections on tech-kern@. The driver was tested on a Dell M710. Access was kindly provided by Uwe Toenjes, whom I thank for this. See also http://mail-index.netbsd.org/tech-kern/2010/12/01/msg009478.html
2010-11-27Use device_private() instead of casting softc to (void *).jym
2010-05-02Include support for BCM5481. From OpenBSD and confirmed to work bypgoyette
myself on XFX nForce 790i motherboard.
2010-04-27For a couple of flags, use bool/true/false instead of int/1/0.dyoung
2010-03-13Add Broadcom BCM5482.kiyohara
It tested on OpenBlockS600. (coming soon ;-) And reorder.
2010-01-24Add support for BCM5461,BCM5784 and BCM5761.msaitoh
Enable brgphy_jumbo_settings(). Enable the Ethernet@Wirespeed function.
2009-11-18Support BCM5709CAX and BCM5709C PHYs.bouyer
2009-10-19Remove closes 3 & 4 from my licence. Lots of thanks to Soren Jacobsenbouyer
for the booring work !
2009-08-12Match the Broadcom BCM5464 PHY.simonb
2009-06-17Unwrap not so long lines.tsutsui
2009-06-17- no need to use device_parent() because device_t parent is passedtsutsui
via config_attach(9) - use device_is_a() rather than strcmp() for readability
2009-05-12struct device * -> device_t, no functional changes intended.cegger
2009-05-12struct cfdata * -> cfdata_t, no functional changes intended.cegger
2009-04-23use proplibmsaitoh
2009-04-19Some fixes and enhancements:msaitoh
Both if_bge* and brgphy.[ch]: Check the parent's MAC and use the quirk code for the bug like OpenBSD and FreeBSD. Some bugs can't identify the PHY ID. For example, 5704 Ax has the ADC bug, but 5704 A3 and 5704 B0 have the same PHY ID and revision. Add BGE_PHY_CRC_BUG, BGE_PHY_ADC_BUG, BGE_PHY_5704_A0_BUG, BGE_PHY_JITTER_BUG, BGE_PHY_ADJUST_TRIM and BGE_PHY_BER_BUG for this flag. Some of the DSP patches are newly taken from OpenBSD and FreeBSD. if_bge*: Remove duplicated BGE_CHIPID_BCM5714_A0 entry in the known CHIPID table. Fix obsolete comments. brgphy.[ch]: Add some PHY IDs. TODO: Add more three quirk code into bge and brgphy (the brgphy side's are currently #if0'ed). Add support for bnx into brgphy (currently #if0'ed)
2009-04-07Detach brgphy(4) at shutdown.dyoung