From owner-freebsd-arm@FreeBSD.ORG Mon Sep 17 14:33:30 2007 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0399516A41B for ; Mon, 17 Sep 2007 14:33:30 +0000 (UTC) (envelope-from krassi@bulinfo.net) Received: from mx.bulinfo.net (mx.bulinfo.net [193.194.156.1]) by mx1.freebsd.org (Postfix) with ESMTP id 76EAA13C442 for ; Mon, 17 Sep 2007 14:33:29 +0000 (UTC) (envelope-from krassi@bulinfo.net) Received: from localhost (localhost [127.0.0.1]) by mx.bulinfo.net (Postfix) with ESMTP id 6E19F15459; Mon, 17 Sep 2007 17:33:24 +0300 (EEST) Received: from mx.bulinfo.net ([127.0.0.1]) by localhost (mx.bulinfo.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 56609-02; Mon, 17 Sep 2007 17:33:19 +0300 (EEST) Received: from [192.168.2.188] (pythia.bulinfo.net [212.72.195.5]) by mx.bulinfo.net (Postfix) with ESMTP id 4B4D4155B1; Mon, 17 Sep 2007 17:33:19 +0300 (EEST) Message-ID: <46EE902E.60600@bulinfo.net> Date: Mon, 17 Sep 2007 17:33:18 +0300 From: Krassimir Slavchev User-Agent: Thunderbird 2.0.0.6 (X11/20070913) MIME-Version: 1.0 To: ticso@cicely.de References: <46B9C68E.2010000@bulinfo.net> <20070808.074028.-749249084.imp@bsdimp.com> <46B9CAD8.4040103@bulinfo.net> <20070808144152.GM41893@cicely12.cicely.de> <46B9DD23.70608@bulinfo.net> <20070808154756.GN41893@cicely12.cicely.de> <46B9EA90.3050508@bulinfo.net> <20070808162011.GP41893@cicely12.cicely.de> <46BA0A40.8030208@bulinfo.net> <20070808210607.GR41893@cicely12.cicely.de> In-Reply-To: <20070808210607.GR41893@cicely12.cicely.de> X-Enigmail-Version: 0.95.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at mx.bulinfo.net Cc: freebsd-arm@freebsd.org Subject: Re: CENTIPAD boot X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Sep 2007 14:33:30 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, I have problems to get the link speed from Test register (25). After link negotiation complete bit 1 is always set. So I use bit 13 in BMCR register. The code in emac.c: ... update = pEmac->EMAC_CFG & ~(AT91C_EMAC_SPD | AT91C_EMAC_FD); printf("emac: link"); while (!(AT91F_MII_ReadPhy(pEmac, phyaddr, MII_BMSR_REG) & MII_BMSR_NEG)) continue; stat2 = AT91F_MII_ReadPhy(pEmac, phyaddr, MII_BMCR_REG); if(stat2 & MII_BMCR_SPD) { printf(" 100TX"); update |= AT91C_EMAC_SPD; } else printf(" 10TX"); if(stat2 & MII_BMCR_FDX) { printf(" FDX"); update |= AT91C_EMAC_FD; } printf("\n"); emac.h: #define MII_BMCR_REG 0x0 #define MII_BMCR_FDX 0x0100 #define MII_BMCR_SPD 0x2000 #define MII_BMSR_REG 0x1 #define MII_BMSR_NEG 0x0020 I have tested this against fxp adapter with crossover cable and there is difference when fxp is configured with: 'ifconfig fxp0 media auto' and 'ifconfig fxp0 media 100BaseTX mediaopt full-duplex'. When fxp is configured with 'mediaopt full-duplex' the duplex mode is not detected. Bernd Walter wrote: > On Wed, Aug 08, 2007 at 09:24:00PM +0300, Krassimir Slavchev wrote: >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> >>> I would assume a RTL8201BL or RTL8201C? >>> I have code for the RTL8201BL, which I use with the AT91SAM7X256, but >>> it is likely not correct, since I tried a 10BASET link once and it >>> failed, but I just took the original code without modification though. >>> Anyway - Realtek has datasheets available online. >> RTL8201BL > > Realtek did something special it seems. > You get the duplex state in the BMCR bit 8 (Register 0). > 1 = full, 0 = half > The speed is in the Test register (25). > Bit 0: 1 = 100Mbit link > Bit 1: 1 = 10MBit link > Bit 0/1 both 0 no link > > You might want to loop over BMSR (Register 1) bit 3 as well, since a > 1 means that auto negotiation has finished. > But it might be Ok without it, because there should be enough delays > already. > In a real world scenario, e.g. in the kernel or running embedded, > you'll have to poll the status regulary, to update the MAC accordingly. > But it's not required in this case, since the link partner shouldn't > change during booting. > > Let me know if you have success with this, since I'll have to update > my AT91SAM7X256 code as well. > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (FreeBSD) iD8DBQFG7pAuxJBWvpalMpkRAgouAJ45QR74U4ZPTLabHDg+xVf4UpVEWQCfXCRf 21Nd2LZo+QHyNtV9XhXsisE= =Ssko -----END PGP SIGNATURE-----