From patchwork Sat Sep 25 04:23:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 208762 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o8P4Na4u008550 for ; Sat, 25 Sep 2010 04:23:36 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751910Ab0IYEXf (ORCPT ); Sat, 25 Sep 2010 00:23:35 -0400 Received: from mail-iw0-f174.google.com ([209.85.214.174]:60607 "EHLO mail-iw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751491Ab0IYEXf (ORCPT ); Sat, 25 Sep 2010 00:23:35 -0400 Received: by iwn5 with SMTP id 5so2924752iwn.19 for ; Fri, 24 Sep 2010 21:23:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=U7AqLBLDSp8EZj4lFQCc/wxdbfGgNOGF+bq3nemv+8s=; b=RyKT7siGyC9irWSqWdSaCfTGFOX5NLY85ooraQdimhI6IVJliZkmcohOGePVs3on7S 7Riw8PkWsSqllsvfF1nNIO/2AXLKrtN9BbZdL0RfN2rRNonceQUH+D8ydunvxYODhcqH rG5a4wlwzPDSWVrzaKnYhC1152U0PfqTl58FE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=plCI2AkmJtVyLIkASvy1jlXdwt9+T4ETnWSyzZkxHVqeBGwRs9tEFhwFqdt4lp6pJK DyStpe3GOo3y5TOR9fyJXp9kmEVBUOHUXQ2LZkBLcrn6tscN6zafCtSLy0ssW2hX550m 2QzN0n2IyYDdGnrKgB7rXSH7v50pbo5zS0ha8= MIME-Version: 1.0 Received: by 10.231.160.17 with SMTP id l17mr4924352ibx.102.1285388614155; Fri, 24 Sep 2010 21:23:34 -0700 (PDT) Received: by 10.231.206.203 with HTTP; Fri, 24 Sep 2010 21:23:33 -0700 (PDT) In-Reply-To: <20100924032401.GA10294@void.printf.net> References: <20100924032401.GA10294@void.printf.net> Date: Sat, 25 Sep 2010 00:23:33 -0400 Message-ID: Subject: Re: [patch] sdhci: correct f_min in sd 3.0 From: zhangfei gao To: Chris Ball Cc: linux-mmc@vger.kernel.org, Kyungmin Park 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.3 (demeter1.kernel.org [140.211.167.41]); Sat, 25 Sep 2010 04:23:36 +0000 (UTC) From dc098c73df0872269b3d364462672664450d1df4 Mon Sep 17 00:00:00 2001 From: Zhangfei Gao Date: Mon, 20 Sep 2010 15:15:18 -0400 Subject: [PATCH] sdhci: correct f_min in sd 3.0 Signed-off-by: Zhangfei Gao --- drivers/mmc/host/sdhci.c | 8 +++++--- drivers/mmc/host/sdhci.h | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 5928b0a..829e78a 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1007,14 +1007,14 @@ static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock) if (host->max_clk <= clock) div = 1; else { - for (div = 2; div < 2046; div += 2) { + for (div = 2; div < SDHCI_MAX_DIV_SPEC_300; div += 2) { if ((host->max_clk / div) <= clock) break; } } } else { /* Version 2.00 divisors must be a power of 2. */ - for (div = 1; div < 256; div *= 2) { + for (div = 1; div < SDHCI_MAX_DIV_SPEC_200; div *= 2) { if ((host->max_clk / div) <= clock) break; } @@ -1836,8 +1836,10 @@ int sdhci_add_host(struct sdhci_host *host) mmc->ops = &sdhci_ops; if (host->ops->get_min_clock) mmc->f_min = host->ops->get_min_clock(host); + else if (host->version >= SDHCI_SPEC_300) + mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_300; else - mmc->f_min = host->max_clk / 256; + mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_200; mmc->f_max = host->max_clk; mmc->caps |= MMC_CAP_SDIO_IRQ; diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index ae28a31..d35fb3d 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -185,6 +185,9 @@ #define SDHCI_SPEC_200 1 #define SDHCI_SPEC_300 2 +#define SDHCI_MAX_DIV_SPEC_200 256 +#define SDHCI_MAX_DIV_SPEC_300 2046 + struct sdhci_ops; struct sdhci_host { -- 1.7.0.4