From 32b4fa08846f6a470f84cd297e2bda89b77a1102 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Mon, 26 Nov 2007 15:36:23 +0000 Subject: Reenable the PCS functions after a reset; properly disable them while changing the advertisement register. --- sys/dev/pci/if_cas.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'sys') diff --git a/sys/dev/pci/if_cas.c b/sys/dev/pci/if_cas.c index 865d2f4322f..292edd72648 100644 --- a/sys/dev/pci/if_cas.c +++ b/sys/dev/pci/if_cas.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cas.c,v 1.9 2007/10/06 14:50:22 jsg Exp $ */ +/* $OpenBSD: if_cas.c,v 1.10 2007/11/26 15:36:22 kettenis Exp $ */ /* * @@ -1584,6 +1584,7 @@ cas_pcs_writereg(struct device *self, int phy, int reg, int val) struct cas_softc *sc = (void *)self; bus_space_tag_t t = sc->sc_memt; bus_space_handle_t pcs = sc->sc_memh; + int reset = 0; #ifdef CAS_DEBUG if (sc->sc_debug) @@ -1594,8 +1595,12 @@ cas_pcs_writereg(struct device *self, int phy, int reg, int val) if (phy != CAS_PHYAD_EXTERNAL) return; + if (reg == MII_ANAR) + bus_space_write_4(t, pcs, CAS_MII_CONFIG, 0); + switch (reg) { case MII_BMCR: + reset = (val & CAS_MII_CONTROL_RESET); reg = CAS_MII_CONTROL; break; case MII_BMSR: @@ -1613,12 +1618,12 @@ cas_pcs_writereg(struct device *self, int phy, int reg, int val) bus_space_write_4(t, pcs, reg, val); - if (reg == CAS_MII_ANAR) { - bus_space_write_4(t, pcs, CAS_MII_SLINK_CONTROL, - CAS_MII_SLINK_LOOPBACK|CAS_MII_SLINK_EN_SYNC_D); + if (reset) + cas_bitwait(sc, pcs, CAS_MII_CONTROL, CAS_MII_CONTROL_RESET, 0); + + if (reg == CAS_MII_ANAR || reset) bus_space_write_4(t, pcs, CAS_MII_CONFIG, CAS_MII_CONFIG_ENABLE); - } } int -- cgit v1.2.3