Subject: Re: Dell Optiplex 745
To: None <current-users@netbsd.org>
From: Mark Davies <mark@mcs.vuw.ac.nz>
List: current-users
Date: 08/05/2007 09:24:53
--Boundary-00=_l6OtGVkh9tqQ0qI
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
On Saturday 04 August 2007, Bernd Ernesti wrote:
> On Sat, Aug 04, 2007 at 09:36:15AM +1200, Mark Davies wrote:
> [..]
>
> > Patches are attached below. Will commit over the weekend unless
> > someone finds a problem.
>
> I only had a quick look and know nothing about the chip internals,
> but are you sure about the miisdevs change?
>
> oui BROADCOM 0x001018 Broadcom
> Corporation +oui BROADCOM2 0x000af7
> Broadcom Corporation
>
> This smells like that this is not really a Broadcom chip.
As Michael van Elst noted this is another Broadcom oui.
> And why does brgphy.c use brgphy_5755* when it is for the 5754
> chip?
The 5755 names came from Jonathan Stone back when I was initially
trying to get this going but since I only had a 5754 I hadn't added
the 5755 to the supported ids. I've now modified the patch to add
it. OpenBSD uses function names that refer to the bug that is being
addressed, rather than a model where it was first addressed but that
would have been a bigger change to the code.
cheers
mark
--Boundary-00=_l6OtGVkh9tqQ0qI
Content-Type: text/x-diff;
charset="iso-8859-1";
name="patch2"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="patch2"
Index: miidevs
===================================================================
RCS file: /src/cvs/netbsd/src/sys/dev/mii/miidevs,v
retrieving revision 1.70
diff -u -r1.70 miidevs
--- miidevs 17 Feb 2007 23:24:32 -0000 1.70
+++ miidevs 4 Aug 2007 21:06:15 -0000
@@ -55,6 +55,7 @@
oui ALTIMA 0x0010a9 Altima Communications
oui AMD 0x00001a Advanced Micro Devices
oui BROADCOM 0x001018 Broadcom Corporation
+oui BROADCOM2 0x000af7 Broadcom Corporation
oui CICADA 0x0003F1 Cicada Semiconductor
oui DAVICOM 0x00606e Davicom Semiconductor
oui ENABLESEMI 0x0010dd Enable Semiconductor
@@ -141,6 +142,8 @@
model BROADCOM BCM5750 0x0018 BCM5750 1000BASE-T media interface
model BROADCOM BCM5714 0x0034 BCM5714 1000BASE-T media interface
model BROADCOM BCM5780 0x0035 BCM5780 1000BASE-T media interface
+model BROADCOM2 BCM5755 0x000c BCM5755 1000BASE-T media interface
+model BROADCOM2 BCM5754 0x000e BCM5754/5787 1000BASE-T media interface
/* Cicada Semiconductor PHYs (now owned by Vitesse?) */
model CICADA CS8201 0x0001 Cicada CS8201 10/100/1000TX PHY
Index: brgphy.c
===================================================================
RCS file: /src/cvs/netbsd/src/sys/dev/mii/brgphy.c,v
retrieving revision 1.33
diff -u -r1.33 brgphy.c
--- brgphy.c 13 Mar 2007 06:41:52 -0000 1.33
+++ brgphy.c 4 Aug 2007 21:08:18 -0000
@@ -109,6 +109,7 @@
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 @@
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 @@
{ 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 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 @@
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 @@
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 @@
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);
+}
--Boundary-00=_l6OtGVkh9tqQ0qI--