On Thu, Sep 23, 2010 at 11:24 PM, Chris Ball <cjb@xxxxxxxxxx> wrote: > Hi, > > On Mon, Sep 20, 2010 at 03:32:58AM -0400, zhangfei gao wrote: >> From: Zhangfei Gao <zhangfei.gao@xxxxxxxxxxx> >> Date: Mon, 20 Sep 2010 15:15:18 -0400 >> Subject: [PATCH 4/4] sdhci: correct f_min in sd 3.0 >> >> Change-Id: Ie8604dbb5296b15da67071164564f21c60652b60 >> >> Signed-off-by: Zhangfei Gao <zhangfei.gao@xxxxxxxxxxx> >> --- >> drivers/mmc/host/sdhci.c | 2 ++ >> 1 files changed, 2 insertions(+), 0 deletions(-) >> >> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c >> index f980fb7..5346803 100644 >> --- a/drivers/mmc/host/sdhci.c >> +++ b/drivers/mmc/host/sdhci.c >> @@ -1835,6 +1835,8 @@ 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 / 2046; >> else >> mmc->f_min = host->max_clk / 256; >> mmc->f_max = host->max_clk; > > Oh, right -- it would be good to #define symbols for 256 and 2046, > since we're inserting them into sdhci.c for the second time. > Perhaps SDHCI_MAX_DIV_SPEC_{200,300}? > > I can do that in a separate patch if you prefer, or you could roll > it into this one. > > Thanks, > > -- > Chris Ball <cjb@xxxxxxxxxx> <http://printf.net/> > One Laptop Per Child > Thanks for your suggestion, here is updated patch. >From dc098c73df0872269b3d364462672664450d1df4 Mon Sep 17 00:00:00 2001 From: Zhangfei Gao <zhangfei.gao@xxxxxxxxxxx> Date: Mon, 20 Sep 2010 15:15:18 -0400 Subject: [PATCH] sdhci: correct f_min in sd 3.0 Signed-off-by: Zhangfei Gao <zhangfei.gao@xxxxxxxxxxx> --- 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
From dc098c73df0872269b3d364462672664450d1df4 Mon Sep 17 00:00:00 2001 From: Zhangfei Gao <zhangfei.gao@xxxxxxxxxxx> Date: Mon, 20 Sep 2010 15:15:18 -0400 Subject: [PATCH] sdhci: correct f_min in sd 3.0 Signed-off-by: Zhangfei Gao <zhangfei.gao@xxxxxxxxxxx> --- 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