From c6ac76ad734bd09b89b06b71ff285f766c583a63 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Thu, 5 Jun 2008 05:51:19 +0000 Subject: [PATCH] Fix the media auto code by breaking it :-). Auto now just means 'use 10BaseT' since it required 10BaseT to have carrier to switch to it. This chip makes it hard to do proper auto, so we don't do it. We can't test carrier on things easily. Don't insist on carrier when we set the media. Don't report failures. Remove a 1s! delay that appears to not be needed. With these patches, and John Baldwin's patches, I'm able to pass packets on my IBM EtherJet card again. --- sys/dev/cs/if_cs.c | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/sys/dev/cs/if_cs.c b/sys/dev/cs/if_cs.c index b054d2b80da..09e397f06d4 100644 --- a/sys/dev/cs/if_cs.c +++ b/sys/dev/cs/if_cs.c @@ -194,7 +194,6 @@ control_dc_dc(struct cs_softc *sc, int on_not_off) else self_control &= ~HCB1; cs_writereg(sc, PP_SelfCTL, self_control); - DELAY(500000); } @@ -215,7 +214,6 @@ cs_duplex_auto(struct cs_softc *sc) } DELAY(1000); } - DELAY(1000000); return (error); } @@ -225,13 +223,6 @@ enable_tp(struct cs_softc *sc) cs_writereg(sc, PP_LineCTL, sc->line_ctl & ~AUI_ONLY); control_dc_dc(sc, 0); - DELAY( 150000 ); - - if ((cs_readreg(sc, PP_LineST) & LINK_OK)==0) { - device_printf(sc->dev, "failed to enable TP\n"); - return (EINVAL); - } - return (0); } @@ -288,10 +279,8 @@ enable_aui(struct cs_softc *sc) cs_writereg(sc, PP_LineCTL, (sc->line_ctl & ~AUTO_AUI_10BASET) | AUI_ONLY); - if (!send_test_pkt(sc)) { - device_printf(sc->dev, "failed to enable AUI\n"); + if (!send_test_pkt(sc)) return (EINVAL); - } return (0); } @@ -306,10 +295,8 @@ enable_bnc(struct cs_softc *sc) cs_writereg(sc, PP_LineCTL, (sc->line_ctl & ~AUTO_AUI_10BASET) | AUI_ONLY); - if (!send_test_pkt(sc)) { - device_printf(sc->dev, "failed to enable BNC\n"); + if (!send_test_pkt(sc)) return (EINVAL); - } return (0); } @@ -1246,10 +1233,12 @@ cs_mediaset(struct cs_softc *sc, int media) switch (IFM_SUBTYPE(media)) { default: case IFM_AUTO: - if ((error=enable_tp(sc))==0) - error = cs_duplex_auto(sc); - else if ((error=enable_bnc(sc)) != 0) - error = enable_aui(sc); + /* + * This chip makes it a little hard to support this, so treat + * it as IFM_10_T, auto duplex. + */ + enable_tp(sc); + cs_duplex_auto(sc); break; case IFM_10_T: enable_tp(sc);