Home | History | Annotate | Download | only in mii
History log of /src/sys/dev/mii/gphyter.c
RevisionDateAuthorComments
 1.37  15-Mar-2020  thorpej Define and implement a locking protocol for the ifmedia / mii layers:
- 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.
 1.36  27-Nov-2019  msaitoh - Simplify sc->mii_anegticks setting. Same as FreeBSD.

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().
 1.35  26-Nov-2019  msaitoh Fix typo in comment.
 1.34  21-Nov-2019  msaitoh Whitespace.
 1.33  25-Mar-2019  msaitoh KNF. No functional change.
 1.32  24-Feb-2019  christos use a macro to tidy up the phydesc array initialization, from FreeBSD
 1.31  22-Jan-2019  msaitoh Change MII PHY read/write API from:

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
 1.30  07-Jul-2016  msaitoh branches: 1.30.16; 1.30.18;
KNF. Remove extra spaces. No functional change.
 1.29  16-Jun-2014  msaitoh branches: 1.29.4;
IFM_FDX and IFM_HDX use different bit, so set IFM_HDX bit if it's not full
duplex. For many drivers, it recognize half duplex if IFM_FDX isn't set,
but not for others. Same as {Free|Open}BSD.
 1.28  07-Jan-2010  jdc branches: 1.28.18; 1.28.22; 1.28.36;
Add DP83865 to the supported PHY list (from OpenBSD).
 1.27  19-Oct-2009  bouyer Remove closes 3 & 4 from my licence. Lots of thanks to Soren Jacobsen
for the booring work !
 1.26  17-Nov-2008  dyoung Reduce code duplication: most PHY drivers call mii_phy_add_media()
when they attach to the device tree, so call pmf_device_register(9)
once there instead of once in more than twenty drivers.
 1.25  05-May-2008  tsutsui branches: 1.25.6; 1.25.8;
Use device_private() where appropriate.
 1.24  04-May-2008  xtraeme device_t/softc split for all mii(4) devices, and other related
cosmetic changes.
 1.23  28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.22  08-Apr-2008  cegger branches: 1.22.2; 1.22.4;
use aprint_*_dev and device_xname
 1.21  20-Jan-2008  msaitoh branches: 1.21.6;
mii_physubr.c::mii_phy_reset() has gphyter and nsphyter specific delay(500).
This delay cause 500us loops under splnet() per linkdown port per mii_tick.
It causes periodically drop packets. It's not acceptable for other devices.

Move gphyter and nsphyter specific delay(500) into the drivers from
mii_physubr.c.
 1.20  09-Dec-2007  jmcneill branches: 1.20.2;
Merge jmcneill-pm branch.
 1.19  16-Nov-2006  christos branches: 1.19.22; 1.19.24; 1.19.30; 1.19.34; 1.19.36;
- don't hardcode 5, 10 define and use MII_ANEGTICKS{,_GIGE}
- instead of != limit, use <= limit (conservative)
 1.18  16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.17  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.16  11-Dec-2005  christos branches: 1.16.20; 1.16.22;
merge ktrace-lwp.
 1.15  23-Aug-2004  thorpej branches: 1.15.12;
Make use of static.
 1.14  11-Apr-2004  thorpej gmii_phy_getflowcontrol() -> mii_phy_flowstatus(). From HITOSHI Osada.
 1.13  10-Apr-2004  thorpej Fetch negotiated flow control parameters. From HITOSHI Osada.
 1.12  29-Apr-2003  thorpej branches: 1.12.2;
Use aprint*().
 1.11  02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.10  30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.9  27-Sep-2002  thorpej Declare all cfattach structures const.
 1.8  03-Jul-2002  simonb Don't include <malloc.h> - no memory management style functions are use
in any of the MII drivers.
 1.7  25-Mar-2002  thorpej branches: 1.7.2;
Get flags passed down to PHY drivers correctly. This was done on
an adhoc basis in a couple of PHY drivers, this fixes it more generally.

Per a discussion w/ Cliff Neighbors <cliff@allegronetworks.com>.
 1.6  13-Nov-2001  lukem add RCSID
 1.5  25-Aug-2001  thorpej ANSI'ify.
 1.4  30-Jun-2001  bjh21 branches: 1.4.2;
IFM_1000_TX -> IFM_1000_T, as (breifly) discussed on tech-net.
 1.3  02-Jun-2001  thorpej branches: 1.3.2;
Make PHY matching all table-driven.
 1.2  31-May-2001  thorpej On the Gig PHYTER, For whatever reason, the 10baseT-related bits of the
BMSR are wired to 0, yet the PHY supports 10baseT. So, to get around
this, we test the ANAR 10baseT bits after a PHY reset. These bits are
set according to input pin 180. If we see the 10baseT ANAR bits set,
we fake them in the BMSR so that we can actually autonegotiate 10baseT.
 1.1  31-May-2001  thorpej Add a driver for the NatSemi DP83891 and DP83861 Gig PHYTER
10/100/1000 PHYs.
 1.3.2.8  18-Oct-2002  nathanw Catch up to -current.
 1.3.2.7  01-Aug-2002  nathanw Catch up to -current.
 1.3.2.6  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.2.5  14-Nov-2001  nathanw Catch up to -current.
 1.3.2.4  21-Sep-2001  nathanw Catch up to -current.
 1.3.2.3  24-Aug-2001  nathanw Catch up with -current.
 1.3.2.2  21-Jun-2001  nathanw Catch up to -current.
 1.3.2.1  02-Jun-2001  nathanw file gphyter.c was added on branch nathanw_sa on 2001-06-21 20:04:18 +0000
 1.4.2.5  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.4.2.4  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.4.2.3  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.2.2  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.2.1  13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.7.2.1  15-Jul-2002  gehenna catch up with -current.
 1.12.2.4  21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.3  18-Sep-2004  skrll Sync with HEAD.
 1.12.2.2  25-Aug-2004  skrll Sync with HEAD.
 1.12.2.1  03-Aug-2004  skrll Sync with HEAD
 1.15.12.2  21-Jan-2008  yamt sync with head
 1.15.12.1  30-Dec-2006  yamt sync with head.
 1.16.22.2  10-Dec-2006  yamt sync with head.
 1.16.22.1  22-Oct-2006  yamt sync with head
 1.16.20.1  18-Nov-2006  ad Sync with head.
 1.19.36.1  11-Dec-2007  yamt sync with head.
 1.19.34.1  26-Dec-2007  ad Sync with head.
 1.19.30.1  18-Feb-2008  mjf Sync with HEAD.
 1.19.24.2  23-Mar-2008  matt sync with HEAD
 1.19.24.1  09-Jan-2008  matt sync with HEAD
 1.19.22.2  08-Dec-2007  jmcneill Rename pnp(9) -> pmf(9), as requested by many.
 1.19.22.1  27-Nov-2007  joerg Register MII PHY drives with the PM framework. Nothing to do on suspend,
just reset the PHY on resume.
 1.20.2.1  20-Jan-2008  bouyer Sync with HEAD
 1.21.6.2  17-Jan-2009  mjf Sync with HEAD.
 1.21.6.1  02-Jun-2008  mjf Sync with HEAD.
 1.22.4.3  11-Mar-2010  yamt sync with head
 1.22.4.2  04-May-2009  yamt sync with head.
 1.22.4.1  16-May-2008  yamt sync with head.
 1.22.2.1  18-May-2008  yamt sync with head.
 1.25.8.1  19-Jan-2009  skrll Sync with HEAD.
 1.25.6.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.28.36.1  10-Aug-2014  tls Rebase.
 1.28.22.2  03-Dec-2017  jdolecek update from HEAD
 1.28.22.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.28.18.1  09-Nov-2014  martin Pull up following revision(s) (requested by msaitoh in ticket #1189):
sys/dev/pci/if_wm.c: revision 1.270
sys/dev/mii/inphy.c: revision 1.53
sys/dev/mii/glxtphy.c: revision 1.24
sys/dev/mii/tlphy.c: revision 1.62
sys/dev/mii/iophy.c: revision 1.37
sys/dev/mii/brgphy.c: revision 1.70
sys/dev/mii/ihphy.c: revision 1.8
sys/dev/mii/bmtphy.c: revision 1.31
sys/dev/mii/urlphy.c: revision 1.30
sys/dev/mii/makphy.c: revision 1.40
sys/dev/mii/qsphy.c: revision 1.48
sys/dev/mii/igphy.c: revision 1.23
sys/dev/mii/nsphy.c: revision 1.58
sys/dev/mii/mvphy.c: revision 1.10
sys/dev/pci/if_txp.c: revision 1.41
sys/dev/mii/nsphy.c: revision 1.59
sys/dev/mii/rlphy.c: revision 1.28
sys/dev/mii/icsphy.c: revision 1.49
sys/dev/mii/rlphy.c: revision 1.29
sys/dev/mii/lxtphy.c: revision 1.49
sys/dev/mii/ciphyreg.h: revision 1.5
sys/dev/mii/nsphyter.c: revision 1.38
sys/dev/mii/sqphy.c: revision 1.50
sys/dev/mii/gentbi.c: revision 1.26
sys/dev/mii/gentbi.c: revision 1.27
sys/dev/mii/tqphy.c: revision 1.39
sys/dev/mii/ikphy.c: revision 1.10
sys/dev/mii/dmphy.c: revision 1.35
sys/dev/mii/amhphy.c: revision 1.20
sys/dev/mii/acphy.c: revision 1.24
sys/dev/mii/ciphy.c: revision 1.25
sys/dev/mii/brgphyreg.h: revision 1.8
sys/dev/mii/ukphy_subr.c: revision 1.12
sys/dev/ic/rtl80x9.c: revision 1.16
sys/arch/mips/adm5120/dev/if_admsw.c: revision 1.12
sys/dev/pci/if_kse.c: revision 1.28
sys/dev/mii/ukphy_subr.c: revision 1.13
sys/dev/mii/mii.h: revision 1.18
sys/dev/mii/gphyter.c: revision 1.29
No functional change:
- Fix typo.
- Remove trailing white spaces.
- Capitalize comments.
- Tabify.
- KNF.
IFM_FDX and IFM_HDX use different bit, so set IFM_HDX bit if it's not full
duplex. For many drivers, it recognize half duplex if IFM_FDX isn't set,
but not for others. Same as {Free|Open}BSD.
 1.29.4.1  09-Jul-2016  skrll Sync with HEAD
 1.30.18.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.30.18.1  10-Jun-2019  christos Sync with HEAD
 1.30.16.1  26-Jan-2019  pgoyette Sync with HEAD

RSS XML Feed