Add support for BCM5754 and BCM5755. From suggestions from Jonathan

Stone.
This commit is contained in:
markd 2007-08-06 12:16:33 +00:00
parent cd8e0b4a5a
commit 908b67c316
1 changed files with 46 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: brgphy.c,v 1.33 2007/03/13 06:41:52 msaitoh Exp $ */
/* $NetBSD: brgphy.c,v 1.34 2007/08/06 12:16:33 markd Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@ -74,7 +74,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.33 2007/03/13 06:41:52 msaitoh Exp $");
__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.34 2007/08/06 12:16:33 markd Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -109,6 +109,7 @@ static void brgphy_5703_reset(struct mii_softc *);
static void brgphy_5704_reset(struct mii_softc *);
static void brgphy_5705_reset(struct mii_softc *);
static void brgphy_5750_reset(struct mii_softc *);
static void brgphy_5755_reset(struct mii_softc *);
static const struct mii_phy_funcs brgphy_funcs = {
brgphy_service, brgphy_status, mii_phy_reset,
@ -138,6 +139,10 @@ const struct mii_phy_funcs brgphy_5750_funcs = {
brgphy_service, brgphy_status, brgphy_5750_reset,
};
const struct mii_phy_funcs brgphy_5755_funcs = {
brgphy_service, brgphy_status, brgphy_5755_reset,
};
static const struct mii_phydesc brgphys[] = {
{ MII_OUI_BROADCOM, MII_MODEL_BROADCOM_BCM5400,
@ -176,6 +181,12 @@ static const struct mii_phydesc brgphys[] = {
{ MII_OUI_BROADCOM, MII_MODEL_BROADCOM_BCM5780,
MII_STR_BROADCOM_BCM5780 },
{ MII_OUI_BROADCOM2, MII_MODEL_BROADCOM2_BCM5755,
MII_STR_BROADCOM2_BCM5755 },
{ MII_OUI_BROADCOM2, MII_MODEL_BROADCOM2_BCM5754,
MII_STR_BROADCOM2_BCM5754 },
{ 0, 0,
NULL },
};
@ -185,6 +196,7 @@ static void bcm5411_load_dspcode(struct mii_softc *);
static void bcm5703_load_dspcode(struct mii_softc *);
static void bcm5704_load_dspcode(struct mii_softc *);
static void bcm5750_load_dspcode(struct mii_softc *);
static void bcm5755_load_dspcode(struct mii_softc *);
static int
brgphymatch(struct device *parent, struct cfdata *match,
@ -264,6 +276,11 @@ brgphyattach(struct device *parent, struct device *self, void *aux)
sc->mii_funcs = &brgphy_5750_funcs;
break;
case MII_MODEL_BROADCOM2_BCM5754:
case MII_MODEL_BROADCOM2_BCM5755:
sc->mii_funcs = &brgphy_5755_funcs;
break;
default:
sc->mii_funcs = &brgphy_funcs;
break;
@ -570,6 +587,13 @@ brgphy_5750_reset(struct mii_softc *sc)
bcm5750_load_dspcode(sc);
}
static void
brgphy_5755_reset(struct mii_softc *sc)
{
mii_phy_reset(sc);
bcm5755_load_dspcode(sc);
}
/* Turn off tap power management on 5401. */
static void
bcm5401_load_dspcode(struct mii_softc *sc)
@ -673,3 +697,23 @@ bcm5750_load_dspcode(struct mii_softc *sc)
for (i = 0; dspcode[i].reg != 0; i++)
PHY_WRITE(sc, dspcode[i].reg, dspcode[i].val);
}
static void
bcm5755_load_dspcode(struct mii_softc *sc)
{
static const struct {
int reg;
uint16_t val;
} dspcode[] = {
{ BRGPHY_MII_AUXCTL, 0x0c00 },
{ BRGPHY_MII_DSP_ADDR_REG, 0x000a },
{ BRGPHY_MII_DSP_RW_PORT, 0x010b },
{ BRGPHY_MII_AUXCTL, 0x0400 },
{ 0, 0 },
};
int i;
for (i = 0; dspcode[i].reg != 0; i++)
PHY_WRITE(sc, dspcode[i].reg, dspcode[i].val);
}