Commit Graph

109 Commits

Author SHA1 Message Date
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