summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorcegger <cegger@NetBSD.org>2009-01-09 21:56:35 +0000
committercegger <cegger@NetBSD.org>2009-01-09 21:56:35 +0000
commitf7112a92d117c7c5571003f61ff39e8626e7af70 (patch)
treea6a7bd0bae8eeb15da3b8446d64dcaccfcd588e5 /sys/dev
parentdf68862dbf6be274286920502140efccdc5ec1ff (diff)
add support for RTL8211C(L) phy.
From FreeBSD.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/mii/rgephy.c21
-rw-r--r--sys/dev/mii/rgephyreg.h5
2 files changed, 20 insertions, 6 deletions
diff --git a/sys/dev/mii/rgephy.c b/sys/dev/mii/rgephy.c
index d6297c81f7a..6c77032a833 100644
--- a/sys/dev/mii/rgephy.c
+++ b/sys/dev/mii/rgephy.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rgephy.c,v 1.22 2008/11/17 03:04:27 dyoung Exp $ */
+/* $NetBSD: rgephy.c,v 1.23 2009/01/09 21:56:35 cegger Exp $ */
/*
* Copyright (c) 2003
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rgephy.c,v 1.22 2008/11/17 03:04:27 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rgephy.c,v 1.23 2009/01/09 21:56:35 cegger Exp $");
/*
@@ -483,8 +483,13 @@ rgephy_loop(struct mii_softc *sc)
static void
rgephy_load_dspcode(struct mii_softc *sc)
{
+ struct rgephy_softc *rsc;
int val;
+ rsc = (struct rgephy_softc *)sc;
+ if (rsc->mii_revision >= 2)
+ return;
+
#if 1
PHY_WRITE(sc, 31, 0x0001);
PHY_WRITE(sc, 21, 0x1000);
@@ -578,14 +583,22 @@ static void
rgephy_reset(struct mii_softc *sc)
{
struct rgephy_softc *rsc;
+ uint16_t ssr;
mii_phy_reset(sc);
DELAY(1000);
rsc = (struct rgephy_softc *)sc;
- if (rsc->mii_revision < 2)
+ if (rsc->mii_revision < 2) {
rgephy_load_dspcode(sc);
- else {
+ } else if (rsc->mii_revision == 3) {
+ /* RTL8211C(L) */
+ ssr = PHY_READ(sc, RGEPHY_MII_SSR);
+ if ((ssr & RGEPHY_SSR_ALDPS) != 0) {
+ ssr &= ~RGEPHY_SSR_ALDPS;
+ PHY_WRITE(sc, RGEPHY_MII_SSR, ssr);
+ }
+ } else {
PHY_WRITE(sc, 0x1F, 0x0001);
PHY_WRITE(sc, 0x09, 0x273a);
PHY_WRITE(sc, 0x0e, 0x7bfb);
diff --git a/sys/dev/mii/rgephyreg.h b/sys/dev/mii/rgephyreg.h
index a115798517f..28ff6c8e9d9 100644
--- a/sys/dev/mii/rgephyreg.h
+++ b/sys/dev/mii/rgephyreg.h
@@ -1,4 +1,4 @@
-/* $NetBSD: rgephyreg.h,v 1.4 2008/12/03 13:55:20 tsutsui Exp $ */
+/* $NetBSD: rgephyreg.h,v 1.5 2009/01/09 21:56:35 cegger Exp $ */
/*
* Copyright (c) 2003
@@ -139,7 +139,7 @@
#define RGEPHY_EXTSTS_T_FD_CAP 0x2000 /* 1000base-T FD capable */
#define RGEPHY_EXTSTS_T_HD_CAP 0x1000 /* 1000base-T HD capable */
-/* RTL8211B(L) */
+/* RTL8211B(L)/RTL8211C(L) */
#define RGEPHY_MII_SSR 0x11 /* PHY Specific status register */
#define RGEPHY_SSR_S1000 0x8000 /* 1000Mbps */
#define RGEPHY_SSR_S100 0x4000 /* 100Mbps */
@@ -150,6 +150,7 @@
#define RGEPHY_SSR_SPD_DPLX_RESOLVED 0x0800 /* speed/duplex resolved */
#define RGEPHY_SSR_LINK 0x0400 /* link up */
#define RGEPHY_SSR_MDI_XOVER 0x0040 /* MDI crossover */
+#define RGEPHY_SSR_ALDPS 0x0008 /* RTL8211C(L) only */
#define RGEPHY_SSR_JABBER 0x0001 /* Jabber */
#endif /* _DEV_MII_RGEPHYREG_H_ */