From owner-freebsd-current@FreeBSD.ORG Wed Oct 15 20:25:14 2008 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 729831065690; Wed, 15 Oct 2008 20:25:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from cmail.optima.ua (cmail.optima.ua [195.248.191.121]) by mx1.freebsd.org (Postfix) with ESMTP id 6B06C8FC14; Wed, 15 Oct 2008 20:25:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) X-Spam-Flag: SKIP X-Spam-Yversion: Spamooborona-2.1.0 Received: from [212.86.226.226] (account mav@alkar.net HELO mavbook.mavhome.dp.ua) by cmail.optima.ua (CommuniGate Pro SMTP 5.1.14) with ESMTPSA id 225133346; Wed, 15 Oct 2008 23:25:12 +0300 Message-ID: <48F651A7.3040001@FreeBSD.org> Date: Wed, 15 Oct 2008 23:25:11 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.16 (X11/20080726) MIME-Version: 1.0 To: "M. Warner Losh" References: <5f67a8c40810052226k3070a11ah463a819c677f6307@mail.gmail.com> <20081008113848.c9b44354.webmaster@kibab.com> <20081012171201.da4da754.webmaster@kibab.com> <20081013.110310.-1622595361.imp@bsdimp.com> In-Reply-To: <20081013.110310.-1622595361.imp@bsdimp.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: webmaster@kibab.com, freebsd-arm@freebsd.org, freebsd-current@freebsd.org, zbeeble@gmail.com, freebsd-mobile@freebsd.org Subject: Re: RFC: PCI SD host controller driver & mmc/mmcsd modules improvements X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Oct 2008 20:25:14 -0000 M. Warner Losh wrote: > : Problem was solved by increasing the number of answer read attempts in mmc_send_app_op_cond(). With attached patch (against latest driver version) card is recognized properly on ~ 190th attempt (while in original driver there are only 100 attempts). > : > : Furthermore, non-mine SDHC card is now also recognized in this cardreader (it doesn't even under Windows). In this case, it takes about 400 attempts to read answer. > > I think I bumped the number of iterations to 100 when I found that 10 > wasn't enough. 25 different cards worked just fine, but I got use of > a 16MB SD card at BSDcan that needed like 65. Bumping it from 100 to > 1000, however, makes the timeout go from 1s to 10s. That opens up > window for insertion races, but that's the only downside I see... Of > course, we want to fix those races, but this may expose them a little > more.. > > I can't believe that you had a card that took 4s to become active! > > Can you confirm the elapsed time is really 4s for that card? > Otherwise, this may be pointing out a bug in another area of the > code... Completely fortunate I have noticed that number of iterations depends on my laptop power source. After small investigation I have found that it actually depends on dev.cpu.0.freq value. With default value 2400 I have only several iterations. But every double frequency decrease doubles iteration count. With minimum value 100MHz I have more then 100 iterations. Same time it doesn't looks like this time is a real wall time. It looks like DELAY() used in a loop has some problems with time counting. -- Alexander Motin