Commit Graph

179 Commits

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