From owner-freebsd-current@FreeBSD.ORG Mon Mar 4 05:23:41 2013 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BE4E87D5; Mon, 4 Mar 2013 05:23:41 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from mail-pa0-f53.google.com (mail-pa0-f53.google.com [209.85.220.53]) by mx1.freebsd.org (Postfix) with ESMTP id 7C819CC3; Mon, 4 Mar 2013 05:23:41 +0000 (UTC) Received: by mail-pa0-f53.google.com with SMTP id bg4so2911226pad.40 for ; Sun, 03 Mar 2013 21:23:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:date:to:cc:subject:message-id:reply-to:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=wfAQ8Ww8eyxtUa4DCVR/D9Cloc0wqF67W9c2K1r/1ko=; b=e3RZJwtgBI3cILullvKDd4T0xLz/5cDsZUd0KUXJA2ImpOKj+c72uL4pfoYMzTd9KC iFSEqCaJcxvDjBND1Y1dopKF6D3GoXYOzPQf6UyIpFD2PKgoK1eYmwLqjDtntef8ezUc nDeDqD9kCsGvt04O+FuW+UFmdG8jUdl571231DeocQUx1v6xRm4qZFR8osqddcVzkFY3 05io5JF1cB/uNRid5o4q2wDp15np8zSZv1DxEvah+r787dDHeGuqp5vHWHlclGGX9Uk4 tDw3kih34WMNu6J+DlWQ7VTmh1wnn+0i1bAQbj9g2zmhTVxp8rjSsFbupz2oq5OCN+zx I3ZQ== X-Received: by 10.68.163.68 with SMTP id yg4mr16990380pbb.77.1362374615420; Sun, 03 Mar 2013 21:23:35 -0800 (PST) Received: from pyunyh@gmail.com (lpe4.p59-icn.cdngp.net. [114.111.62.249]) by mx.google.com with ESMTPS id mz8sm18360541pbc.9.2013.03.03.21.23.32 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 03 Mar 2013 21:23:34 -0800 (PST) Received: by pyunyh@gmail.com (sSMTP sendmail emulation); Mon, 04 Mar 2013 14:23:28 +0900 From: YongHyeon PYUN Date: Mon, 4 Mar 2013 14:23:28 +0900 To: Alexey Dokuchaev Subject: Re: ale(4) cannot negotiate as GigE Message-ID: <20130304052328.GA1445@michelle.cdnetworks.com> References: <20130221124344.GA93056@FreeBSD.org> <20130222011308.GA3259@michelle.cdnetworks.com> <20130222015607.GC66767@FreeBSD.org> <20130225082344.GC1426@michelle.cdnetworks.com> <20130303095330.GA57026@FreeBSD.org> <20130303120010.GA84560@FreeBSD.org> <20130304005044.GA4589@michelle.cdnetworks.com> <20130304015344.GA62059@FreeBSD.org> <20130304021059.GC4589@michelle.cdnetworks.com> <20130304024631.GA78040@FreeBSD.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="/9DWx/yDrRhgMJTb" Content-Disposition: inline In-Reply-To: <20130304024631.GA78040@FreeBSD.org> User-Agent: Mutt/1.4.2.3i Cc: current@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: pyunyh@gmail.com List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 05:23:41 -0000 --/9DWx/yDrRhgMJTb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Mar 04, 2013 at 02:46:31AM +0000, Alexey Dokuchaev wrote: > On Mon, Mar 04, 2013 at 11:10:59AM +0900, YongHyeon PYUN wrote: > > On Mon, Mar 04, 2013 at 01:53:44AM +0000, Alexey Dokuchaev wrote: > > > Yes, it did help. With 2000us delays (I didn't revert them [...] > > > > Great! But it seems 2ms delays is too much. Could you revert the change > > (2000us delays) and try it again? > > Reverting if_ale.c, making kernel, and reboot gave me 100baseTX again; :-( > second reboot (with the same kernel) did not help. Bumping delays to 2ms > (just to make sure) restored GigE mode upon 1st reboot after "make kernel". > Ok, here is final diff which combines two things you've tested. So revert any changes before applying it. Let me know how it goes on your box. > ./danfe --/9DWx/yDrRhgMJTb Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="ale.pr.diff3" Index: sys/dev/ale/if_ale.c =================================================================== --- sys/dev/ale/if_ale.c (revision 247382) +++ sys/dev/ale/if_ale.c (working copy) @@ -406,11 +406,11 @@ ale_phy_reset(struct ale_softc *sc) CSR_WRITE_2(sc, ALE_GPHY_CTRL, GPHY_CTRL_HIB_EN | GPHY_CTRL_HIB_PULSE | GPHY_CTRL_SEL_ANA_RESET | GPHY_CTRL_PHY_PLL_ON); - DELAY(1000); + DELAY(2000); CSR_WRITE_2(sc, ALE_GPHY_CTRL, GPHY_CTRL_EXT_RESET | GPHY_CTRL_HIB_EN | GPHY_CTRL_HIB_PULSE | GPHY_CTRL_SEL_ANA_RESET | GPHY_CTRL_PHY_PLL_ON); - DELAY(1000); + DELAY(2000); #define ATPHY_DBG_ADDR 0x1D #define ATPHY_DBG_DATA 0x1E @@ -635,7 +635,7 @@ ale_attach(device_t dev) /* Set up MII bus. */ error = mii_attach(dev, &sc->ale_miibus, ifp, ale_mediachange, ale_mediastatus, BMSR_DEFCAPMASK, sc->ale_phyaddr, MII_OFFSET_ANY, - MIIF_DOPAUSE); + MIIF_DOPAUSE | MIIF_MACPRIV0); if (error != 0) { device_printf(dev, "attaching PHYs failed\n"); goto fail; Index: sys/dev/mii/atphy.c =================================================================== --- sys/dev/mii/atphy.c (revision 247382) +++ sys/dev/mii/atphy.c (working copy) @@ -100,8 +100,14 @@ atphy_probe(device_t dev) static int atphy_attach(device_t dev) { + struct mii_attach_args *ma; + u_int flags; - mii_phy_dev_attach(dev, MIIF_NOMANPAUSE, &atphy_funcs, 1); + ma = device_get_ivars(dev); + flags = MIIF_NOMANPAUSE; + if ((miibus_get_flags(dev) & MIIF_MACPRIV0) != 0) + flags |= MIIF_PHYPRIV0; + mii_phy_dev_attach(dev, flags, &atphy_funcs, 1); return (0); } @@ -287,9 +293,11 @@ atphy_reset(struct mii_softc *sc) uint32_t reg; int i; - /* Take PHY out of power down mode. */ - PHY_WRITE(sc, 29, 0x29); - PHY_WRITE(sc, 30, 0); + if ((sc->mii_flags & MIIF_PHYPRIV0) != 0) { + /* Take PHY out of power down mode. */ + PHY_WRITE(sc, 29, 0x29); + PHY_WRITE(sc, 30, 0); + } reg = PHY_READ(sc, ATPHY_SCR); /* Enable automatic crossover. */ --/9DWx/yDrRhgMJTb--