From owner-svn-src-head@FreeBSD.ORG Wed Oct 13 22:29:50 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58B3D106564A; Wed, 13 Oct 2010 22:29:49 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2D2498FC14; Wed, 13 Oct 2010 22:29:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9DMTnSD002984; Wed, 13 Oct 2010 22:29:49 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9DMTn32002982; Wed, 13 Oct 2010 22:29:49 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201010132229.o9DMTn32002982@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 13 Oct 2010 22:29:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213812 - head/sys/dev/bge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Oct 2010 22:29:50 -0000 Author: yongari Date: Wed Oct 13 22:29:48 2010 New Revision: 213812 URL: http://svn.freebsd.org/changeset/base/213812 Log: Fix a regression introduced in r213710. r213710 removed the use of auto polling such that it made all controllers obtain link status information from the state of the LNKRDY input signal. Broadcom recommends disabling auto polling such that driver should rely on PHY interrupts for link status change indications. Unfortunately it seems some controllers(BCM5703, BCM5704 and BCM5705) have PHY related issues so Linux took other approach to workaround it. bge(4) didn't follow that and it used to enable auto polling to workaround it. Restore this old behavior for BCM5700 family controllers and BCM5705 to use auto polling. For BCM5700 and BCM5701, it seems it does not need to enable auto polling but I restored it for safety. Special thanks to marius who tried lots of patches with patience. Reported by: marius Tested by: marius Modified: head/sys/dev/bge/if_bge.c Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Wed Oct 13 22:18:03 2010 (r213811) +++ head/sys/dev/bge/if_bge.c Wed Oct 13 22:29:48 2010 (r213812) @@ -2012,6 +2012,10 @@ bge_blockinit(struct bge_softc *sc) if (sc->bge_flags & BGE_FLAG_TBI) { CSR_WRITE_4(sc, BGE_MI_STS, BGE_MISTS_LINK); } else { + if (sc->bge_mi_mode & BGE_MIMODE_AUTOPOLL) { + CSR_WRITE_4(sc, BGE_MI_MODE, sc->bge_mi_mode); + DELAY(80); + } if (sc->bge_asicrev == BGE_ASICREV_BCM5700 && sc->bge_chipid != BGE_CHIPID_BCM5700_B2) CSR_WRITE_4(sc, BGE_MAC_EVT_ENB, @@ -2677,6 +2681,9 @@ bge_attach(device_t dev) sc->bge_mi_mode = BGE_MIMODE_500KHZ_CONST; else sc->bge_mi_mode = BGE_MIMODE_BASE; + /* Enable auto polling for BCM570[0-5]. */ + if (BGE_IS_5700_FAMILY(sc) || sc->bge_asicrev == BGE_ASICREV_BCM5705) + sc->bge_mi_mode |= BGE_MIMODE_AUTOPOLL; /* * All controllers that are not 5755 or higher have 4GB