Commit Graph

457 Commits

Author SHA1 Message Date
David Christensen
bf10880210 - Add PHY ID for BCM5709C 1000Base-T controllers.
MFC after:	1 week
2008-03-05 22:58:02 +00:00
Pyun YongHyeon
b455d946f5 Add detection of isolation state.
PR:	kern/76710
2008-03-05 01:15:10 +00:00
Rafal Jaworowski
ff857dc5d6 Recognize the quad-port Cicada (Vitesse) CS8204 10/100/1000TX PHY.
This PHY is found on many embedded development boards: among others MPC8555CDS
evaluation systems use it.

Approved by:	cognet (mentor)
MFp4:		e500
2008-03-03 18:44:33 +00:00
Marius Strobl
82f358ff2a - Fix a typo in a comment.
- Fix whitespace according to style(9).
- Sync the comment describing why we have to wait in nsphy_reset()
  with nsphyter_reset(). It's true that the manual tells to not do a
  reset within 500us of applying power but that's unlikely the cause
  of problems seen here. Generally having to wait 500us after a reset
  however is.
2008-01-27 01:30:02 +00:00
Marius Strobl
4f3b854461 Fix a typo in a comment. 2008-01-27 01:11:57 +00:00
Marius Strobl
d47d37af9b Add a driver for the National Semiconductor DP83815, DP83843 and
DP83847 PHYs. The main reason for using a specific driver for these
PHYs are reset quirks similar to the nsphy(4) driven DP83840A.

PR:		112654
Obtained from:	NetBSD
MFC after:	2 weeks
Thanks to:	mlaier for testing w/ DP83815
2008-01-27 01:10:41 +00:00
Jung-uk Kim
86543395c1 Add a flag for Ethernet@WireSpeed capability and correct chip revisions.
The idea was taken from OpenBSD and cross-referenced with Linux driver.
2008-01-18 22:09:50 +00:00
Pyun YongHyeon
5f36bdfcc2 Reset autonegotation timer if media option is not IFM_AUTO.
Make mii_ticks advance, autonegiation is retried every
mii_anegticks seconds.
2007-11-16 10:39:18 +00:00
Pyun YongHyeon
d612cc5947 IEEE 802.3 Annex 28B.3 explicitly specifies the following relative
priorities of the technologies supported by 802.3 Selector Field
value.

1000BASE-T full duplex
1000BASE-T
100BASE-T2 full duplex
100BASE-TX full duplex
100BASE-T2
100BASE-T4
100BASE-TX
10BASE-T full duplex
10BAST-T

However PHY drivers didn't honor the order such that 100BASE-T4 had
higher priority than 100BASE-TX full duplex. Fix that long standing
bugs such that have PHY drivers choose the highest common denominator
ability.
Fix a bug in dcphy which inadvertently aceepts 100BASE-T4.

PR:	92599
2007-11-16 10:25:36 +00:00
Pyun YongHyeon
fa99a6317c Setting sc->mii_anegticks to MII_ANEGTICKS_GIGE in rgephy_attach()
is redundant. mii_phy_add_media() already takes care of that.

Pointed out by:	marius
2007-10-30 00:37:35 +00:00
Marius Strobl
2a6a6e5ca7 - Remove MIIF_NOISOLATE; there's generally no reason to let gentbi(4)
set this flag and it was more or less just copied and pasted from
  another FreeBSD driver while porting this driver from NetBSD, whose
  gentbi(4) doesn't set MIIF_NOISOLATE either.
- Fix spelling in a comment.

OK'ed by:	yongari
MFC after:	3 months
2007-10-29 21:11:55 +00:00
Pyun YongHyeon
6fd47025e1 Add 88E1116/88E1116R PHY support code that takes the PHY out of
power-down mode.

PR:	kern/114086
MFC after:	3 days
2007-10-29 05:50:22 +00:00
Pyun YongHyeon
0bc6ff67a0 Add a newer RTL8211B(L) PHY. 2007-10-29 02:17:44 +00:00
Pyun YongHyeon
648bfbe6a7 Add support for RealTek RTL8211B(L) PHY. It's based on the patch
made by Michael Eisele and the patch was slightly modified by me.
With this change several NVIDIA ethernet controllers(e.g. MCP61)
works.

RTL8211B(L) is RealTek's new gigabit PHY. The PHY has several
features including crossover correction, polarity correction as
well as supporting triple speed(10/100/1000bps). Data transfer
between MAC and PHY is via RGMII for 1000baseT, MII for
10baseT/100baseTX.
Unfortunately, RealTek used the same model number for RTL8211B(L)
PHY so there is no way to discriminate between RTL8211B(L) and its
predecessors. ATM RTL8211B uses revision number 2 so checking the
revision number seems to be only way to identify it.

Obtained from:	Michael Eisele [1]
Tested by:	clemens fischer < ino-qc AT spotteswoode DOT de DOT eu DOT org >
2007-10-29 02:17:07 +00:00
Pyun YongHyeon
37fd5f0fed o RTL8169S/8110S integrated PHY and RTL8211B are gigabit PHYs so set
mii_anegticks to MII_ANEGTICKS_GIGE and use it. Previously it used
  to MII_ANEGTICKS which may not be enough to wait before retrying
  autonegotiation process at 1000bps.
o Reset autonegotation timer if media option is not IFM_AUTO or we
  got a valid link.
o Announce link loss right after it happends.
o Autonegiation is retried every mii_anegticks seconds.
o Report link state changes right after setting autonegotiation.
2007-10-29 02:06:15 +00:00
Pyun YongHyeon
78679427f6 Add icsphy(4), Integrated Circuit Systems PHY driver, ported from
NetBSD. ATM the only consumer of the PHY is XBox with nfe(4) driver.

Submitted by:	Ed Schouten <ed@fxq.nl>
Tested by:	Ed Schouten <ed@fxq.nl>
2007-06-11 02:04:50 +00:00
Pyun YongHyeon
fcb11bb3f9 Add ICS1889/ICS1892/ICS1893 PHY.
Submitted by:	Ed Schouten <ed@fxq.nl>
2007-06-11 02:02:20 +00:00
David Christensen
599741f908 - Fixed a problem that caused autonegotiation failures.
Submitted by:	tor.egge@cvsup.no.freebsd.org
MFC after:	4 weeks
2007-06-08 02:34:44 +00:00
David Christensen
7656f58e1c New features:
- Moved BCM5706S/5708S SerDes support to brgphy (since they are not technically
  TBI interfaces)
- Added 2.5G support for BCM5708S

Comments:
Since this driver is shared with bge I tested several available controllers
supported by bge and all worked as expected, however the list was not
exhaustive.  Need wider testing.

MFC after:	4 weeks
2007-06-07 02:21:38 +00:00
Pyun YongHyeon
f6e6f7f2fa Add support IC Plus IP101 10/100 PHY that is found on nVidia network
adapters.

Submitted by:	Shigeaki Tagashira < shigeaki AT se DOT hiroshima-u DOT ac DOT jp >
2007-06-06 07:07:23 +00:00
Pyun YongHyeon
3d6f32f19f Add IC Plus IP101 PHY 2007-06-06 07:05:02 +00:00
Pyun YongHyeon
9f6cc3adc7 Add support Vitesse VSC8601 PHY that is found on nVidia network
adapters.

Submitted by:	Shigeaki Tagashira < shigeaki AT se DOT hiroshima-u DOT ac DOT jp >
Tested by:	Yuri Pankov < yuri.pankov AT gmail DOT com>,
		Rainer Hurling <rhurlin AT gwdg DOT de >
2007-06-06 06:55:49 +00:00
Pyun YongHyeon
1fec2d74cf Add OUI for Vitesse Semiconductor.
Add Vitesse VSC8601 PHY.
2007-06-06 06:53:40 +00:00
Marcel Moolenaar
bd3032d144 Define the miibus ivars as a structure, instead of as a vector of
pointers. A structure is more readable and less error-prone. It
also avoids problems when a function pointer doesn't have the
same width as a void pointer.
2007-05-01 18:21:24 +00:00
Marius Strobl
2f9f08b635 - Take advantage of mii_phy_add_media() for adding media and setting
sc->mii_anegticks according to whether the respective BGE chip
  supports Fast Ethernet only or also Gigabit Ethernet.
- At least the BGE chips I've tested with wedge when isolating them
  so document this as the reason for setting MIIF_NOISOLATE and
  remove the unused (and partially even #ifdef'ed out) isolation
  related code. Add code that panics if we encounter a non-zero MII
  instance as generally there's no way a PHY requiring MIIF_NOISOLATE
  can be handled gracefully in a multi-PHY configuration (it's ok for
  the internal PHY of single-PHY-only-NIC to not support isolation
  though).
- Additionally set MIIF_NOLOOP as loopback doesn't seem to work
  either and remove the #ifdef'ed out code for adding respective
  media. The MIIF_NOLOOP flag currently triggers nothing but
  hopefully will be respected by mii_phy_setmedia() later on.

Reviewed by:	jkim, yongari
MFC after:	1 month
2007-04-30 22:35:33 +00:00
Marius Strobl
5abeece6ab Let brgphy(4) attach for the Broadcom BCM5755 ASIC based chipsets
as well.

Obtained from:	OpenBSD
MFC after:	1 week
2007-04-10 20:43:23 +00:00
Jung-uk Kim
9239bab2fe Revert couple of changes from 1.51 and 1.52. Reading link status with BMSR
is okay for most of the chipsets but BCM5701 PHY does not seem to like it.
Set media to IFM_NONE if link is not up instead of the previous value.

Reported by:	Goran Lowkrantz (goran dot lowkrantz at ismobile dot com)
2007-03-19 23:17:39 +00:00
Warner Losh
3a5e8cefd3 mii_phy_dev_probe returns its third argument on match, not 0, so pass 0
in if we're going to test against 0.

Noticed by: marius@
2007-02-26 04:48:24 +00:00
John Baldwin
f7a66f06ec Restore support for the 5706C bce(4) phy that was broken during the
addition of SerDes support.  According to the docs, the 5706C and 5708C
phys are supposed to use the same MII model that is separate from the
SerDes parts, but the 5706C actually uses the MII model of the SerDes
parts.  To fix this, readd the old 5706C entry to miidevs and add a
special check in brgphy_probe() for phys that match the 5706C ID.  If
the phy is supported by the gentbi(4) driver, then it's a SerDes phy, so
we fail the probe and let gentbi(4) grab it.  Otherwise, it's a 5706C phy,
so we let brgphy(4) grab it.

In coordination with:	dwhite
2007-02-21 18:17:44 +00:00
Jung-uk Kim
b0e42d5c0c Fix a typo from the previous commit.
Pointed out by:	brad@openbsd.org
2007-02-14 18:21:32 +00:00
Jung-uk Kim
5033133005 Fix typos in comments while I am here. 2007-02-13 00:34:32 +00:00
Jung-uk Kim
1ec4c3a889 Add BCM5701 A0/B0 CRC bug workaround. Magic values taken from Linux driver. 2007-02-12 23:58:52 +00:00
Jung-uk Kim
797b2220ae Fix style(9).
Pointed out by:	many
2007-02-12 23:33:05 +00:00
Jung-uk Kim
08bf8bb7c1 Add PHY DSP code for BCM5755M.
Obtained from:	OpenBSD
2007-02-12 22:51:25 +00:00
Jung-uk Kim
bef098d808 BCM5701 PHY cannot read-modify-write. Just re-use the magic number from DSP
init code.
2007-02-12 20:26:56 +00:00
Jung-uk Kim
7ca000fd87 Replace magic numbers with corresponding definitions. 2007-02-12 19:33:22 +00:00
Warner Losh
6d2b26f4a0 Fix problem with RTL8201L PHY. From submitter:
Bugfix for the Realtek PHY driver... an RTL8201L standalone PHY
    needs different handling than the integrated ones in terms of
    speed detection.  There was a bogus test based on the parent
    device driver name string controlling which speed register to
    query.  That test began failing when the rl driver was split into
    separate rl and re drivers some time ago.  Apparently nobody ever
    noticed because the buggy code only executes if NWAY negotiation
    failed.  Since we happen to be testing with an ancient dumb hub
    rather than a modern switch, we found it.

    To fix it all, have the attach() routine notice whether we're
    dealing with an integrated PHY or an RTL8201L and store that info
    in a struct accessible to the status() routine that needs to know
    which register to query.

I touched up the fixes because they were relative to RELENG_6 and to
bring a few nits into line with style(9).

MFC After: 2 weeks
Submitted by: Ian Lepore
2007-02-08 19:16:15 +00:00
Doug White
e30d3a0c79 Add missing MIIBUS_MEDIAINIT() call. 2007-01-26 17:06:02 +00:00
Doug White
3c3d8e1e45 Collapse 5706C and 5708C PHYs into one entry. ID 0x15 is actually used for
the SERDES PHY on these chips and we want gentbi to pick this up, not brgphy.
2007-01-26 17:05:24 +00:00
Marius Strobl
e54f674652 Correct a logic bug in the previous change. 2007-01-21 19:28:00 +00:00
Marius Strobl
9bcdfcae43 - In miibus_attach() remove IFM_IMASK from the dontcare_mask of the
ifmedia_init() invocation. IFM_IMASK makes only sense here when all of
  the maxium of 32 PHYs on each one MII bus support disjoint sets of media,
  which generally isn't the case (though it would be nice if we had a way
  to let NIC drivers indicate that for the few card models where the PHY
  configuration is known/fixed and IFM_IMASK actually makes sense).
- Add and use a miibus_print_child() for the bus_print_child method which
  additionally prints the PHY number (which actually is the PHY address)
  so one can figure out the media instance <-> PHY number mapping from the
  PHY driver attach output. This is intented to be usefull in situations
  where the addresses of the PHYs on the bus are known (f.e. of internal/
  integrated PHYs) so one can feed the appropriate media instance number
  to ifconfig(8) (with the upcoming change for ifconfig(8)).
  This is more or less inspired by the NetBSD mii_print().
2007-01-20 00:55:03 +00:00
Marius Strobl
b8a5d0481a - Don't set MIIF_NOISOLATE so ukphy(4) can be used in configurations with
multiple PHYs. In case some PHYs currently driven by ukphy(4) exhibit
  problems when isolating due to incomplete implementations or silicon bugs
  we'll need to add specific drivers for these. Looking at NetBSD and
  OpenBSD I don't expect problems here though (quite the contrary; we still
  seem to set MIIF_NOISOLATE without good reason in a bunch of PHY drivers).
- Fix a style(9) whitespace nit.
2007-01-20 00:52:29 +00:00
Jung-uk Kim
b2430c5000 Correct driver_t brgphy_driver, which was forgotten from the last commit. 2007-01-16 17:48:57 +00:00
Jung-uk Kim
900e97a881 Move MII model and revision into softc. 2007-01-16 00:52:26 +00:00
Jung-uk Kim
d69e0bb92e - Move Ethernet@WireSpeed and jumbo frame configurations to separate
functions.  The idea is taken from OpenBSD.
- Set/clear jumbo frame configurations for bge(4).
- Re-add BCM5750 PHY workaround for bce(4), which was mistakenly removed
from the previous commit.
2007-01-15 22:21:44 +00:00
Jung-uk Kim
5ee49a3a58 - Fix BCM5754 support found in Dell PowerEdge SC440.
- Move some PHY bug detections from brgphy.c to if_bge.c.
- Do not penalize working PHYs.
- Re-arrange bge_flags roughly by their categories.
- Fix minor style(9) nits.

PR:		kern/107257
Obtained from:	OpenBSD
Tested by:	Mike Hibler <mike at flux dot utah dot edu>
2007-01-15 21:43:43 +00:00
Marius Strobl
2e0b466321 After another thought there is another nail for the mii_phy_dev_probe()-
hammer.
2007-01-13 00:17:39 +00:00
Marius Strobl
2bf52b991f Remove mii_media_from_bmcr(); all previous users have been converted to
use mii_phy_add_media()/mii_phy_setmedia().
2007-01-13 00:14:45 +00:00
Marius Strobl
75b1a030f1 - Take advantage of mii_phy_dev_probe() and mii_phy_setmedia().
- Set MIIF_NOLOOP as loopback doesn't work with this PHY. The MIIF_NOLOOP
  flag currently triggers nothing but hopefully will be respected by
  mii_phy_setmedia() later on.
- Use MII_ANEGTICKS instead of 5.
- Remove an unused macro.
- Fix some whitespace nits.

MFC after:	1 week
2007-01-13 00:06:41 +00:00
Marius Strobl
d1b9b18869 - Take advantage of mii_phy_dev_probe().
- In exphy_service() for the MII_TICK case don't bother to check whether
  the currently selected media is of type IFM_AUTO as auto-negotiation
  doesn't need to be kicked anyway.
- Remove #if 0'ed unapplicable code.
- Fix some whitespace nits.

MFC after:	1 week
2007-01-12 23:17:43 +00:00
Marius Strobl
a9ddce9830 Set MIIF_HAVE_FIBER and add IFM_100_FX media when the AC_MCTL_FX_SEL
and thus the FX_DIS pin indicates fibre media. This is part 1/2 of
adding support for the 100baseFX interface/port of AT-2700 series
adaptors.

Idea from:	NetBSD
MFC after:	1 week
2007-01-12 22:59:38 +00:00
Marius Strobl
0fd495e21f - Correct the AC_MCTL_BYP_PCS constant.
- Correct whitespace nits (use #define<tab>, remove trailing whitespace).
2007-01-12 22:58:04 +00:00
Marius Strobl
3d7c219de9 Use mii_phy_add_media()/mii_phy_setmedia()-compatible media table
indices when manually adding media. Some of these I've missed while
converting drivers to take advantage of said fuctions recently,
others where longstanding bugs.
2007-01-12 22:27:46 +00:00
Bernd Walter
5991458e2e MFp4: add basic driver for RTL8305SC switch in PHY emulation 2007-01-05 01:46:26 +00:00
Jung-uk Kim
1beb06dd0d Use BMSR for link status in one more place and clean up more. 2006-12-20 00:34:12 +00:00
Jung-uk Kim
d56df7ca25 - Do not depend on auto negotiation for link speed/duplex status.
- Read link status from BMSR instead of auxilary status register.
- Clean up style(9) nits.
2006-12-20 00:08:47 +00:00
Oleg Bulyzhin
25ff664232 - Fix autonegotiation timer.
- Use MII_ANEGTICKS/MII_ANEGTICKS_GIGE defines instead of hardcoded value.
- Fix some comments.
- style(9)

MFC after:	2 month
2006-12-19 08:41:48 +00:00
Marius Strobl
b91805b4cd Correct the previous change:
- If we want mii_phy_add_media() to add 1000baseT media, we need to
  supply sc->mii_extcapabilities.
- Fix formatting when announcing autonegotiation support.
2006-12-18 02:14:26 +00:00
Pyun YongHyeon
bbc9416dc9 o Add support code for newer Marvell PHYs.
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
2006-12-11 11:09:48 +00:00
Pyun YongHyeon
eafc9368bc Add additional Marvell PHY registers. 2006-12-11 10:43:32 +00:00
Pyun YongHyeon
938beb1599 Add a bunch of new Marvell PHY ids. 2006-12-11 10:42:04 +00:00
Pyun YongHyeon
d2ca0c42f7 style(9) 2006-12-11 10:22:24 +00:00
Scott Long
66dfa04f7c Teach the brgphy about some new Broadcom IDs.
Submitted by: David Christenson
Sponsored by: www.UIA.net
2006-12-11 01:29:40 +00:00
Marius Strobl
f448ecb4f5 - Probe Davicom DM9102 PHYs.
- Don't set MIIF_NOISOLATE so amphy(4) can be used in configurations
  with multiple PHYs. There doesn't seem to be a problem with isolating
  AM79c873 and workalikes per se nor in combination with the NICs they're
  used with and amphy(4) was already adding IFM_NONE anyway.
- Use mii_phy_add_media() instead of mii_add_media() so the latter can
  be eventually retired.
- Take advantage of mii_phy_setmedia().
- Fix a whitespace nit.

Obtained from:	NetBSD dmphy(4) (except for the last item)
MFC after:	2 weeks
2006-12-02 21:21:16 +00:00
Marius Strobl
65169ee9c6 - In acphy_service() for the MII_TICK case don't bother to check whether
the currently selected media is of type IFM_AUTO as auto-negotiation
  doesn't need to be kicked anyway.
- Fix a whitespace nit.
- Probe another Altima PHY, which is a AC101 workalike and integrated
  in at least ADMtek ADM8511 but apparently is not mentioned in any
  publically available data sheet so the actual identifier is unknown.
- Don't set MIIF_NOISOLATE so acphy(4) can be used in configurations
  with multiple PHYs. There doesn't seem to be a problem with isolating
  AC101 and workalikes 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 and second item)
MFC after:	2 weeks
2006-12-02 21:19:54 +00:00
Marius Strobl
18e13cb9aa - Add another Altima PHY, which is a AC101 workalike and integrated
in at least ADMtek ADM8511 but apparently is not mentioned in any
  publically available data sheet so the actual identifier is unknown.
- Add Davicom DM9102 PHY.
- Add DM9101 to the description of AMD 79C873 as at least some Davicom
  DM9101F identify identical to AMD 79C873.

Obtained from:	NetBSD
MFC after:	2 weeks
2006-12-02 21:18:56 +00:00
Marius Strobl
9dd3a16881 - Don't set MIIF_NOISOLATE so tdkphy(4) can be used in configurations
with multiple PHYs. There doesn't seem to be a problem with isolating
  78Q2120 per se nor in combination with the NICs they're used with and
  tdkphy(4) was already adding IFM_NONE anyway.
- Set MIIF_NOLOOP as loopback doesn't work with this PHY. The MIIF_NOLOOP
  flag currently triggers nothing but hopefully will be respected by
  mii_phy_setmedia() later on.
- Use mii_phy_add_media() instead of mii_add_media() so the latter can
  be eventually retired.
- Take advantage of mii_phy_setmedia().

Thanks to Hans-Joerg Sirtl for lending me test hardware.

Obtained from:	NetBSD tqphy(4)
MFC after:	2 weeks
2006-12-02 20:16:45 +00:00
Marius Strobl
ba76315fa2 - Don't set MIIF_NOISOLATE so rgephy(4) can be used in configurations
with multiple PHYs and un-comment case IFM_NONE in case MII_MEDIACHG
  rgephy_service(). There doesn't seem to be a problem with isolating
  RTL8169S and their internal PHY.
- Take advantage of mii_phy_add_media(). [1]

Obtained from:	NetBSD [1]
Tested by:	yongari
MFC after:	2 weeks
2006-12-02 19:48:53 +00:00
Marius Strobl
028ccec463 Some style changes to a couple of PHY drivers:
- Fix some whitespace nits.
- Fix some spelling in comments.
- Use MII_ANEGTICKS instead of 5.
- Don't define variables in nested scope.
- Remove superfluous returns at the end of void functions.
- Remove unused static global rgephy_mii_model.
- Remove dupe $Id$ in tdkphy(4).
- Sort brgphys table.

MFC after:	2 weeks
2006-12-02 19:36:25 +00:00
Marius Strobl
a35b933378 Add a helper function mii_phy_dev_probe(), which wraps around the
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
2006-12-02 15:32:34 +00:00
Marius Strobl
38ee137b26 - In rlphy_service() for the MII_TICK case don't bother to check whether
the currently selected media is of type IFM_AUTO as auto-negotiation
  doesn't need to be kicked anyway.
- In rlphy_status() just use if_dname instead of determining the name
  of the parent NIC via device_get_name(device_get_parent(sc->mii_dev)).
- Use mii_phy_add_media() instead of mii_add_media() so the latter can
  be eventually retired.
- Take advantage of mii_phy_setmedia().
- Fix some whitespace nits and remove commented out code that just can't
  be used with RealTek PHYs.

MFC after:	2 weeks
2006-11-28 01:14:09 +00:00
Marius Strobl
f8f3badf74 - In qsphy_service() for the MII_TICK case don't bother to check whether
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
2006-11-28 01:08:45 +00:00
Marius Strobl
fb58dc87ca - Don't add IFM_NONE when used in combination with pcn(4) as for MII
loopback to work PCnet chips additionally need to be placed into
  external loopback mode which pcn(4) doesn't do so far.
- In nsphy_service() just use if_dname instead of determining the name
  of the parent NIC via device_get_name(device_get_parent(sc->mii_dev)).
- Don't set MIIF_NOISOLATE, except for when used in combination with a
  NIC that wedges when isolating the PHYs, so nsphy(4) can be used in
  configurations with multiple PHYs.
- Use mii_phy_add_media() instead of mii_add_media() so the latter can
  be eventually retired.
- Take advantage of mii_phy_setmedia() (requires the MIIF_FORCEANEG
  added in sys/dev/mii/mii_physubr.c 1.26, sys/dev/mii/miivar.h 1.19).
- Implement a separate nsphy_reset(). There are two reasons for this:
  1) This PHY can take an inordinate amount of time to reset if media
     is attached; under fairly normal circumstances up to nearly one
     second. This is because it appears to go through an implicit auto-
     negotiation cycle as part of the reset.
  2) During reset and auto-negotiation, the BMCR will clear the reset
     bit before the process is complete. It will return 0 until the
     process is complete and it's safe to access the PHY again.

  This is the first of two changes required to make the combination of
  Am79c971 and DP83840A found on certain HP cards and on-board in IBM
  machines work.
- Fix some whitespace nits.

Based on:	NetBSD (except for the first and second item)
MFC after:	2 weeks
2006-11-28 01:01:02 +00:00
Marius Strobl
1f4308521e - Rely on mii_phy_add_media() setting mii_anegticks as appropriate.
- Fix some whitespace nits.

MFC after:	2 weeks
2006-11-28 00:47:54 +00:00
Marius Strobl
79c8bb63d4 - Don't set MIIF_NOISOLATE so lxtphy(4) can be used in configurations
with multiple PHYs. There doesn't seem to be a problem with isolating
  LXT970 per se nor in combination with the NICs they're used with and
  lxtphy(4) was already adding IFM_NONE anyway.
- Use mii_phy_add_media() instead of mii_add_media() so the latter can
  be eventually retired.
- Take advantage of mii_phy_setmedia().
- Fix some whitespace nits.

Obtained from:	NetBSD
MFC after:	2 weeks
2006-11-28 00:45:48 +00:00
Marius Strobl
19e9da2099 - Remove a dupe $FreeBSD$.
- Fix some whitespace nits.
2006-11-28 00:43:38 +00:00
Marius Strobl
9475e904d6 Analogous to mii_add_media(), factor out the code for checking whether
the BMSR contains any media at all to mii_phy_add_media(). The majority
of the drivers currently using mii_phy_add_media() were missing such a
check anyway though.

MFC after:	2 weeks
2006-11-27 23:50:19 +00:00
Marius Strobl
0c3e319244 - Add a MIIF_FORCEANEG flag which forces an auto-negotiation to always
take place if IFM_AUTO is selected. This allows drivers like nsphy(4),
  which need to force writing the ANAR according to the BMSR, to take
  advantage of mii_phy_setmedia(). [1]
- In mii_phy_reset() once the current media is set don't isolate the PHY
  corresponding to the instance of the currently selected media rather
  than unconditionally not isolating the PHY corresponding to instance 0.
  This saves a isolation-unisolation-cycle of the PHY corresponding to
  the currently selected media for the case were it isn't instance 0.
- Fix some whitespace nits. [1]

Obtained from:	NetBSD [1]
MFC after:	2 weeks
2006-11-27 23:37:59 +00:00
Pyun YongHyeon
73810ef739 Add PHY support for BCM5752.
Tested by:	delphij, Ganbold < ganbold AT micom DOT mng DOT net >
2006-08-31 11:15:18 +00:00
Pyun YongHyeon
d58d1737d6 Add Broadcom BCM5752 PHY id. 2006-08-31 11:13:51 +00:00
Gleb Smirnoff
42953da8a7 Pack several boolean fields into single bge_flags field. 2006-08-23 15:37:07 +00:00
Pyun YongHyeon
4eb561d2e8 Due to the poor PHY documentation from RealTek I can't sure but I
think the RealTek PHY needs driver to set RGEPHY_BMCR_AUTOEN bit of
RGEPHY_MII_BMCR register and proper ANAR register setting for manual
media type selection.
This fixes long standing manual media type selection bug in rgephy(4).

Reported by:	Jelte Jansen <jelte AT NLnetLabs DOT nl>
Tested by:	Jelte Jansen <jelte AT NLnetLabs DOT nl>
2006-08-12 01:38:49 +00:00
Pyun YongHyeon
60a05afef9 Add ip1000 PHY driver for IC Plus IP1000A integrated PHY. 2006-07-25 00:16:09 +00:00
Pyun YongHyeon
ee6accfcc5 Add IC Plus IP1000A integrated PHY id. 2006-07-25 00:14:00 +00:00
Pyun YongHyeon
972fbe5ae5 Add gentbi, a generic TBI(teb-bit interface) PHY driver ported
from NetBSD.
2006-07-25 00:08:32 +00:00
Oleg Bulyzhin
1684fc1657 Reset autonegotiation timer if current media is not 'auto'.
Approved by:	glebius (mentor)
MFC after:	2 weeks
2006-07-03 10:37:09 +00:00
Pyun YongHyeon
f14119a8e0 Use mii_phy_match to reduce duplicated code.
Reviewed by:	glebius
2006-07-03 08:01:27 +00:00
Pyun YongHyeon
5358725ab4 Replace hard-coded magic constants to system defined constants
(BUS_PROBE_DEFAULT, BUS_PROBE_GENERIC etc).
There is no functional changes.

Reviewed by:	oleg, scottl
2006-07-03 02:53:40 +00:00
Bill Paul
ed510fb04f Add support for the RealTek 8169SC/8110SC and RTL8101E devices. The
latter is a PCIe 10/100 chip.

Finally fix the EEPROM reading code so that we can access the EEPROMs on all
devices. In order to access the EEPROM, we must select 'EEPROM programming'
mode, and then set the EEPROM chip select bit. Previously, we were setting
both bits simultaneously, which doesn't work: they must be set in the
right sequence.

Always obtain the station address from the EEPROM, now that EEPROM
reading works correctly.

Make the TX interrupt moderation code based on the internal timer
optional and turned off by default.

Make the re_diag() routine conditional and off by default. When it is
on, only use it for the original 8169, which was the only device that
that really needed it.

Modify interrupt handling to use a fast interrupt handler and fast
taskqeueue.

Correct the rgephy driver so that it only applies the DSP fixup for
PHY revs 0 and 1. Later chips are fixed and don't need the fixup.

Make the rgephy driver advertise both 1000_FD and 1000_HD bits in
autoneg mode. A couple of the devices don't autoneg correctly unless
configured this way.
2006-06-26 20:31:32 +00:00
Pyun YongHyeon
41cfbdeb51 If the PHY has 1000BASE-T capability, check to see if a 1000BASE-T speed
was negotiated.

Obtained from:  NetBSD
2006-05-19 03:51:42 +00:00
Poul-Henning Kamp
c40da00ca3 Since DELAY() was moved, most <machine/clock.h> #includes have been
unnecessary.
2006-05-16 14:37:58 +00:00
Oleg Bulyzhin
29aea9ec7d 1) Fix mii_phy_tick():
Current code does not report link loss correctly - when link goes down,
   mii_phy_tick() will notice that with up to mii_anegticks delay.
   If link goes up during this delay then link flapping will be unnoticed
   by driver.

2) mii_phy_add_media(): initialize sc->mii_anegticks for 10/100 media

3) Use MII_ANEGTICKS/MII_ANEGTICKS_GIGE defines instead of hardcoded values.

Approved by:	glebius (mentor)
MFC after:	1 month
2006-05-16 12:26:00 +00:00
Oleg Bulyzhin
1c47c79eb3 Introduce MII_ANEGTICKS and MII_ANEGTICKS_GIGE defines.
(How many ticks should we wait before retrying autonegotiation process).

Approved by:	glebius (mentor)
MFC after:	1 month
2006-05-16 12:23:57 +00:00
Paul Saab
7b76202b5a Fix the PHY support for the 5780. I mis-merged this from my sources. 2006-04-12 18:34:00 +00:00
Paul Saab
6caf734fd9 Add a driver for the Broadcom NetXtreme II (BCM5706/BCM5708)
PCI/PCIe Gigabit Ethernet adapeter.

Submitted by:	David Christensen
2006-04-10 19:55:23 +00:00
Oleg Bulyzhin
f78e78fd2f Add basic support for BCM5780 PHY.
Submitted by:	grehan
Approved by:	glebius (mentor)
MFC after:	1 week
2006-03-23 09:53:39 +00:00
Gleb Smirnoff
efd19b8fd0 - Introduce ifmedia_baudrate(), which returns correct baudrate of the
given media status. [1]
- Utilize ifmedia_baudrate() in miibus_statchg() to update ifp->if_baudrate.

Obtained from:	NetBSD [1]
2006-02-14 12:10:03 +00:00
Oleg Bulyzhin
dab5cd0588 1) fix tiny bug in bge_start_locked()
2) rework link state detection code & use it in POLLING mode
3) fix 2 bugs in link state detection code:
	a) driver unable to detect link loss on bcm5721
	b) on bcm570x chips (tested on bcm5700 bcm5701 bcm5702) driver fails
	   to detect link loss with probability 1/6 (solved in brgphy.c)

Devices working in TBI mode should not be affected by this change.

Approved by:	glebius (mentor)
MFC after:	1 month
2005-12-08 13:31:52 +00:00
Warner Losh
409b80f9d1 Remove dc-only pseudo phy devices after repo copy to dev/dc 2005-10-18 06:10:46 +00:00
Peter Grehan
b9284f0f45 The BCM5401 dspcode load on media changes also applies
to the 100/1000 BCM5400 phy. This fixes the problem with
the GEM port not syncing up on Sawtooth G4's.

Obtained from:  NetBSD
Reported by:    Ben Rosengart <ben + freebsd org at narcissus net>
2005-10-16 05:29:14 +00:00
Warner Losh
7d830ac9c2 Use ansi function definitions in preference to K&R to reduce diffs
with NetBSD (and cause it looks cooler).
2005-09-30 19:39:27 +00:00
Warner Losh
0d50777898 Not sporttings on other cards 2005-09-30 19:35:44 +00:00
Warner Losh
08576af02f Add a more generic version of the mii_phy_match routine (mii_phy_match_gen)
which can be used for phy that want to piggy back other data with their
table.
2005-09-30 14:51:44 +00:00
Warner Losh
a1039f82ae Add macros which follow the miidevs design pattern to make it easier
to construct tables for mii_phy_match.
2005-09-30 14:45:10 +00:00
Brooks Davis
f32e678d0c Add an evil hack to work around a cast from the softc to the ifnet that
I missed.  Since I did no rearrange any softcs, casting the result of
device_get_softc() to (struct ifnet **) and derefrencing it yeilds a
pointer to the ifp.  This makes at least vr(4) nics work.
2005-06-11 00:20:38 +00:00
Yoshihiro Takahashi
d4fcf3cba5 Remove bus_{mem,p}io.h and related code for a micro-optimization on i386
and amd64.  The optimization is a trivial on recent machines.

Reviewed by:	-arch (imp, marcel, dfr)
2005-05-29 04:42:30 +00:00
Paul Saab
419c028b36 Support the 5714C
Submitted by:	John Cagle <john dot cagle at hp dot com>
2005-05-19 21:08:59 +00:00
Warner Losh
8e325e2991 On second though, print the OUI, model and revision. This is the same
information that's in the id1 and id2 fields we were using, but is in
a form that the drivers will be using in their matching routines.
2005-02-16 05:56:39 +00:00
Warner Losh
aa4c3a8cd3 Add location and PNP info to the mii bus 2005-02-16 01:08:43 +00:00
Warner Losh
33d2d65419 Use ANSI function definitions, in preference to the K&R definitions. 2005-02-15 06:02:34 +00:00
Warner Losh
098ca2bda9 Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
Sam Leffler
94f5c9cfc0 Cleanup link state change notification:
o add new if_link_state_change routine that deals with link state changes
o change mii to use if_link_state_change
2004-12-08 05:45:59 +00:00
Bjoern A. Zeeb
098df78052 With mii.h rev 1.4 changes to BMSR_MEDIAMASK merged in from
NetBSD got activated. NetBSD has an additional change in
 their mii.c rev 1.26 which got missed with that merger:

 : When probing for a PHY, look at the EXTSTAT bit in the BMSR, as well,
 : not just the media mask.  This prevents PHYs/TBIs that only support
 : Gigabit media from slipping through the cracks.

With this GE only ones like from the SK-9844 are detected again.

PR:		i386/63313, i386/71733, kern/73725
Tested by:	matt baker <matt at sevenone dot com>, Jin Guojun <jin at george dot lbl dot gov>
Approved by:	rwatson (mentor)
Obtained from:	NetBSD mii.c rev 1.26
MFC after:	1 week
2004-11-26 19:42:40 +00:00
Paul Saab
e53d81eee9 Add support for the BCM5750/5751. Unfortunately the documentation
I have from Broadcom does not give much information on these devices,
so the Broadcom Linux driver was used for clues to what these chips
support.  It turns out they are similar to the 5705 with the 5751
being the PCI-Express version and needing special work-arounds and
settings.
2004-09-24 22:24:33 +00:00
Bill Paul
a07bd003bf Add device driver support for the VIA Networking Technologies
VT6122 gigabit ethernet chip and integrated 10/100/1000 copper PHY.
The vge driver has been added to GENERIC for i386, pc98 and amd64,
but not to sparc or ia64 since I don't have the ability to test
it there. The vge(4) driver supports VLANs, checksum offload and
jumbo frames.

Also added the lge(4) and nge(4) drivers to GENERIC for i386 and
pc98 since I was in the neighborhood. There's no reason to leave them
out anymore.
2004-09-10 20:57:46 +00:00
John-Mark Gurney
ad3b9257c2 Add locking to the kqueue subsystem. This also makes the kqueue subsystem
a more complete subsystem, and removes the knowlege of how things are
implemented from the drivers.  Include locking around filter ops, so a
module like aio will know when not to be unloaded if there are outstanding
knotes using it's filter ops.

Currently, it uses the MTX_DUPOK even though it is not always safe to
aquire duplicate locks.  Witness currently doesn't support the ability
to discover if a dup lock is ok (in some cases).

Reviewed by:	green, rwatson (both earlier versions)
2004-08-15 06:24:42 +00:00
Poul-Henning Kamp
41ee9f1c69 Add some missing <sys/module.h> includes which are masked by the
one on death-row in <sys/kernel.h>
2004-05-30 17:57:46 +00:00
Marius Strobl
f0e531572d DP83840A on hme(4) don't advertise their media capabilities themselves
properly. This causes the autonegotiation to e.g. never establish a
100baseTX full-duplex link. The solution to this problem is to manually
write the capabilities from the BMSR to the ANAR every time a media
change occurs, even when already in autonegotiation mode.
The NetBSD way of doing this is to set their MIIF_FORCEANEG flag in the
NIC driver. This causes mii_phy_setmedia() to call mii_phy_auto() (which
will set the ANAR according to the BMSR) even when the PHY alread is in
autonegotiation mode. However, while doing the same on FreeBSD (which
involves porting the MIIF_FORCEANEG flag and converting nsphy.c to use
mii_phy_setmedia()) fixes autonegotiation, using mii_phy_setmedia()
causes this driver to no longer work properly in the other modes.
Another drawback of that approach is that this will also force writing
the ANAR on other PHYs whose drivers use mii_phy_setmedia() and which
are used with a NIC whose driver sets MIIF_FORCEANEG (e.g. hme(4) is
known to be used together with 3 different PHYs while only the DP83840A
require this workaround).
So instead of moving to MIIF_FORCEANEG, just call mii_phy_auto() in
nsphy_service() unconditionally when hanging off of a hme(4) and serving
a media change

This is part 1/2 of fixing autonegotiation on hme(4) using DP83840A PHYs.
2004-05-29 18:23:26 +00:00
Marius Strobl
b78791d37e Spelling fix in a comment. 2004-05-29 18:13:44 +00:00
Marius Strobl
50aa106108 Remove double __FBSDID and move the remaining one into a common place after
the license(s) and before the driver comment (the latter only in drivers not
having __FBSDID at that location).
2004-05-29 18:09:10 +00:00
Marius Strobl
c4386506c7 Move __FBSDID out from under a comment. 2004-05-29 17:45:45 +00:00
Marius Strobl
5aa5480919 Spelling fix in a comment. 2004-05-29 16:54:59 +00:00
Andre Oppermann
127d7b2d2d Link state change notification of ethernet media to the routing socket.
o Extend the if_data structure with an ifi_link_state field and
  provide the corresponding defines for the valid states.

o The mii_linkchg() callback updates the ifi_link_state field
  and calls rt_ifmsg() to notify listeners on the routing socket
  in addition to the kqueue KNOTE.

o If vlans are configured on a physical interface notify and update
  all vlan pseudo devices as well with the vlan_link_state() callback.

No objections by:	sam, wpaul, ru, bms
Brucification by:	bde
2004-05-03 13:48:35 +00:00
Andre Oppermann
9a54cbb95d Correct the phy_service() routine case MII_TICK to correctly track
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
2004-05-03 13:01:34 +00:00
Poul-Henning Kamp
135bd3f8a1 Make sure set the media type in the phy, we cannot trust it to have chosen
the type we happen to want.

Bug triggered by net-booting soekris hardware which comes up in 10/hdx mode
by default.
2004-01-17 10:44:39 +00:00
Brooks Davis
9bf40ede4a Replace the if_name and if_unit members of struct ifnet with new members
if_xname, if_dname, and if_dunit. if_xname is the name of the interface
and if_dname/unit are the driver name and instance.

This change paves the way for interface renaming and enhanced pseudo
device creation and configuration symantics.

Approved By:	re (in principle)
Reviewed By:	njl, imp
Tested On:	i386, amd64, sparc64
Obtained From:	NetBSD (if_xname)
2003-10-31 18:32:15 +00:00
Paul Saab
786a9b65a9 Typo when setting wirespeed. || != |
Found by:	jake
2003-09-28 04:16:16 +00:00
Wilko Bulte
59ce78fef1 Add support for SK-9521 V2.0 and 3COM 3C940.
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
2003-09-20 10:53:08 +00:00
Bill Paul
d5a5045921 Clean up dead code. 2003-09-11 08:28:38 +00:00
Bill Paul
9bac70b851 Add a PHY driver to support the built-in gigE PHY in the 8169S/8110S
ethernet chips. This driver is pretty simple, however it contains
special DSP initialization code which is needed in order to get
the chip to negotiate a gigE link. (This special initialization
may not be needed in subsequent chip revs.) Also:

- Fix typo in if_rlreg.h (RL_GMEDIASTAT_1000MPS -> RL_GMEDIASTAT_1000MBPS)

- Deal with shared interrupts in re_intr(): if interface isn't up,
  return.

- Fix another bug in re_gmii_writereg() (properly apply data field mask)

- Allow PHY driver to read the RL_GMEDIASTAT register via the
  re_gmii_readreg() register (this is register needed to determine
  real time link/media status).
2003-09-11 03:53:46 +00:00
Bill Paul
b9f78d2b4a Add a device driver for the Broadcom BCM4401 ethernet controller,
written by Stuart Walsh and Duncan Barclay (with some kibbitzing by
me). I'm checking it in on Stuart's behalf.

The BCM4401 is built into several x86 laptop and desktop systems. For the
moment, I have only enabled it in the x86 kernel config because although
it's a PCI device, I haven't heard of any standalone NICs that use it. If
somebody knows of one, we can easily add it to the other arches.

This driver uses register/structure data gleaned from the Linux
driver released by Broadcom, but does not contain any of the code
from the Linux driver itself. It uses busdma.
2003-09-09 18:17:23 +00:00
Bill Paul
a94100fa9b Take the support for the 8139C+/8169/8169S/8110S chips out of the
rl(4) driver and put it in a new re(4) driver. The re(4) driver shares
the if_rlreg.h file with rl(4) but is a separate module. (Ultimately
I may change this. For now, it's convenient.)

rl(4) has been modified so that it will never attach to an 8139C+
chip, leaving it to re(4) instead. Only re(4) has the PCI IDs to
match the 8169/8169S/8110S gigE chips. if_re.c contains the same
basic code that was originally bolted onto if_rl.c, with the
following updates:

- Added support for jumbo frames. Currently, there seems to be
  a limit of approximately 6200 bytes for jumbo frames on transmit.
  (This was determined via experimentation.) The 8169S/8110S chips
  apparently are limited to 7.5K frames on transmit. This may require
  some more work, though the framework to handle jumbo frames on RX
  is in place: the re_rxeof() routine will gather up frames than span
  multiple 2K clusters into a single mbuf list.

- Fixed bug in re_txeof(): if we reap some of the TX buffers,
  but there are still some pending, re-arm the timer before exiting
  re_txeof() so that another timeout interrupt will be generated, just
  in case re_start() doesn't do it for us.

- Handle the 'link state changed' interrupt

- Fix a detach bug. If re(4) is loaded as a module, and you do
  tcpdump -i re0, then you do 'kldunload if_re,' the system will
  panic after a few seconds. This happens because ether_ifdetach()
  ends up calling the BPF detach code, which notices the interface
  is in promiscuous mode and tries to switch promisc mode off while
  detaching the BPF listner. This ultimately results in a call
  to re_ioctl() (due to SIOCSIFFLAGS), which in turn calls re_init()
  to handle the IFF_PROMISC flag change. Unfortunately, calling re_init()
  here turns the chip back on and restarts the 1-second timeout loop
  that drives re_tick(). By the time the timeout fires, if_re.ko
  has been unloaded, which results in a call to invalid code and
  blows up the system.

  To fix this, I cleared the IFF_UP flag before calling ether_ifdetach(),
  which stops the ioctl routine from trying to reset the chip.

- Modified comments in re_rxeof() relating to the difference in
  RX descriptor status bit layout between the 8139C+ and the gigE
  chips. The layout is different because the frame length field
  was expanded from 12 bits to 13, and they got rid of one of the
  status bits to make room.

- Add diagnostic code (re_diag()) to test for the case where a user
  has installed a broken 32-bit 8169 PCI NIC in a 64-bit slot. Some
  NICs have the REQ64# and ACK64# lines connected even though the
  board is 32-bit only (in this case, they should be pulled high).
  This fools the chip into doing 64-bit DMA transfers even though
  there is no 64-bit data path. To detect this, re_diag() puts the
  chip into digital loopback mode and sets the receiver to promiscuous
  mode, then initiates a single 64-byte packet transmission. The
  frame is echoed back to the host, and if the frame contents are
  intact, we know DMA is working correctly, otherwise we complain
  loudly on the console and abort the device attach. (At the moment,
  I don't know of any way to work around the problem other than
  physically modifying the board, so until/unless I can think of a
  software workaround, this will have do to.)

- Created re(4) man page

- Modified rlphy.c to allow re(4) to attach as well as rl(4).

Note that this code works for the sample 8169/Marvell 88E1000 NIC
that I have, but probably won't work for the 8169S/8110S chips.
RealTek has sent me some sample NICs, but they haven't arrived yet.
I will probably need to add an rlgphy driver to handle the on-board
PHY in the 8169S/8110S (it needs special DSP initialization).
2003-09-08 02:11:25 +00:00
David E. O'Brien
aad970f1fe Use __FBSDID().
Also some minor style cleanups.
2003-08-24 17:55:58 +00:00
Warner Losh
38d8c9940b Prefer new location of pci include files (which have only been in the
tree for two or more years now), except in a few places where there's
code to be compatible with older versions of FreeBSD.
2003-08-22 06:42:59 +00:00
Doug Ambrisko
6d2a9bd669 On Dell boxes such as the PE2650 we need to disable 3 led mode for the
link LED to work.

Reviewed by:	wpaul
Obtained from:	Linux driver
2003-08-20 04:06:00 +00:00
Bill Paul
5d99c6417d Add support for the Broadcom BCM5901 and BCM5901 rev A2 chips.
These are 10/100 only NICs found on the IBM Thinkpad R40E and
G40. These seem to be based on the BCM5705 MAC but with a PHY
that doesn't support 1000Mbps modes.

Submitted by:	Igor Sviridov <sia@nest.org>
2003-08-12 05:18:51 +00:00
Bill Paul
0434d1b8d2 Add support for the BCM5705 and its ilk. Changes:
- 5705 doesn't support jumbo frames
- Statistics must be read from registers
- RX return ring must be capped at 512 entries
- Omit initialization of certain device blocks
- Acknowledge link change interrupts by setting the 'link changed'
  bit in the status register (used to have no effect)
- Remember to toggle the MI completion bit too
- Set the mbuf low watermark differently (on-chip memory buffers,
  not BSD mbufs)
- Don't enable Ethernet@WireSpeed feature for certain 5705 chip revs
- Add additional PCI IDs for 5705 and 5782 parts
- Add a forgotten 5704 PCI ID

Most changes ripped kicking and screaming from the Broadcom linux driver.
Thanks to Paul Saab for sanity testing. (My lack of sanity has been
confirmed.)
2003-07-16 00:09:56 +00:00
Paul Saab
fe5c322931 Fix bge at 10Mbit. The defines for 10-Half and 10-Full were swapped.
Shamed into fixing by:	John Cagle <john.cagle@hp.com>
2003-06-17 15:02:28 +00:00
Poul-Henning Kamp
19ca58475e Remove unnecessary breaks.
Remove unused variables.
Add XXX comment where a break may be missing. [lxtphy.c]

Found by:       FlexeLint
2003-05-31 19:48:33 +00:00
Paul Saab
20430a6b04 Something I missed in my tree.
If the media changes, poke the DSP on the 5401/5411 Broadcom PHY's.

Obtained from:	NetBSD
2003-05-04 02:03:20 +00:00
Paul Saab
37ceeb4d9f - Move bge_phy_hack into the phy code and implement the various DSP
patch workarounds for each phy revision.
  Obtained from: NetBSD & Broadcom Linux driver

- Disable AUTOPOLL when accessing the PHY as it may cause PCI errors.
  Obtained from: NetBSD

- Check the UPDATED bit in the status block so the driver knows
  that the status block as indeed changed since the last access.
  Broadcom documentation states drivers should unset the UPDATED/CHANGED
  bits after reading them.

- When changing media types, first loop the phy then set the media.
  Broadcom documentation and Linux drivers do this and I observed
  much better handling of link after this change.

- Broadcom documentation states that for 1000BaseT operation,
  autonegotiation must be enabled.  Fix hard coding of media so that
  the driver only advertises 1000BaseT as the supported media type
  and enable autonegotition.

- Only set Master/Slave on the 5701.
  Obtained from Broadcom Linux driver.
2003-05-03 19:06:50 +00:00
Shunsuke Akiyama
11e04b0528 Add RealTek RTL8150 USB to fast Ethernet controller driver.
This driver now supports the Melco LUA-KTX and the GREEN HOUSE
GH-USB100B.

Reviewed by:	imp
MFC after:	2 weeks
2003-05-03 10:16:56 +00:00
Paul Saab
6ac6d2c895 Add untested support for the Broadcom 5704.
Obtained from:	NetBSD
2003-05-02 19:53:40 +00:00
David E. O'Brien
8368cf8f75 Use __FBSDID rather than rcsid[]. 2003-04-03 21:36:33 +00:00
Peter Wemm
bbf9145de3 Remove unused variable and code. 2003-02-19 00:32:01 +00:00
David E. O'Brien
2d3ce7133a Remove miidevs.h and generate it from miidevs at compile time.
The devlist2h.awk tool to do this has been repocopied to sys/tools/.
2003-01-19 02:59:34 +00:00
David E. O'Brien
44ea4fc8d6 Regenerate 2003-01-13 03:58:41 +00:00
David E. O'Brien
f9b7742405 Partial support for the nVidia nForce2 chipset's on-board Broadcom/Altima PHY
and 3com MAC.  Specifications for the Altima PHY are available at:
   http://www.altimacom.com/products/ac101L.html

Submitted by:	Mikko S. Hyvarinen <morphy@morphy.iki.fi>
2003-01-12 21:03:38 +00:00
Semen Ustimenko
07971c4102 Remove unnecessary <sys/malloc.h> include.
Submitted by:	marius@alchemy.franken.de
MFC after:	1 week
2002-10-29 00:20:47 +00:00
Alfred Perlstein
9c1c2e9924 Put function return types on a line by themselves.
Cleanup my earlier de-__P sweep and remove whitespace between function
names and paramters.
2002-10-14 22:31:52 +00:00
Poul-Henning Kamp
37c841831f Be consistent about "static" functions: if the function is marked
static in its prototype, mark it static at the definition too.

Inspired by:    FlexeLint warning #512
2002-09-28 17:15:38 +00:00
John Polstra
b1265c1a98 Add support for the BCM5703x chips. I do not have one of these
cards to test; however the submitter reports that this patch works
with the on-board interface on the IBM x235 server.

Submitted by:	Jung-uk Kim <jkim@niksun.com>
MFC after:	1 month
2002-09-08 19:12:02 +00:00
Doug Ambrisko
74495bcdab Revert change to detect multiply PHYs in mii code. There might be cases
when this is needed.  Work around bogus second PHY in the DFE-580 card
via a change in the if_ste.c driver.

Suggested by:	jdp
Reviewed by:	jdp
MFC after:	3 days
2002-08-16 23:19:16 +00:00
Doug Ambrisko
130be1f120 Only attach one PHY device to a controller. NetBSD has similar code.
The D-Link DFE-580 card will otherwise show 2 miibuses for each controller
and therefore 2 ukphy's.

Sponsored by:	Vernier Networks
MFC after:	1 week
2002-08-07 22:18:33 +00:00
Benno Rice
2e2ec02fd6 regenerate 2002-07-05 11:07:42 +00:00
Benno Rice
d82bc4fba8 Add a driver for the Broadcom BCM52xx "mini-theta" PHY. This includes the
internal PHY on the 3COM 3C905B and 3C905C parts, however I've rigged it so
that xlphy (aka exphy) takes precedence for the time being.

If people try this with their xl cards and decide that it's a better choice,
we can switch this later.

This is the PHY used in various iMacs and possibly other GMAC-equipped
Macintoshes with 10/100 PHYs (the ones with 10/100/1000 appear to use brgphy).

Obtained from:	NetBSD
2002-07-05 11:07:24 +00:00
Benno Rice
daec3648eb Use 3C905C instead of 3c905Cphy as the identifier for the Broadcom PHY used
in the 3C905C.  This is mainly cosmetic.

I'm doing this mainly so we share the same identifier as NetBSD.
2002-07-05 11:02:17 +00:00
Poul-Henning Kamp
37c0fba7c4 Increase gigE negotiation timeout to 17 seconds.
10 seconds is not enough to negotiate a gigE link with a cisco switch which
holds carrier off for several seconds between tries.
2002-05-04 11:08:49 +00:00
Poul-Henning Kamp
fd94424c78 Clean up mii/phy drivers: Remove the MIIF_DOINGAUTO which doesn't really
do anything at the end of the day except bloat the drivers which has
copy&pasted it.
2002-05-04 11:00:30 +00:00
Semen Ustimenko
4592db4635 MII_TICK handlers need not restart aneg on these PHYs, they behave pretty
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
2002-05-01 19:15:54 +00:00
Poul-Henning Kamp
875525d517 Introduce NetBSD's mii_phy_match() API and use it in the nsgphy to
get a description printed.
2002-04-29 14:09:10 +00:00
Poul-Henning Kamp
e5fbad8bca Convert exphy and ukphy over to the new code.
exphy is done flying blind, ukphy is tested on one card.
2002-04-29 13:35:31 +00:00
Poul-Henning Kamp
279fe8d156 Make one generic mii_phy_detach() to replace 19 slightly different ones.
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.
2002-04-29 13:07:38 +00:00
Poul-Henning Kamp
78c8c3db4b Move a lot closer to NetBSDs MII support for GigE.
Move fxp and nge drivers over to use the new stuff.
2002-04-29 11:57:30 +00:00
Poul-Henning Kamp
b7dee1db97 Moving closer to being able to use NetBSD's generic mii_set_media()
function.
2002-04-29 07:18:26 +00:00
Poul-Henning Kamp
a295ccc9f0 Edging ever closer to NetBSD... 2002-04-29 06:48:20 +00:00
Poul-Henning Kamp
45521525a7 Move us yet closer to IFM_* definitions in NetBSD. 2002-04-29 05:32:44 +00:00
Poul-Henning Kamp
b418ad5c2e Follow NetBSD and s/IFM_1000_TX/IFM_1000_T/ 2002-04-28 20:34:20 +00:00
Poul-Henning Kamp
07dd938303 Don't pass three args when one will do just fine, and even prevent
mistakes like the one brgphy.c (now corrected).
2002-04-28 19:25:07 +00:00
Poul-Henning Kamp
83549c664b Improve an API by about 4 lines per driver. 2002-04-28 19:01:32 +00:00
Poul-Henning Kamp
3aae18bde8 Use generic MII #defines instead of private ones when the registers
are IEEE defined.

Object file comes out the same.
2002-04-28 18:47:29 +00:00
Poul-Henning Kamp
1aad4b2a52 Merge in rev 1.9 from NetBSD. 2002-04-28 18:43:30 +00:00
Stephen McKay
e3c5a44915 Work around an Intel 21143 chip bug.
Rev 1.56 of if_dc.c removed calls to mii_pollstat() from the dc_tick()
routine.  dc_tick() is called regularly to detect link up and link down
status, especially when autonegotiating.

The expectation was that mii_tick() (which is still called from dc_tick())
would update status information automatically in all cases where it would
be sensible to do so.

Unfortunately, with authentic 21143 chips this is not the case, and
the driver never successfully autonegotiates.  This is because (despite
what it says in the 21143 manual) the chip always claims that link is not
present while the autonegotiation enable bit is set.  Autonegotation takes
place and succeeds, but the driver tests the link bits before it switches
off the autonegotiation enable bit, and success is not recognised.

The simplest solution is to call dcphy_status() more often for MII_TICK
calls by dropping out of the switch statement instead of exiting when
we are autonegotiating and link appears to not be present.  When
autonegotiation succeeds, dcphy_status() will note the speed and fdx/hdx
state and turn off the autonegotiation enable bit.  The next call to
dcphy_status() will notice that link is present, and the dc driver code
will be notified.

Macronix chips also use this code, but implement link detection as
described in the manual, and hence don't need this patch.  However, tests
on a Macronix 98715AEC-C show that it does not adversely affect them.

This could be done better but is the minimal effective change, and most
closely mimics what was happening prior to rev 1.56 of if_dc.c.  (Actually
I also deleted a small amount of unnecessary code while I was in the area.)

Reviewed by:	wpaul
2002-04-18 14:40:20 +00:00
Bill Paul
85ee6a5781 Regenerate. 2002-04-07 20:56:19 +00:00
Bill Paul
a72c060fb0 Teach the rlphy driver how to do parallel link detection. If the link partner
doesn't support NWAY, the RealTek PHY (both the integrated ones on 8139
chips and the RTL8201L 10/100 PHY) will not report the link speed via
the ANLPAR or BMSR registers. For the 8201L, we need to look in magic
vendor-specific PHY register 0x19. For the 8139 MAC+PHY combo, we have
to be able to test the RL_MEDIASTAT register.

The changes to rlphy.c are based largely on the patch from PR 30836,
however I tried to eliminate some magic numbers by creating an entry
for the 8201 PHY in miidevs.

Also updated if_rl.c to allow the rlphy driver to read the RL_MEDIASTAT
register via the rl_miibus_readreg() routine.
2002-04-07 20:55:50 +00:00
Bill Paul
6577eb9103 regenerate 2002-03-22 06:39:13 +00:00
Bill Paul
15f962ed42 Teach the brgphy driver about the BCM5701's internal copper PHY. 2002-03-22 06:38:52 +00:00
Alfred Perlstein
e51a25f850 Remove __P. 2002-03-20 02:08:01 +00:00
Daniel O'Callaghan
3c3c45471c Remove problematic PHY_WRITE so that autoneg to 10 Mbps
actually works.

Submitted by: Dennis <TD790@aol.com>
Reviewed by:	Bill Paul <wpaul@freebsd.org>
MFC after:	7 days
2002-02-27 02:11:34 +00:00
Archie Cobbs
4fc53c229d Fix reversed definitions for the bits that select half vs. full duplex.
Submitted by:	Darren Croke <djc@packetdesign.com>
2002-01-10 18:06:41 +00:00
Matt Jacob
5aa8fe17f8 Fix declaration disagreement. 2001-10-11 22:02:14 +00:00
Matt Jacob
79a79ad9b8 Note the 'common knowledge' assumption that each NIC's softc starts
with an ifnet structure (so device_get_softc will get one).

If memory allocation fails in mii_phy_probe, don't just march ahead into
a panic- return ENOMEM.

MFC after:	1 week
2001-10-01 22:57:57 +00:00
Jonathan Lemon
d9730b8b53 Cleanup pass for mii drivers.
. 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.
2001-09-29 19:18:52 +00:00
Jonathan Lemon
105cb0c6a9 Change the order that we print the media options during device probe to
match the other mii drivers.
2001-09-29 18:59:17 +00:00
Jonathan Lemon
babc535e85 Add field for last active status, as well as function prototypes. 2001-09-29 18:48:52 +00:00
Jonathan Lemon
eb3a764866 Add new device method miibus_linkchg, along with a service routine. 2001-09-29 18:40:06 +00:00
Bill Paul
245dd946e3 Fix typo: BGGPHY -> BRGPHY in one of the #defines I added the other day. 2001-09-27 17:32:49 +00:00
Bill Paul
9aa35f2391 Add some definitions for the DSP programming registers in the BCM5400
and BCM5401 PHYs.
2001-09-25 16:41:56 +00:00
Bill Paul
1d083681bc Tweak the autoneg kickoff code to that it more closely resembles the
method uses in the nsgphy driver.
2001-09-18 00:31:19 +00:00
Bill Paul
516f7ab7ac Regenerate. 2001-09-04 22:00:49 +00:00
Bill Paul
e1968a0d2f Add support for the BCM5401 and BCM5411 10/100/1000Mbps copper gigE PHYs.
This basically updates the brgphy driver to support 10/100 modes in
addition to 1000Mbps modes.
2001-09-04 22:00:33 +00:00
Kris Kennaway
a081aa7d72 Quiet a variable format-string warning.
MFC after:    1 week
2001-07-19 02:16:24 +00:00
Jonathan Lemon
e46e7fa2c2 Only touch the PCR register in order to set bits for the fxp driver.
The 3C509-TX card apparently had a slightly different version of the
chip, and has problems when this register is set.  The problem does
not appear on the 3C509{BC} cards, but since only the fxp driver needs
specific bits set, conditionalize on that.
2001-06-02 19:51:02 +00:00
Bill Paul
95f27dc639 Regenerate 2001-05-23 22:11:25 +00:00
Bill Paul
134c58d3c0 Tweak the xmphy driver a little bit based on something I learned about
the built-in 1000baseX interface in the Level 1 LXT1001 chip. The Level 1
PHY comes up with the isolate bit in the control register set by default,
but it also has the autonegotiate bit set. When you tell the xmphy driver
to select IFM_AUTO mode, it sees that the autoneg bit is already on, and
thus doesn't bother updating the control register. However this means that
the isolate bit is never turned off (unless you manually select 1000baseSX
full or half duplex mode, which does result in the control register being
modified and the ISO bit being turned off).

This subtle and unusual behavioral difference stopped me from being able
to receive packets on the SMC9462TX card for several days, since isolating
the PHY disconnects it from the MAC's data interface. The fix is to omit
the 'is the autoneg big set?' test, since it doesn't really provide much
of an optimization anyway.

This commit also updates the xmphy driver to support the Jato/Level 1
internal PHY. (I'm not sure how Jato Technologies is related to Level 1:
all I know is the OUI from the PHY ID registers maps to Jato in the OUI
database.) This will be used once I add the if_lge driver to support
the LXT10010 chip.
2001-05-23 22:10:55 +00:00
Jonathan Lemon
fae4825cdf Regenerate. 2001-05-11 20:41:20 +00:00
Jonathan Lemon
dafdd7777b Correctly recognize the i82562{EM} PHYs.
Obtained from: OpenBSD
2001-05-11 20:34:38 +00:00
Bill Paul
b680c0ae8b Regenerate 2001-05-11 20:27:39 +00:00
Bill Paul
ce4946daa5 Add support for gigabit ethernet cards based on the NatSemi DP83820
and DP83821 gigabit ethernet MAC chips and the NatSemi DP83861 10/100/1000
copper PHY. There are a whole bunch of very low cost cards available with
this chipset selling for $150USD or less. This includes the SMC9462TX,
D-Link DGE-500T, Asante GigaNIX 1000TA and 1000TPC, and a couple cards
from Addtron.

This chip supports TCP/IP checksum offload, VLAN tagging/insertion.
2048-bit multicast filter, jumbograms and has 8K TX and 32K RX FIFOs.
I have not done serious performance testing with this driver. I know
it works, and I want it under CVS control so I can keep tabs on it.
Note that there's no serious mutex stuff in here yet either: I need
to talk more with jhb to figure out the right way to do this. That
said, I don't think there will be any problems.

This driver should also work on the alpha. It's not turned on in
GENERIC.
2001-05-11 19:56:39 +00:00
Matt Jacob
2a4339f78f Add Marvell PHY support for 10/100/1000 LIVENGOOD_CU Intel NIC.
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'.
2001-04-09 21:29:44 +00:00
John Baldwin
f34fa851e0 Catch up to header include changes:
- <sys/mutex.h> now requires <sys/systm.h>
- <sys/mutex.h> and <sys/sx.h> now require <sys/lock.h>
2001-03-28 09:17:56 +00:00
Jonathan Lemon
e3768ebb1b Back out previous commit until I figure out a way to do it properly.
We really want to be able to say "auto NWAY", "limited NWAY", and
"no NWAY".  Unfortunately, this does not appear to be possible with
the current mediaopt structure.
2001-03-28 07:01:45 +00:00
Jonathan Lemon
469961321f Really fix NWAY negotiation for the 82553 PHY. Locking down the
media interface selection should not imply disabling NWAY negotiaton
as well.

Problem pointed out by: peter
2001-03-17 02:50:20 +00:00
Jonathan Lemon
32de04d557 Enable some undocumented bits in the DP83840 PHY, which is needed
when using it with the Intel fxp driver.

Tested by: peter, Ollivier Robert <roberto@eurocontrol.fr>,
	   Peter Schultz <pete@jocose.org>
2001-03-16 14:17:02 +00:00
Jonathan Lemon
83a2d3997e Add drivers for Intel 82553 and 82555 PHYs. 2001-03-12 02:41:57 +00:00
Jonathan Lemon
c49993ab73 Regenerate. 2001-03-12 02:27:58 +00:00
Jonathan Lemon
5a3f7e2c9b Add some definitions for Intel 82553 PHYs 2001-03-12 02:27:10 +00:00
John Baldwin
1798caf635 Add includes of sys/malloc.h so this actually compiles.
Pointy-hat to:	asmodai
2001-02-09 00:16:41 +00:00
Jeroen Ruigrok van der Werven
4b91c22b12 Fix memoryleaks with device_get_children().
Approved by:	wpaul
2001-02-08 21:53:05 +00:00
Semen Ustimenko
e8288d7f9c Oops... I knew i shouldn't use arrows in vi. Fix a typo causing errors in
compilation.
2001-02-07 22:34:15 +00:00
Semen Ustimenko
9526a692c6 Add QS6612, AC101 and LXT970 personal drivers and register definitions.
Obtained from:	NetBSD/OpenBSD
2001-02-07 19:57:40 +00:00
Poul-Henning Kamp
37d4006626 Another round of the <sys/queue.h> FOREACH transmogriffer.
Created with:   sed(1)
Reviewed by:    md5(1)
2001-02-04 16:08:18 +00:00
Bill Paul
34da0ef197 Grrrrr. That last commit was supposed to be to the head, not to -stable
(even though I want the fixes in -stable anyway). I'm sure I'm going
to get flamed now for committing to -stable and -current too quickly.
*sigh*
2000-12-12 19:31:14 +00:00
John Baldwin
35e0e5b311 Catch up to moving headers:
- machine/ipl.h -> sys/ipl.h
- machine/mutex.h -> sys/mutex.h
2000-10-20 07:58:15 +00:00
Jonathan Chen
feb78939ee NEWCARD/Cardbus -
This commit adds support for Xircom X3201 based cardbus cards.
Support for the TDK 78Q2120 MII is also added.
IBM Etherjet, Intel and Xircom cards uses these chips.

Note that as a result of this commit, some Intel/DEC 21143 based cardbus
cards will also attach, but not get link.  That is being looked at.
2000-10-19 08:34:32 +00:00
Poul-Henning Kamp
db7e3af111 Remove unneeded #include <machine/clock.h> 2000-10-15 14:19:01 +00:00
Bill Paul
d308faacc2 Add #include <machine/mutex.h> since these files need it and don't
include anything else that includes mutex.h. Needed to resolve struct mtx
from struct dc_softc.
2000-10-13 19:15:50 +00:00
Warner Losh
da8e360acf sync to last commit 2000-10-12 00:16:19 +00:00
Warner Losh
0ac8fcedf1 Add mii entry for tdk phy found on some cardbus cards. 2000-10-12 00:15:10 +00:00
Bill Paul
5c1cfac46e Add support for parsing the media blocks from the SROM on 21143
adapters. This is necessary in order to make this driver work with
the built-in ethernet on the alpha Miata machines. These systems
have a 21143-PC chip on-board and optional daughtercards with either
a 10/100 MII transceiver or a 10baseT/10base2 transceiver. In both
cases, you need to twiddle the GPIO bits on the controller in order
to turn the transceivers on, and you have to read the media info
from the SROM in order to find out what bits to twiddle.
2000-10-05 17:36:14 +00:00
Bill Paul
b54acb744c Add a homePNA PHY driver. This is really only a stub: MII-based homePNA
PHYs tend to look like 10mbps PHYs with no autonegotiation. This allows
us to display the proper media type and link status however.
2000-09-20 17:04:30 +00:00
Bill Paul
337771f919 regenerate 2000-09-20 17:02:32 +00:00
Bill Paul
9d960ff86d Add the ID for the built-in homePNA PHY in the AMD 79C798 controller. 2000-09-20 17:02:16 +00:00
Semen Ustimenko
95a4de30e8 Added Altima Communications OUI and their AC101 10/100
media interface to the list of known chips.

miidevs.h regenerated also.
2000-06-21 19:26:01 +00:00
Bill Paul
b6a1416d3a Don't bother checking the link state in dcphy_status() if the interface
isn't up.
2000-06-05 19:37:15 +00:00
Bill Paul
318b02fdb9 Rework the support for the internal autonegotiation on the 21143 and
workalike chips (Macronix 98713A/98715 and PNIC II). Timing is somewhat
critical: you need to bring the link as soon as possible after NWAY
is done, and the old one second polling interval was too long. Now
we poll every 10th of a second until NWAY completes (at which point
we return to the 1 second interval again to keep an eye on the link
state).

I tested all the other cards I had on hand to make sure I didn't bust
any of them and they seem to work (including the MII-based 21143 card).
This should fix some autoneg problems with DE500-BA cards and the
built-in 10/100 ethernet on some alpha systems.

(Now before anyone asks why I never noticed this before, the old code
worked just find with the Intel swich I used for testing back in NY.
Apparently not all switches are as picky about the timing.)
2000-05-31 05:40:53 +00:00
Jake Burkholder
e39756439c Back out the previous change to the queue(3) interface.
It was not discussed and should probably not happen.

Requested by:		msmith and others
2000-05-26 02:09:24 +00:00
Jake Burkholder
740a1973a6 Change the way that the queue(3) structures are declared; don't assume that
the type argument to *_HEAD and *_ENTRY is a struct.

Suggested by:	phk
Reviewed by:	phk
Approved by:	mdodd
2000-05-23 20:41:01 +00:00
Poul-Henning Kamp
eb95c536ad Remove unneeded #include <sys/kernel.h> 2000-04-29 15:36:14 +00:00
Peter Wemm
9ad6460a9e Provide a tag so that miibus consumers can depend on the module,
regardless of whether it is in a seperate .ko or the kernel (or in a .ko
bundled with several other things in one file for packaging).
2000-04-29 13:38:26 +00:00
Bill Paul
c0d7d4d45b Add PHY drivers for the XMAC II's internal PHY and the Broadcom BCM5400
1000baseTX PHY. These will be used by the SysKonnect gigabit ethernet
driver shortly.
2000-04-22 01:58:18 +00:00
Bill Paul
c863ff7b04 Regenerate 2000-04-22 01:55:38 +00:00
Bill Paul
7046508cb8 Add entries for the XMAC II's internal PHY and the Broadcom BCM5400
1000baseTx PHY.
2000-04-22 01:54:55 +00:00
Poul-Henning Kamp
3389ae9350 Remove ~25 unneeded #include <sys/conf.h>
Remove ~60 unneeded #include <sys/malloc.h>
2000-04-19 14:58:28 +00:00
Bill Paul
9ed5b61bdd Change && to || in probe routine so that the mlphy driver doesn't
incorrectly attach itself to ThunderLAN adapters which happen to have
a PHY who's model number happens out to be 0.

Problem reported by: Peter L. Thomas <Pete@painless-computing.com>
2000-04-14 15:31:48 +00:00
Semen Ustimenko
b72407814b Added code to handle QS6612 PHY as standard NS PHY
for support of tx driver.
2000-04-11 18:39:00 +00:00
Doug Rabson
f7b7769172 * Factor out the object system from new-bus so that it can be used by
non-device code.
* Re-implement the method dispatch to improve efficiency. The new system
  takes about 40ns for a method dispatch on a 300Mhz PII which is only
  10ns slower than a direct function call on the same hardware.

This changes the new-bus ABI slightly so make sure you re-compile any
driver modules which you use.
2000-04-08 14:17:18 +00:00
Peter Wemm
664a31e496 Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"
is an application space macro and the applications are supposed to be free
to use it as they please (but cannot).  This is consistant with the other
BSD's who made this change quite some time ago.  More commits to come.
1999-12-29 04:46:21 +00:00
Bill Paul
91cc2adb2e Fix some problems reported by Mike Pritchard:
- Add a flag DC_TX_INTR_ALWAYS which causes the transmit code to
  request a TX done interrupt for every packet. The PNIC seems to need
  this to insure that the sent TX buffers get reaped in a timely fashion.

- Try to unreset the SIA as soon as possible after resetting the whole
  chip.

- Change dcphy to support either 10/100 or 10Mbps only NICs. The
  built-in 21143 ethernet in Compaq Presario machines is 10Mbps only
  and it doesn't work right if we try to advertise 100Mbps modes during
  autoneg. When restricted to only 10mbps modes, it works fine.

  Note that for now, I detect this condition by checking the PCI
  subsystem ID on this NIC (which has a Compaq vendor/device ID).
  Yes, I know that's what the SROM is supposed to be for. I'm deliberately
  ignoring the SROM wherever possible. Sue me.

The latter two fixes allow if_dc to work correctly with the built-in
ethernet on certain Compaq Presario boxes. There are liable to be quite
a few people using these as their home systems who might want to try
FreeBSD; may as well be nice to them.

Now if anybody out there has an Alpha miata with 10Mbps ethernet and
can show me the output from pciconf -l on their system, I'd be grateful.
1999-12-13 21:45:13 +00:00
Bill Paul
96f2e892a7 Add the if_dc driver and remove all of the al, ax, dm, pn and mx drivers
which it replaces. The new driver supports all of the chips supported
by the ones it replaces, as well as many DEC/Intel 21143 10/100 cards.

This also completes my quest to convert things to miibus and add
Alpha support.
1999-12-04 17:41:31 +00:00
Matthew N. Dodd
fe0d408987 Remove the 'ivars' arguement to device_add_child() and
device_add_child_ordered().  'ivars' may now be set using the
device_set_ivars() function.

This makes it easier for us to change how arbitrary data structures are
associated with a device_t.  Eventually we won't be modifying device_t
to add additional pointers for ivars, softc data etc.

Despite my best efforts I've probably forgotten something so let me know
if this breaks anything.  I've been running with this change for months
and its been quite involved actually isolating all the changes from
the rest of the local changes in my tree.

Reviewed by:	peter, dfr
1999-12-03 08:41:24 +00:00
Bill Paul
8562ad200e Do some more work on the mxphy pseudo-driver to make it better at media
detection and remove the long delays that I had used previously. Everything
should be handled by timeouts now.
1999-11-01 17:10:26 +00:00
Bill Paul
ed8c6514c4 Convert the mx driver to miibus.
In order to make this work, I created a pseudo-PHY driver to deal with
Macronix chips that use the built-in NWAY support and symbol mode port.
This is actually all of them, with the exception of the original MX98713
which presents its NWAY support via the MII serial interface.

The mxphy driver actually manipulates the controller registers directly
rather than using the miibus_readreg()/miibus_writereg() bus interface
since there are no MII registers to read. The mx driver itself pretends
that the NWAY interface is a PHY locayed at MII address 31 for the sole
purpose of allowing the mxphy_probe() routine to know when it needs to
attach to a host controller.
1999-10-16 05:24:13 +00:00
Bill Paul
2d8fad26b3 Allow the AMD PHY driver to support the DM9101 PHY. The DM9101 and the
AMD AM79c873 have identical registers. I'm not sure why; one is probably
a clone of the other.
1999-09-19 21:56:08 +00:00
Bill Paul
bbf7ca2249 Add a driver for the AMD AM79c873 10/100 PHY. By some strange coincidence,
this PHY and the Davicom DM9101 have exactly the same register definitions.
One of them is probably a clone of the other. I'm not sure which.

This is needed for the Davicom DM9102 10/100 PCI ethernet driver which
will be committed shortly.
1999-09-06 05:27:55 +00:00
Peter Wemm
3ca1647688 $Id$ -> $FreeBSD$ 1999-09-05 15:21:05 +00:00
Bill Paul
1ff33426c8 Re-arrange things in the attach routines of the 3Com and RealTek PHY
drivers so that we don't clobber things or leave them uninitialized
if we abort due a failure.

Submitted by:	Luoqi Chen
1999-09-01 17:07:27 +00:00
Bill Paul
a4f02d20ed Add a driver for the internal PHY in the RealTek 8139. 1999-08-31 14:43:30 +00:00
Bill Paul
9052a8fa41 Regenerate miidevs.h. 1999-08-29 15:44:07 +00:00
Bill Paul
24a7e3d3de The ASIC on the 3c905C appears to be manufactured by Broadcom (previous
ones were made by Lucent). The Broadcom chip also appears to use an
internal PHY made by Broadcom which uses the Broadcom OUI. This is different
from previous ASICs which always returned 0 in the PHY ID registers.
To account for this, I added the necessary ID values for the Broadcom
PHY so that it can be detected and attached using the 3Com PHY driver
instead of defaulting to the generic one.
1999-08-29 15:42:04 +00:00