diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2012-09-13 04:15:19 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2012-09-13 04:15:19 +0000 |
commit | 1ad5931063928800aa8d6066db96e1ad6cd50769 (patch) | |
tree | f4a57b38c371b5ebebba5f952a743666b66af8fc | |
parent | 5c2c979466047cf646b058f24983a53214cbe0cb (diff) |
tell mii_attach where the phy is on the chip, rather than asking it to
probe every address and have bge_miibus_read fail at the wrong address.
needed to support recent chips which have phys in locations other than
phy address 1 (and removes a conditional in an io path).
-rw-r--r-- | sys/dev/pci/if_bge.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c index d63a42a7cac..968af77da56 100644 --- a/sys/dev/pci/if_bge.c +++ b/sys/dev/pci/if_bge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bge.c,v 1.311 2012/07/04 13:24:41 kettenis Exp $ */ +/* $OpenBSD: if_bge.c,v 1.312 2012/09/13 04:15:18 dlg Exp $ */ /* * Copyright (c) 2001 Wind River Systems @@ -586,18 +586,6 @@ bge_miibus_readreg(struct device *dev, int phy, int reg) u_int32_t val, autopoll; int i; - /* - * Broadcom's own driver always assumes the internal - * PHY is at GMII address 1. On some chips, the PHY responds - * to accesses at all addresses, which could cause us to - * bogusly attach the PHY 32 times at probe type. Always - * restricting the lookup to address 1 is simpler than - * trying to figure out which chips revisions should be - * special-cased. - */ - if (phy != 1) - return (0); - /* Reading with autopolling on may trigger PCI errors */ autopoll = CSR_READ_4(sc, BGE_MI_MODE); if (autopoll & BGE_MIMODE_AUTOPOLL) { @@ -2253,8 +2241,8 @@ bge_attach(struct device *parent, struct device *self, void *aux) if (sc->bge_flags & BGE_PHY_FIBER_MII) mii_flags |= MIIF_HAVEFIBER; mii_attach(&sc->bge_dev, &sc->bge_mii, 0xffffffff, - MII_PHY_ANY, MII_OFFSET_ANY, mii_flags); - + 1, MII_OFFSET_ANY, mii_flags); + if (LIST_FIRST(&sc->bge_mii.mii_phys) == NULL) { printf("%s: no PHY found!\n", sc->bge_dev.dv_xname); ifmedia_add(&sc->bge_mii.mii_media, |