add support for RTL8211C(L) phy.

From FreeBSD.
This commit is contained in:
cegger 2009-01-09 21:56:35 +00:00
parent df68862dbf
commit f7112a92d1
2 changed files with 20 additions and 6 deletions

View File

@ -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);

View File

@ -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_ */