From patchwork Tue Jun 28 07:57:33 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 923492 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p5S83Reu013620 for ; Tue, 28 Jun 2011 08:04:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754861Ab1F1IAB (ORCPT ); Tue, 28 Jun 2011 04:00:01 -0400 Received: from eu1sys200aog120.obsmtp.com ([207.126.144.149]:39648 "EHLO eu1sys200aog120.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756343Ab1F1H5o (ORCPT ); Tue, 28 Jun 2011 03:57:44 -0400 Received: from beta.dmz-us.st.com ([167.4.1.35]) (using TLSv1) by eu1sys200aob120.postini.com ([207.126.147.11]) with SMTP ID DSNKTgmJcXYJKpDuIj/4LqIgsvwNFAyJlF1o@postini.com; Tue, 28 Jun 2011 07:57:43 UTC Received: from zeta.dmz-us.st.com (ns4.st.com [167.4.16.71]) by beta.dmz-us.st.com (STMicroelectronics) with ESMTP id BAECA3C; Tue, 28 Jun 2011 07:57:36 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-us.st.com (STMicroelectronics) with ESMTP id 5A51179; Tue, 28 Jun 2011 07:57:36 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 75DC0A8072; Tue, 28 Jun 2011 09:57:32 +0200 (CEST) Received: from localhost.localdomain (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.83.0; Tue, 28 Jun 2011 09:57:35 +0200 From: Linus Walleij To: , Cc: Lee Jones , Ulf Hansson , Linus Walleij Subject: [PATCH 2/4] mmci: adjust calculation of f_min Date: Tue, 28 Jun 2011 09:57:33 +0200 Message-ID: <1309247853-17143-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.3.2 MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 28 Jun 2011 08:04:48 +0000 (UTC) From: Ulf Hansson For the st_clkdiv variant f_min is too low for practical cases, there is a heuristic calculation that appear to set the min frequency to mclk rounded up with 512, for our practical use cases dividing by 257 gives a reasonable floor value on the ST Micro version of the clock divider. Signed-off-by: Ulf Hansson Reviewed-by: Sebastian Rasmussen [Use DIV_ROUND_UP to clarify elder code] Signed-off-by: Linus Walleij --- drivers/mmc/host/mmci.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index fe14072..c73d054 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -1063,7 +1063,10 @@ static int __devinit mmci_probe(struct amba_device *dev, } mmc->ops = &mmci_ops; - mmc->f_min = (host->mclk + 511) / 512; + if (variant->st_clkdiv) + mmc->f_min = host->mclk / 257; + else + mmc->f_min = DIV_ROUND_UP(host->mclk, 512); /* * If the platform data supplies a maximum operating * frequency, this takes precedence. Else, we fall back