From owner-freebsd-net@FreeBSD.ORG Mon Oct 17 00:10:06 2011 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C317E1065677 for ; Mon, 17 Oct 2011 00:10:06 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 482E08FC14 for ; Mon, 17 Oct 2011 00:10:05 +0000 (UTC) Received: by wyi40 with SMTP id 40so1528700wyi.13 for ; Sun, 16 Oct 2011 17:10:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:date:to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=+2AqLsAYh7hUTPDJEa+8jLd/BLS6QspsGqIWZ1vQeB4=; b=ijPahu0rQZ6u0EyDbJKICz+0Tj5C1GYDltHXHVDVfT478CtUiF68z/Cd1vfVuQ+1s0 rSF3TXqqwydxmoU6k75+aySK0mBQHb9Jc/s829WfBOxuI8u4iPSy49yvQRSzwwBk/p7M LwzBJQXPhH6o/BXBGrpKihPiiVdF2K2fbxt5k= Received: by 10.227.196.65 with SMTP id ef1mr6083819wbb.69.1318810205268; Sun, 16 Oct 2011 17:10:05 -0700 (PDT) Received: from pyunyh@gmail.com ([174.35.1.224]) by mx.google.com with ESMTPS id j18sm28003870wbo.6.2011.10.16.17.10.01 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 16 Oct 2011 17:10:03 -0700 (PDT) Received: by pyunyh@gmail.com (sSMTP sendmail emulation); Sun, 16 Oct 2011 17:08:22 -0700 From: YongHyeon PYUN Date: Sun, 16 Oct 2011 17:08:21 -0700 To: Marius Strobl Message-ID: <20111017000821.GA3338@michelle.cdnetworks.com> References: <20111009165838.GA19886@alchemy.franken.de> <20111010192238.GC1781@michelle.cdnetworks.com> <20111011212318.GC81376@alchemy.franken.de> <20111011225531.GD5661@michelle.cdnetworks.com> <20111012204222.GC39118@alchemy.franken.de> <20111012235707.GD9138@michelle.cdnetworks.com> <20111013214903.GH39118@alchemy.franken.de> <20111014203226.GA16192@michelle.cdnetworks.com> <20111015204739.GJ39118@alchemy.franken.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20111015204739.GJ39118@alchemy.franken.de> User-Agent: Mutt/1.4.2.3i Cc: freebsd-net@freebsd.org, dave jones Subject: Re: Question about GPIO bitbang MII X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pyunyh@gmail.com List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2011 00:10:06 -0000 On Sat, Oct 15, 2011 at 10:47:39PM +0200, Marius Strobl wrote: > On Fri, Oct 14, 2011 at 01:32:26PM -0700, YongHyeon PYUN wrote: > > On Thu, Oct 13, 2011 at 11:49:03PM +0200, Marius Strobl wrote: > > > On Wed, Oct 12, 2011 at 04:57:07PM -0700, YongHyeon PYUN wrote: > > > > On Wed, Oct 12, 2011 at 10:42:22PM +0200, Marius Strobl wrote: > > > > > On Tue, Oct 11, 2011 at 03:55:31PM -0700, YongHyeon PYUN wrote: > > > > > > On Tue, Oct 11, 2011 at 11:23:18PM +0200, Marius Strobl wrote: > > > > > > > On Mon, Oct 10, 2011 at 12:22:38PM -0700, YongHyeon PYUN wrote: > > > > > > > > On Sun, Oct 09, 2011 at 06:58:38PM +0200, Marius Strobl wrote: > > > > > > > > > On Fri, Oct 07, 2011 at 10:34:58AM +0800, dave jones wrote: > > > > > > > > > > Hi, > > > > > > > > > > > > > > > > > > > > Does FreeBSD have gpio bitbang api for MII? If not, any driver in tree using > > > > > > > > > > gpio-bitbang mii that I can refer to? Thanks. > > > > > > > > > > It seems like OpenBSD, NetBSD and Linux have added support to gpio bitbang mii, > > > > > > > > > > and it's useful for porting embedded devices. > > > > > > > > > > > > > > > > > > > > > > > > > > > > If what you are referring to is their mii_bitbang.[c,h] then I've a patch > > > > > > > > > which (im)ports these and converts drivers to take advantage of it here: > > > > > > > > > http://people.freebsd.org/~marius/mii_bitbang.diff > > > > > > > > > > > > > > > > Patch looks good to me. > > > > > > > > What about other drivers(rl(4), bm(4), lge(4), tl(4), nge(4), wb(4) > > > > > > > > and xe(4))? > > > > > > > > > > > > > > > > > > > > > > Meanwhile I've also converted bm(4), just re-fetch the patch. Generally > > > > > > > I've started with the drivers were the corresponding NetBSD one also > > > > > > > uses the common MII bitbang'ing code. As for nge(4), tl(4), wb(4) I'm > > > > > > > aware that these should also be convertible to the common code, I just > > > > > > > didn't get around to it so far. As for lge(4) that driver has some > > > > > > > remnants of MII bitbang'ing but doesn't actually use it AFAICT. I've > > > > > > > > > > > > Ah, I just blindly grepped the string, sorry. > > > > > > > > > > > > > previously missed rl(4) as I was only grepping beneath sys/dev and I > > > > > > > currently can't explain why I missed xe(4), so thanks for mentioning > > > > > > > these. > > > > > > > In my experience MII bitbang'ing is very fragile though and subtle > > > > > > > changes may break it so I don't want to commit these without testing > > > > > > > or in the case of smc(4) where at least the corresponding NetBSD > > > > > > > driver already uses the common code. Unfortunately, I only have > > > > > > > hardware for dc(4), stge(4), xl(4) and somewhere also for rl(4) and > > > > > > > tl(4) and I guess I can nwhitehorn@ regarding testing bm(4). Do you > > > > > > > happen to have hardware to test the remaining drivers, i.e. nge(4), > > > > > > > sis(4), ste(4), wb(4) and xe(4)? > > > > > > > > > > > > > > > > > > > I have access to sis(4) and ste(4). I also have a nge(4) but I'm > > > > > > not able to access to the hardware, at least in US. > > > > > > > > > > > > > > > > It would be great if you could test sis(4) and ste(4). > > > > > > > > > > > > > Ok, will do in this week. > > > > > > > > > > I just noticed that rl(4) only does MII bitbang'ing for the 8129 but I > > > only have a 8139. Do you happen do have the former so you could test the > > > patch with it? > > > > Sorry, I don't have 8129 based controller. > > > > > The patch is now complete as far as I'm willing to convert drivers. What's > > > left is ed(4) and xe(4). The former has several chip specific things > > > interwinded and I'm unsure whether it can be converted to use the common > > > code; I'd at least like to have hardware for the special cases to give > > > that a try. Xe(4) currently doesn't use miibus(4) (but should) so I > > > don't see much point in adding a dependency on miibus(4) just for the > > > bitbang'ing code on it (nor do I for not adding the common code to > > > miibus(4)). > > > > > > > Ok. > > Both sis(4) and ste(4) seem to work without problems. > > Thanks for your work! > > > > Thanks for testing! > While digging for test hardware I found a Intel 21143 based card I > decided to give a try for fun (as dc(4) doesn't use MII bitbang'ing > for these). Unfortunately, it turned out that some dc(4) changes > between 8.2-RELEASE an what's in head broke it in that it no longer > is able to establish a link (the link LED blinks periodically instead > of being lit permanently) ... > After reading this mail, I tried dual port Intel 21143 based controller and it worked as expected(with/without MII bitbang). Can you narrow down which change break your controller? Because there are so many dc(4) variants it would be better to know which controller you have. > Marius >