From patchwork Wed Jun 15 09:40:01 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Machek X-Patchwork-Id: 881472 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p5F9lw22003364 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 15 Jun 2011 09:48:19 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QWmhN-0008Vq-TI; Wed, 15 Jun 2011 09:47:46 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QWmhN-0006GL-DQ; Wed, 15 Jun 2011 09:47:45 +0000 Received: from mail.sysgo.com ([195.145.229.155]) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QWmh3-0006D8-Pl for linux-arm-kernel@lists.infradead.org; Wed, 15 Jun 2011 09:47:27 +0000 Received: from lantia.sysgo.com (unknown [172.22.2.7]) by mail.sysgo.com (Postfix) with ESMTP id C39EF14124; Wed, 15 Jun 2011 11:40:03 +0200 (CEST) Received: by lantia.sysgo.com (Postfix, from userid 113) id 7A34C5A23B; Wed, 15 Jun 2011 11:40:03 +0200 (CEST) Received: from dagobert.sysgo.com (dagobert.sysgo.com [172.22.1.2]) by lantia.sysgo.com (Postfix) with ESMTPS id 6CCB15A234; Wed, 15 Jun 2011 11:40:03 +0200 (CEST) Received: from dagobert.sysgo.com (localhost [127.0.0.1]) by dagobert.sysgo.com (8.12.7/8.12.7/SuSE Linux 0.6) with ESMTP id p5F9e2Br017263; Wed, 15 Jun 2011 11:40:02 +0200 Received: from localhost (localhost [[UNIX: localhost]]) by dagobert.sysgo.com (8.12.7/8.12.7/Submit) id p5F9e25Z017258; Wed, 15 Jun 2011 11:40:02 +0200 X-Authentication-Warning: dagobert.sysgo.com: pma set sender to pma@sysgo.com using -f Date: Wed, 15 Jun 2011 11:40:01 +0200 From: Pavel Machek To: linux-mmc@vger.kernel.org Subject: sdhci-esdhc-imx -- MMC 10x slower than it should be Message-ID: <20110615094001.GA21137@pma.sysgo.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110615_054725_979613_2305563B X-CRM114-Status: UNSURE ( 9.08 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: pba@sysgo.com, w.sang@pengutronix.de, linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de, cjb@laptop.org, shawn.guo@freescale.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 15 Jun 2011 09:48:19 +0000 (UTC) Hi! We are seeing issues with sdhci-esdhc-imx in 2.6.39; performance is not what it should be; it is about 10x lower in fact. ( 2.6.39 -mostly-vanilla: dd if=/dev/mmcblk0 of=/dev/null bs=1024 count=10240 <7>sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x00000001 takes cca 17 seconds. 2.6.34 -with-freescale-patches: dd if=/dev/mmcblk0 of=/dev/null bs=1024 count=10240 takes about 1 second. ) I could not pinpoint why; I found following issues while debugging: When the core asks for 52MHz, code seems to select 40MHz even when it can do 48MHz. I was able to work around with this: */ return; case SDHCI_HOST_CONTROL: /* FSL messed up here, so we can just keep those two */ new_val = val & (SDHCI_CTRL_LED | SDHCI_CTRL_4BITBUS); ...any idea what this comment means? I'd like to eventualy support 8BITBUS... Part of the problem is that esdhc_writeb_le() does translation of bits into breescale format; but readb() does not do translation back, and core code uses read-modify-write on the register, for example when turning on the LED. What to do there? Translate back? Add shadow variable? Get rid of read-modify-write? Any ideas why it is slow? Pavel diff -u -r1.1 sdhci-esdhc.h --- sdhci-esdhc.h 14 Jun 2011 13:04:27 -0000 1.1 +++ sdhci-esdhc.h 15 Jun 2011 08:28:25 -0000 @@ -59,10 +59,12 @@ while (host->max_clk / pre_div / 16 > clock && pre_div < 256) pre_div *= 2; + pre_div /= 2; + while (host->max_clk / pre_div / div > clock && div < 16) div++; ...but then it sometimes produces higher frequency then requested. mx_sdhci driver does something way more complex here. +++ sdhci-esdhc-imx.c 15 Jun 2011 08:28:25 -0000 @@ -164,11 +166,24 @@