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: 2334 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id EAD6B23F08 for ; Tue, 28 Jun 2011 07:57:46 +0000 (UTC) Received: from mail-qy0-f173.google.com (mail-qy0-f173.google.com [209.85.216.173]) by fiordland.canonical.com (Postfix) with ESMTP id A2C4FA187CE for ; Tue, 28 Jun 2011 07:57:46 +0000 (UTC) Received: by qyk10 with SMTP id 10so1065950qyk.11 for ; Tue, 28 Jun 2011 00:57:46 -0700 (PDT) Received: by 10.229.62.194 with SMTP id y2mr5486102qch.4.1309247866026; Tue, 28 Jun 2011 00:57:46 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.229.48.135 with SMTP id r7cs1843qcf; Tue, 28 Jun 2011 00:57:44 -0700 (PDT) Received: by 10.14.122.81 with SMTP id s57mr4910187eeh.195.1309247863727; Tue, 28 Jun 2011 00:57:43 -0700 (PDT) Received: from eu1sys200aog120.obsmtp.com (eu1sys200aog120.obsmtp.com [207.126.144.149]) by mx.google.com with SMTP id y18si10872515eeh.3.2011.06.28.00.57.38 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 28 Jun 2011 00:57:43 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.149 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.149; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.149 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com 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 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